Search the web
Sign In
New User? Sign Up
dansguardian · A public mailing list to discuss all aspects of DansGuardian
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
FTP credential seem to get stripped off between dansguardian and squ   Message List  
Reply | Forward Message #23013 of 23408 |
Re: (Bug?)FTP credential seem to get stripped off between dansguardian and squid

If anyone is interested I updated the workaround ftp credential patch for
2.10.1.1. The previous one bombed on urls with email addresses in them. This
one will probably bomb someplace else :)

7/9/2009 ftp patch:

--- /root/dans-bak/src/HTTPHeader.cpp 2009-06-13 14:10:15.000000000 -0500
+++ /root/dansguardian-2.10.1.1/src/HTTPHeader.cpp 2009-07-09 17:29:16.000000000
-0500
@@ -402,7 +402,7 @@
// modifies the URL in all relevant header lines after a regexp search and
replace
// setURL Code originally from from Ton Gorter 2004
void HTTPHeader::setURL(String &url) {
- String hostname;
+ String hostname,credentials;
bool https = (url.before("://") == "https");
int port = (https ? 443 : 80);

@@ -420,12 +420,18 @@
}
hostname = hostname.before(":"); // chop off the port bit
}
+ //Restore stripped credentials
+ credentials="";
+ if (header.front().after("://").before(hostname.toCharArray()).contains("@"))
{ // Contains a username:password combo
+ credentials = header.front().after("://").before(hostname.toCharArray());
+ }
+

#ifdef DGDEBUG
std::cout << "setURL: header.front() changed from: " << header.front() <<
std::endl;
#endif
if (!https)
- header.front() = header.front().before(" ") + " " + url + " " +
header.front().after(" ").after(" ");
+ header.front() = header.front().before(" ") + " " + url.before("://") + "://"
+ credentials + url.after("://") + " " + header.front().after(" ").after(" ");
else
// Should take form of "CONNECT example.com:443 HTTP/1.0" for SSL
header.front() = header.front().before(" ") + " " + hostname + ":" +
String(port) + " " + header.front().after(" ").after(" ");



--- In dansguardian@yahoogroups.com, "brentwilliams" <brentwilliams@...> wrote:
>
> Thanks to some helpful insight from Chuck Kollars here's what I have so far.
This pertains to dansguardian-2.10.1.1.
>
> In HTTPHeader.cpp, checkheader seems to be calling seturl more frequently than
in the previous version. It looks like it now calls it for all outgoing while
previously it only did for a url that ended in a dot (so the credentials being
stripped would be less noticeable).
>
> I did a stock compile of dansguardian-2.10.1.1 with debug on using both the
current HTTPHeader and the previous HTTPHeader and could see that user:pass@ is
stripped from ftp://user:pass@... in the latest version by seturl.
>
> Below is a demonstrative workaround/patch for HTTPHeader (remember I said
demonstrative - it worked on the three sites I checked :). I am not using this
workaround in production yet.
>
> I am leaning toward this being a bug. Does anyone else see this problem?
Does anyone see potential pitfalls to the workaround below?
>
> Thanks!
>
> --- /root/dans-bak/src/HTTPHeader.cpp 2009-06-13 14:10:15.000000000 -0500
> +++ HTTPHeader.cpp 2009-06-13 21:03:21.000000000 -0500
> @@ -402,7 +402,7 @@
> // modifies the URL in all relevant header lines after a regexp search and
replace
> // setURL Code originally from from Ton Gorter 2004
> void HTTPHeader::setURL(String &url) {
> - String hostname;
> + String hostname,credentials;
> bool https = (url.before("://") == "https");
> int port = (https ? 443 : 80);
>
> @@ -420,12 +420,17 @@
> }
> hostname = hostname.before(":"); // chop off the port bit
> }
> + // Save user:pass
> + credentials="";
> + if (header.front().contains("@")) {
> + credentials = header.front().after("://").before("@")+"@";
> + }
>
> #ifdef DGDEBUG
> std::cout << "setURL: header.front() changed from: " << header.front() <<
std::endl;
> #endif
> if (!https)
> - header.front() = header.front().before(" ") + " " + url + " " +
header.front().after(" ").after(" ");
> + header.front() = header.front().before(" ") + " " + url.before("://") +
"://" + credentials + url.after("://") + " " + header.front().after(" ").after("
");
> else
> // Should take form of "CONNECT example.com:443 HTTP/1.0" for SSL
> header.front() = header.front().before(" ") + " " + hostname + ":" +
String(port) + " " + header.front().after(" ").after(" ");
>
>
>
> --- In dansguardian@yahoogroups.com, "brentwilliams" <brentwilliams@> wrote:
> >
> > Additional info: this is on single homed CentOS 5.3 system non-transparent
setup
> >
> > --- In dansguardian@yahoogroups.com, "brentwilliams" <brentwilliams@> wrote:
> > >
> > > I had just recently been using dansguardian 2.10.1.1 and encountered a
problem where ftp urls in this form ftp://user:pass@ were showing the squid
can't login in error page (it shows user anonymous in the error) . I use dans
and squid on the same box and when I packet captured 127.0.0.1 it looks like
dans is stripping out the user:pass. I rolled back to 2.10.0.3 and do not have
the error. Exact same configs for both versions. Am I missing something or is
this a possible bug?
> > >
> > > Thanks!
> > >
> >
>





Thu Jul 9, 2009 10:51 pm

brentwilliams
Offline Offline
Send Email Send Email

Forward
Message #23013 of 23408 |
Expand Messages Author Sort by Date

I had just recently been using dansguardian 2.10.1.1 and encountered a problem where ftp urls in this form ftp://user:pass@... were showing the...
brentwilliams
Offline Send Email
Jun 12, 2009
2:59 pm

Additional info: this is on single homed CentOS 5.3 system non-transparent setup...
brentwilliams
Offline Send Email
Jun 12, 2009
3:18 pm

Thanks to some helpful insight from Chuck Kollars here's what I have so far. This pertains to dansguardian-2.10.1.1. In HTTPHeader.cpp, checkheader seems to...
brentwilliams
Offline Send Email
Jun 15, 2009
12:10 pm

If anyone is interested I updated the workaround ftp credential patch for 2.10.1.1. The previous one bombed on urls with email addresses in them. This one...
brentwilliams
Offline Send Email
Jul 9, 2009
10:51 pm

... Thanks for finding this out & fiddling with the source code. I did a quick test and it works for me. Sebastian...
deepbassnine
Offline Send Email
Jul 10, 2009
5:48 pm

... This is correct, yes. This was done as part of a move towards "normalising" HTTP requests before trying to extract any useful data from them, to help...
Philip Allison
phil.smoothwall
Offline Send Email
Aug 18, 2009
2:02 pm

... No, there is no prompting. Squid will then think it's an anonymous ftp login and report an error when the login doesn't work. ... I agree that encoding...
brentwilliams
Offline Send Email
Aug 19, 2009
5:57 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help