Hi all,
Yesterday I installed torrent server and GUI client. The process was not straight-forward,
so I thought it would be a good idea to write down what I did before I forgot it.
I hope it is not too late...
There are several other guides I used (thanks to all), but none of them has all the steps.
See also
http://buffalo.nas-central.org/index.ph ... t_on_LSProThe steps below describe how I managed to install rtorrent and ntorrent
on LS Live HS-DH320GL, firmware 1.06
0. Overview
- rtorrent is the torrent server/application
- ntorrent is a Java client for rtorrent using scgi protocol for communication.
Download from
http://code.google.com/p/ntorrent/- lighttpd is a web server ,and it serves the scgi protocol.
http://trac.lighttpd.net/trac/wiki/Tuto ... figuration- SCREEN is a window manager and provides means to run interactive applications,
like rtorrent in the background. Google for GNU screen, I learned only how to start
it and how to detach the session using Ctrl+a, then Ctrl+d keys
rtorrent will automatically start serving the torrents, provided you
place .torrent files in a the configured directory.
There is also web client available - wtorrent. It requires sqllite install, so I decided to ntorrent instead.
In order to install additional applications on the linkstation you have got to have access to it
- so you need telnet (or ssh).
1. Install telnet on the linkstation
Use acp commander and install telnet as described in
http://buffalo.nas-central.org/index.ph ... k_Firmware2. Bootstrap the linkstation
Download and run the bootstrap script, now it is at version 1.2-5:
cd /tmp
wget
http://ipkg.nslu2-linux.org/feeds/optwa ... -5_arm.xsh sh lspro-bootstrap_1.2-5_arm.xsh
Reconnect again with telnet and update ipkg
ipkg update
Reference:
viewtopic.php?f=19&t=4075&p=39162#p391623. Install lighttpd, rtorrent, screen
ipkg install lighttpd
ipkg install rtorrent
ipkg install screen
4. Configure rtorrent - scgi, user, mem usage, folders ...
Edit the default config file
vi /opt/etc/rtorrent.conf
Add the host:port
scgi_port = localhost:5000
Note: DO NOT specify scgi_local or lighttpd would fail to start
#scgi_local = /tmp/rtorrent/rpc.socket
There are report for linkstation crashing when rtorrent uses to much memory.
I set it to use half the memory of Linkstation Live and limited the number of connections.
Place .torrent files in the directory specified and rtorrent will do them
Here what I used:
max_memory_usage = 67108864
directory = /mnt/disk1/dat/Downloads
session = /mnt/disk1/dat/Downloads/rtorrent.session
max_pears = 20
max_pears_per_seed = 5
schedule = low_diskspace,5,60,close_low_diskspace=100M
use_udp_trackers = yes
check_hash = no
encryption = allow_incoming,enable_retry,prefer_plaintext
dht = auto
You have got to decide which user account will be running rtorrent.
Make sure the directories exist and <torrent user> (the user that will be running rtorrent)
has read/write permissions.
5. Configure the start script for rtorrent
vi /opt/etc/init.d/S99rtorrent
Specify custom dir layout:
#dirlayout=RTORRENT_DEFAULT
dirlayout=CUSTOM
Set user name:
#user = "p2p"
user = <torrent user>
Set the correct script path:
#SCRIPTNAME=/etc/init.d/$NAME
SCRIPTNAME=/opt/etc/init.d/$NAME
Change the start command near the end:
d_start() {
[ -d "${base}" ] && cd "${base}"
stty stop undef && stty start undef
su -c "screen -d -m -S rtorrent rtorrent $options 2>&1 1>/dev/null" ${user} | tee -a "$logfile"
}
See also
http://www.synology.com/wiki/index.php/ ... rent_HowTo for a start command that removes the rtorrent lock file.
Allow write to /dev/null
chmod a+rw /dev/null
6. Configure lighttpd - scgi, port
Edit litthppd.conf
vi /opt/etc/lighttpd/lighttpd.conf
and uncomment the line "mod_scgi" near the beginning
Set the port, or leave it at its default value 8081.
server.port = 8081
Specify the scgi server. Note that it is written with dot, scgi.server, compared to
scgi_port in rtorrent config. Use the port number of the lighttpd server in the previous step.
scgi.server = (
"/RPC2" =>
("127.0.0.1" =>
("host" => "127.0.0.1",
"port" => "8081",
"check-local" => "disable")))
7. Test lighttpd & rtorrent
Start lighttpd and rtorrent:
/opt/etc/init.d/S80lighttpd start
/opt/etc/init.d/S99rtorrent start
List the processes, you shall see lighttpd and screen running,
and also rtorrent running for the torrent user:
ps aux
If the processes are not ok, you may look for the error in the log files folder:
/opt/var/log
/opt/var/log/lighttpd
Now telnet as the torrent user and try to connect to rtorrent
telnet
See if the rtorrent is running in screen session
screen -list
Connect to the rtorrent session
screen -r
Leave the screen session, before exiting telnet
Ctrl+a, Ctrl+d
Try to access lighttpd on LS from another pc, use your favourite browser and go to
http://<linkstation_ip>:port
if you change the config files stop the deamons:
/opt/etc/init.d/S80lighttpd stop
/opt/etc/init.d/S99rtorrent stop
then start them again.
Finally, you may reboot the linkstation and see if the lighttpd and rtorrent
will be run automatically as they should:
reboot
telnet
ps aux
Look in the process list for lighttpd, screen, rtorrent
8. Download and install ntorrent on the client pc
run ntorrent
HTTP
host = <linkstation_ip>
port = 8081
Mountpoint = /RPC2
now click Connect and use
Important security note at the end:
Apparently there is a security vulnerability, either in proftpd itself, or in one of the other services.
I had the Linkstation ftp server port forwarded on the router for outside use for a long time,
with password-protected accounts, and I was the only one that knew the passwords.
But just half an hour after I completed the rtorrent server install and left it running,
I noticed the HDD spins w/o having any torrents to work on. Quick look on the processes
shown that there is an FTP connection leaching files via the proftpd, from an IP address
I do not know and w/o anyone knowing the FTP passwords.
I stopped the FTP server, and removed the ftp port forwarding on the router. I wrote down
the attacker ip, should I decide to try revenge.
vnaumov