Gossamer Forum
Home : Products : Links 2.0 : Customization :

Re: Password Protecting THe Admin Dir Is Here!!

Quote Reply
Re: Password Protecting THe Admin Dir Is Here!! In reply to
Protecting your admin directory with a script like that leaves many security problems. Calling admin.cgi with a parameter is one, and also none of your data files are protected. Though I can't necessarily modify things, I can use nph-build.cgi, I can also view your links database, sites awaiting validation, your links.cfg, and even more dangerous the e-mail addresses of the people who submit sites to you. You really have to password-protect the entire admin directory.
If you're installing scripts like Links, you should probably know how to use .htaccess, but if not you can use a script like the one below.

Just call it like makeht.cgi?username/password, but beware, it will overwrite any current .htaccess, .htpasswd files in that directory. Sorry, this is a long post Wink.

makeht.cgi:
#!/usr/bin/perl
print "Content-type:text/html\n\n";
eval '$home = (getpwuid($< ))[7];';
if (!-e "C:/") {
$pwd = `pwd`; chop $pwd;
}
if (!eval 'use Cwd;') {
eval '$cwd = cwd();';
} else {
$cwd = "";
}
($uname, $pword) = split(/\//,$ENV{'QUERY_STRING'});
if ($pwd eq "") {
$dirname = $cwd;
} else {
$dirname = $pwd;
}
if ($dirname eq "") {
&dienice("Error determining directory");
}
if ($uname eq "") {
&dienice("Error determining username");
}
if ($pword eq "") {
&dienice("Error determining password");
}
$cpass = crypt ($pword ,"Cd");
open (HTACC,">.htaccess") or &dienice("Error opening htaccess");
print HTACC qq~AuthName Links Admin
AuthType Basic
AuthUserFile $dirname/.htpasswd
require valid-user
~;
close(HTACC);
open (HTPWD,">.htpasswd") or &dienice("Error opening htpasswd");
print HTPWD "$uname:$cpass\n";
close(HTPWD);
print "Complete. Username: $uname Password: $pword Encrypted Password: $cpass";
sub dienice {
($msg) = @_;
print "<h2>Error</h2>\n";
print $msg;
exit;
}
Subject Author Views Date
Thread Password Protecting THe Admin Dir Is Here!! Joey Bost 9331 Dec 24, 1998, 8:05 PM
Post Re: Password Protecting THe Admin Dir Is Here!!
Joey Bost 9249 Dec 24, 1998, 8:29 PM
Post Re: Password Protecting THe Admin Dir Is Here!!
jmurphy 9241 Dec 25, 1998, 4:00 AM
Post Re: Password Protecting THe Admin Dir Is Here!!
bcurnow 9254 Dec 25, 1998, 4:59 AM
Post Re: Password Protecting THe Admin Dir Is Here!!
jmurphy 9262 Dec 25, 1998, 5:18 AM
Post Re: Password Protecting THe Admin Dir Is Here!!
Joey Bost 9236 Dec 25, 1998, 5:43 AM
Post Re: Password Protecting THe Admin Dir Is Here!!
Joey Bost 9255 Dec 25, 1998, 10:43 AM
Post Re: Password Protecting THe Admin Dir Is Here!!
Alex 9251 Dec 25, 1998, 11:55 AM
Post Re: Password Protecting THe Admin Dir Is Here!!
Joey Bost 9241 Dec 25, 1998, 12:01 PM
Post Re: Password Protecting THe Admin Dir Is Here!!
jmurphy 9328 Dec 26, 1998, 6:32 AM
Post Re: Password Protecting THe Admin Dir Is Here!!
elvii 9235 Dec 26, 1998, 11:25 AM
Post Re: Password Protecting THe Admin Dir Is Here!!
Joey Bost 9259 Dec 26, 1998, 11:34 AM
Post Re: Password Protecting THe Admin Dir Is Here!!
elvii 9253 Dec 26, 1998, 3:28 PM
Post Re: Password Protecting THe Admin Dir Is Here!!
Joey Bost 9236 Dec 26, 1998, 3:46 PM
Post Re: Password Protecting THe Admin Dir Is Here!!
toughpick 9223 Dec 30, 1998, 9:53 PM
Post Re: Password Protecting THe Admin Dir Is Here!!
elvii 9245 Dec 31, 1998, 3:45 PM
Post Re: Password Protecting THe Admin Dir Is Here!!
Shlomoh 9232 Dec 31, 1998, 4:28 PM
Post Re: Password Protecting THe Admin Dir Is Here!!
toughpick 9256 Dec 31, 1998, 8:57 PM
Post Re: Password Protecting THe Admin Dir Is Here!!
toughpick 9231 Dec 31, 1998, 9:25 PM
Post Re: Password Protecting THe Admin Dir Is Here!!
toughpick 9255 Dec 31, 1998, 9:58 PM
Post Re: Password Protecting THe Admin Dir Is Here!!
zelph 9266 Jan 1, 1999, 5:56 AM
Post Re: Password Protecting THe Admin Dir Is Here!!
Joey Bost 9253 Jan 1, 1999, 9:02 AM
Post Re: Password Protecting THe Admin Dir Is Here!!
Stefan 9261 Jan 5, 1999, 9:30 PM
Post Re: Password Protecting THe Admin Dir Is Here!!
Bobsie 9267 Jan 5, 1999, 9:53 PM
Post Re: Password Protecting THe Admin Dir Is Here!!
elvii 9223 Jan 6, 1999, 4:22 PM
Post Re: Password Protecting THe Admin Dir Is Here!!
Joey Bost 1377 Jan 11, 1999, 9:53 AM