rutorrent 3.1 multi-user bug? [SOLVED]

shwetha17

Member
May 24, 2018
785
0
16
I have a rutorrent 3.1 set up with multi-users, this is the watch folder config from a user's .rtorrent.rc file:

Code:
schedule = watch_directory,5,60,load_start=/home/user/watch/*.torrent
The torrents are picked up automatically, but they appear as stopped.

This used to work just fine in rutorrent 2.8, rtorrent and libtorrent are the same versions. Could the multi-user setup have something to do with it?

Cheers!
 

dsouvik215

Member
May 25, 2018
896
0
16
did you try stopping/restarting rtorrent?

whenever you upgrade rutorrent, you need to do this.


also, torrents being stuck in "stopped" or "paused" can be due to permission issues.

I'd need more info to try to figure out what's going on
 

shwetha17

Member
May 24, 2018
785
0
16
Haha, this only gets better: the torrents get saved in random folders! For example, a torrent user1 adds into his watch folder appears in his rutorrent interface, but ends up in user2 torrents folder and gets unpacked into user5 unpack folder!

This is the plugins playing up and getting the users messed up (autotools & unpack), because if I check the individual rtorrent instances, everything is fine within them.

wonslung, I have set up rtorrent + libtorrent & rutorrent + the entire stack via Chef on a brand new Lucid Lynx 64bit. rutorrent is from SVN, it's set up in /var/www/rutorrent. All users have their own folders in /var/www/rutorrent/conf/users/user1 etc. This is the apache config:

Code:
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
ServerAdmin webmaster@localhost
DocumentRoot /var/www

<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>

<Directory /rutorrent>
Options FollowSymLinks
AllowOverride None
</Directory>

<Location /rutorrent>
AuthType Digest
AuthName "Authorized"
AuthDigestDomain /var/www/rutorrent/ http://<%= @node[:ipaddress] %>/rutorrent

AuthDigestProvider file
AuthUserFile /etc/apache2/.passwds
Require valid-user
SetEnv R_ENV "/var/www/rutorrent"
</Location>

ErrorLog /var/log/apache2/error.log

LogLevel warn

CustomLog /var/log/apache2/ssl_access.log combined

SSLEngine on

SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key

<FilesMatch "\.(cgi|html|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>

BrowserMatch "MSIE [2-6]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
# MSIE 7 and newer should be able to use keepalive
BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
</VirtualHost>
</IfModule>

Of course, all SCGI mounts (RPC0, RPC1 etc.) are correct and config.ini is correct for each user. The SCGI mounts are also configured in Apache.

Plugins have been installed from here: http://rutorrent.googlecode.com/files/plugins-3.1.tar.gz.

What I would like to know, is how does rutorrent know which user is logged in? I am asking this, because if I log in with user1, and I check rutorrent settings, I can see that the Autotools plugin is using the following path for finished downloads /home/user2/torrents, but as soon as I try to select a different path, it automatically gets corrected to /home/user1/torrents. Same for the "AutoWatch" feature.

If I go to the Unpack plugin settings (I'm still logged in as user1), I get the following path: /home/user5/unpack.
 

shwetha17

Member
May 24, 2018
785
0
16
Oh yes, and all permissions are correct. All user folders are owned by the respective users, torrents and watch folders within them are 777.

/var/www/rutorrent is owned by www-data.
 

dsouvik215

Member
May 25, 2018
896
0
16
sigh, you've messed up your user configs in rutorrent.

rutorrent knows which user you logged into based on the webauth name you type in.

for instance, if you set webauth on http://some.stupidsite.com/

and you log in as "joe"

rutorrent will use the config located at

rutorrent/conf/users/joe/


if you log in as jessy

rutorrent/conf/user/jessy/


if you failed to set it up properly, it will default to the config at

rutorrent/conf/config.php
 

jith45

Member
May 25, 2018
960
0
16
Quote
What I would like to know, is how does rutorrent know which user is logged in?​

Code:
if(!isset($_SERVER['REMOTE_USER']))
{
if(isset($_SERVER['PHP_AUTH_USER']))
$_SERVER['REMOTE_USER'] = $_SERVER['PHP_AUTH_USER'];
else
if(isset($_SERVER['REDIRECT_REMOTE_USER']))
$_SERVER['REMOTE_USER'] = $_SERVER['REDIRECT_REMOTE_USER'];
}
$userName = (isset($_SERVER['REMOTE_USER']) && !empty($_SERVER['REMOTE_USER'])) ? strtolower($_SERVER['REMOTE_USER']) : '';
 

shwetha17

Member
May 24, 2018
785
0
16
Hmm, it's not as if I'm a developer by craft... shocked.gif Developers are lazy fuckers - and I've spent like 8 hours straight to get that Chef cookbook working -, so mistake assumed.

This was tripping me up:

Code:
function getUser()
{
global $forbidUserSettings;
return( (!$forbidUserSettings && isset($_SERVER['REMOTE_USER']) && !empty($_SERVER['REMOTE_USER'])) ? strtolower($_SERVER['REMOTE_USER']) : '' );
}

I have set forbidUserSettings to true so that users won't override .rtorrent.rc settings, but it didn't work as I imagined. I've set that setting to false for every user and boom, all is good again.

However, now the settings are not picked up automatically in the Autotools & Unpack plugin from .rtorrent.rc. Is there a way to set them in a config?
 

Attachments

jith45

Member
May 25, 2018
960
0
16
i'm not sure which developers you are calling lazy....it's not the rutorrent developers.

users who dont' read the wiki are lazy =)


anyways, glad you got it working


btw, what is "chef cookbook" other than something i use when i'm cooking up a storm in the kitchen?
 

shwetha17

Member
May 24, 2018
785
0
16
No mate, I was hinting that I'm a developer - a lazy fucker - because I didn't bother to grep the source code. You are doing a great job, I honestly admire what you did with rutorrent. Lots of respect & kudos for your hard work!

Chef is basically automating server configurations. You know how people have shell scripts and what not all over the place for configuring & setting up servers? Well, I looked at all those rtorrent & rutorrent scripts and wrote my own cookbook for setting up the whole stack, including users with passwords and SSH keys and all that.

So to configure a box with rutorrent and all dependencies, all I have to do is this:

Code:
knife bootstrap <server.ip> (on the client side - <server.ip> is a brand spanking new box)
chef-client (on the server side)

And that's how everything just comes together smiley.gif. Check this Chef presentation.

I will make the cookbook public and post on the forum for others to benefit from this awesomeness, but for now it's a bit of a hack. It combines everything in a single place while it should be split in multiple cookbooks:
  • rtorrent
  • apache
  • php
  • rutorrent
  • rutorrent-users
Thanks again, all is swanky!
 

Attachments

jith45

Member
May 25, 2018
960
0
16
Quote
No mate, I was hinting that I'm a developer - a lazy fucker - because I didn't bother to grep the source code. You are doing a great job, I honestly admire what you did with rutorrent. Lots of respect & kudos for your hard work!

Chef is basically automating server configurations. You know how people have shell scripts and what not all over the place for configuring & setting up servers? Well, I looked at all those rtorrent & rutorrent scripts and wrote my own cookbook for setting up the whole stack, including users with passwords and SSH keys and all that.

So to configure a box with rutorrent and all dependencies, all I have to do is this:

Code: [Select]
knife bootstrap <server.ip> (on the client side - <server.ip> is a brand spanking new box)
chef-client (on the server side)

And that's how everything just comes together smiley.gif. Check this Chef presentation.

I will make the cookbook public and post on the forum for others to benefit from this awesomeness, but for now it's a bit of a hack. It combines everything in a single place while it should be split in multiple cookbooks:
  • rtorrent
  • apache
  • php
  • rutorrent
  • rutorrent-users
Thanks again, all is swanky!​


ahh, very nice. If there is one thing this project needs, it's more people developing...i get what you were saying now...it's just liek when i get something new, i never read the instructions.....i totally got what you mean now =)

you're a little TOO smart for your own good sometime eh?

lol

I'm a FreeBSD/Solaris person so i rarely get any cool stuff like that, i'm going to read up on it.
 

Attachments

shwetha17

Member
May 24, 2018
785
0
16
Chef works on any platform that can run Ruby. Search github.com for chef-cookbooks, you'll find a lot of good examples (freebsd including).

And yes, you're right, I always over-engineer things and assume stuff which doesn't always help smiley.gif.
 

Attachments

jith45

Member
May 25, 2018
960
0
16
yah, I've been trying to learn ruby lately...it's fascinating.....i have a couple books but i haven't really had time to delve into it.
 

shwetha17

Member
May 24, 2018
785
0
16
You need to start small. Take this for example, a warnquota e-mail replacement:

Code:
#!/usr/bin/env ruby
# gem exec ruby warnquota

require 'yaml'
require 'gmail_sender'

def email(user, usage, subject)
gmail = GmailSender.new(@config['gmail']['username'], @config['gmail']['password'])
gmail.send(
:to => @config['users'][user],
:subject => "~#{user} folder is using #{to_gb(usage)} out of #{to_gb(@config['limits']['soft'])} allowed. #{subject} EOM")
end

def to_gb(kb)
sprintf("%.1f GB", kb / 1024.0 / 1024.0)
end

@config = YAML.load_file(File.dirname(File.expand_path(__FILE__)) + '/config.yml')

@config['users'].each do |user, email|
usage = `du -sk ~#{user}`.gsub(/D/,'').to_i

if usage < @config['limits']['soft']
email(user, usage, "You're cool : ).")
elsif usage > @config['limits']['hard']
email(user, usage, "CLEAN UP NOW!")
elsif usage > @config['limits']['soft']
email(user, usage, "Time to clean up.")
end
end

Next time you need a shell script, try it in Ruby, it's so much more fun!
 

jith45

Member
May 25, 2018
960
0
16
cool, I have my seedbox(es) set up to automove complete torrents to a completed dir, so what i'd like to do is write a program which does the following:

checks for newly "completed" downloads, scp's or rsync's or otherwise copies them to my server, unrares the files, if they are rar'd and sorts the files.


I've done all of this with bash, and it works 99% of the time but this is the type of thing i'll probably attempt to do first.
 

shwetha17

Member
May 24, 2018
785
0
16
Haha, funny enough I need the same thing!

I'm going to put together a more comprehensive app to keep track of all the stuff which me and my crew are downloading, I'm still not sure whether it's going to be Ruby or node.js. I wanted to play with node since last year, this might be a good application for it.
 

jith45

Member
May 25, 2018
960
0
16
well it would be nice.

A client side application could be really nice as well....my scripts all run client side....this way i don't need to leave open ports on my home network.


I used to just rsync my "completed" torrents directory but this led to having to keep a complete set of files in 2-3 places....easy enough but not ideal.
 

shwetha17

Member
May 24, 2018
785
0
16
I currently use symlinks for the stuff that I want to download off the server. It's a bit more manual than I would like it to be, but it only takes a few minutes a day, I don't mind it too much. This worked fine with one computer, but now that I'm pulling data onto 2 clients, it got a bit tedious.

You are absolutely right, a client-side application is the way to go. I wouldn't even unpack stuff on the server (the disks are hit pretty hard as it is), I think that would be best suited for the client side. Having said that, if you have a hybrid setup, downloading stuff onto the SSDs, then moving content onto the HDDs and unpacking + converting (iPhone, iPad etc.) + streaming would be ideal. put.io do something similar, but they're using S3 which is dog slow. The principle is very good though.

One day I'm planning to write all this goodness, but until then, it's just an idea smiley.gif.
 

Attachments

jith45

Member
May 25, 2018
960
0
16
yah, like i said, i have a bourne shell script which works for about 99% of files and works 99% of the time...but i'd like to perfect it.