Restrict access to your website to departemental LDAP-accounts

  • These instructions are for websites hosted on apache 2.4+ webservers like tigris/arachne (e.g. people.cs.kuleuven.be, ...). More information can be found on the apache mod_authnz_ldap documentation page
  • Always use https. Passwords are sent as clear text over the network.
  • Create a .htaccess file in the web-folder you wish to protect.
  • This will allow anyone with a valid departemental ldap-account.
    AuthName "Dept CS LDAP"
    AuthType Basic
    AuthBasicProvider ldap
    AuthLDAPUrl "ldap://cs-ldap.cs.kuleuven.be/ou=People,dc=cs,dc=kuleuven,dc=be"
    Require valid-user
    
  • This will allow users who are members of group cs-staff or group deptbeh.
    AuthName "Dept CS LDAP"
    AuthType Basic
    AuthBasicProvider ldap
    AuthLDAPUrl "ldap://cs-ldap.cs.kuleuven.be/ou=People,dc=cs,dc=kuleuven,dc=be"
    require ldap-group cn=cs-staff,ou=Groupmemberof,dc=cs,dc=kuleuven,dc=be
    require ldap-group cn=deptbeh,ou=Groupmemberof,dc=cs,dc=kuleuven,dc=be
    
  • This will allow members of group cs-staff or deptbeh, who are not a member of group feestcomite.
    AuthName "Dept CS LDAP"
    AuthType Basic
    AuthBasicProvider ldap
    AuthLDAPUrl "ldap://cs-ldap.cs.kuleuven.be/ou=People,dc=cs,dc=kuleuven,dc=be"
    <RequireAll>
    	<RequireAny>
    		Require ldap-group cn=cs-staff,ou=Groupmemberof,dc=cs,dc=kuleuven,dc=be
    		Require ldap-group cn=deptbeh,ou=Groupmemberof,dc=cs,dc=kuleuven,dc=be
    	</RequireAny>
    	<RequireNone>
    		Require ldap-group cn=feestcomite,ou=Groupmemberof,dc=cs,dc=kuleuven,dc=be
    	</RequireNone>
    </RequireAll>
    
  • This will allow anyone in mail-alias numa@cs.kuleuven.be. Note: this only works for direct members of the alias, not for nested mail aliases like deptcs.kuleuven.
    AuthName "Dept CS LDAP"
    AuthType Basic
    AuthBasicProvider ldap
    AuthLDAPUrl "ldap://cs-ldap.cs.kuleuven.be/ou=People,dc=cs,dc=kuleuven,dc=be"
    AuthLDAPGroupAttribute sendmailMTAAliasValue
    AuthLDAPGroupAttributeIsDN off
    Require ldap-group sendmailMTAKey=numa,ou=Aliases,dc=cs,dc=kuleuven,dc=be