Page 1 of 1

newznab behind a login page sabnzbd access

Posted: December 21st, 2012, 4:53 pm
by epatrona
I have a Basic Auth login (pop-up) when you attempt to access the site (so as to protect what is behind it). Behind it I have setup sabnzbd and newznab (others), and have the api key set and working, however while newznab can see sabnzbd (via a private IP), when I attempt to transfer a nzb (by using the sab option in newznab), the information is passed into sabnzbd, however sabnzbd can not start the download as it gets hung up on the login (pop-up) if I disable the pop-up it works, but then everything is visible,I've thought of running a second server just as a frontend for sabnzbd, but figured there has to be a better way. Why is it that the URL passed from newznab to sabnzbd is via the logged in URL (and not via the same use as to connection is established), is there any way to have this also communicate using the private IP same as the the API uses to communicate to sabnzbd?
Basically I want a password protected site with all communications between newznab and sabnzbd happening via the private link, so far only the newznab->sabnzbd does this, I need the other way around as well sabnzbd->newznab so that nzb are retrieved.

Thanks,
Erica

Re: newznab behind a login page sabnzbd access

Posted: December 22nd, 2012, 2:51 am
by shypike
You probably haven't used the correct SABnzbd URL in newznab,
although I don't know what newznab expects.
You also need to tell it SABnzbd's api-key.

Re: newznab behind a login page sabnzbd access

Posted: December 22nd, 2012, 7:48 am
by epatrona
Thanks, however I have the communications working as long as there is no site wide login required.

Basically when you access teh site the first thing the you encounter is a login pop-up (which block access to all sites), once through that you have access to newznab and sabnazbd (without logins) This ensures that any attempt to access the server returns a login and nothing else. Now if this inital pop-up is disabled then everything works fine.
However if enabled, then the URL that sabnzbd uses to try to retrieve a nzb uses is the external URL which has this login, however as they are located on teh same server there is also a backend address (localhost), which would require no login. What I'm looking for is a way to get sabnzbd to use the backhanded for all communications.

This is how I force a pop-up in Apache. Added to the www_root directory definition:
AuthType Basic
AuthName "Login Required:"
AuthUserFile /etc/apache2/ssl/logins
AuthGroupFile /etc/apache2/ssl/groups
Require valid-user


Thanks,
Erica

Re: newznab behind a login page sabnzbd access

Posted: December 22nd, 2012, 9:22 am
by shypike
SABnzbd uses whatever URL it is given.
So if you need an alternative URL, you'll have to make newznab send that alternative URL to SABnzbd.

Re: newznab behind a login page sabnzbd access

Posted: December 22nd, 2012, 1:25 pm
by epatrona
Worked it out, I setup a global rewrite rule for the newznab URL to sabnzbd so that it is converted from the external address to the internal address, automatically which results in the request going through.


# This sits outside of the directory as we need to to execute before the auth section
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/newznab/getnzb
RewriteRule /newznab/getnzb/(.*)$ https://10.120.25.62/newznab/getnzb/$1 [L]

So basically get the URL if it is going to newzban/getnzb then rewrite it to use an internal address that does not need a separate login. Hope this helps someone else.


ERICA