Sunday, May 26, 2013

apache - stop directory browsing

If you are using apache as your web server, then you would notice that if you type localhost/ in your browser and you fill find the directory listing of your web directory. To stop directory browsing, that is when you type localhost/ in your browse, it redirects to the localhost folder that is the www folder of your server, which will allow everyone to see all the contents of you www directory. To acheive this, just open the httpd.conf file from apache's directory, and find the line,

options indexes followsymlinks

In the above line remove the indexes. This i have tested with wamp server.

Ldap authentication with wamp, php in windows


// using ldap bind$ldaprdn  'uname';     // ldap rdn or dn$ldappass 'password';  // associated password

// connect to ldap server
$ldapconn ldap_connect("ldap.example.com")
    or die(
"Could not connect to LDAP server.");

if (
$ldapconn) {

    
// binding to ldap server
    
$ldapbind ldap_bind($ldapconn$ldaprdn$ldappass);

    
// verify binding
    
if ($ldapbind) {
        echo 
"LDAP bind successful...";
    } else {
        echo 
"LDAP bind failed...";
    }

}

?>

to make this code, work check if your ldap is in fine condition and users are enabled to log in  with the ADS username and password. This can be checked by going to the ADS, service, right click the user and go to properties, in that select the logon tab, and check if he is valid to log in the computer.