====== Apache2: Zugriffsschutz Basic ====== In der entsprechenden /etc/apache2/sites-available/.conf Datei müssen im Berech folgende Zeilen hinzugefügt werden: AuthName "Authentifizierung erforderlich" AuthType Basic AuthUserFile berechtigte_User.sec Require valid-user Beispieldatei: # The ServerName directive sets the request scheme, hostname and port that # the server uses to identify itself. This is used when creating # redirection URLs. In the context of virtual hosts, the ServerName # specifies what hostname must appear in the request's Host: header to # match this virtual host. For the default virtual host (this file) this # value is not decisive as it is used as a last resort host regardless. # However, you must set it for any further virtual host explicitly. #ServerName www.example.com ServerName www.meinwebserver.de Serveralias meinwebserver.de ServerAdmin meinemailadresse@gmx.de DocumentRoot /var/www/meinwebserver.de order deny,allow allow from all AuthName "Privater Webserver Authentifizierung erforderlich" AuthType Basic AuthUserFile Eingangskontrolle.list Require valid-user # bestimmte Verzeichnisse über Web nicht ansprechbar machen, soll nur über die Webapp funktionieren Order allow,deny Deny from all Satisfy All # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, # error, crit, alert, emerg. # It is also possible to configure the loglevel for particular # modules, e.g. #LogLevel info ssl:warn ErrorLog ${APACHE_LOG_DIR}/meinserver.de_error.log CustomLog ${APACHE_LOG_DIR}/meinserver.de_access.log combined # For most configuration files from conf-available/, which are # enabled or disabled at a global level, it is possible to # include a line for only one particular virtual host. For example the # following line enables the CGI configuration for this host only # after it has been globally disabled with "a2disconf". #Include conf-available/serve-cgi-bin.conf # vim: syntax=apache ts=4 sw=4 sts=4 sr noet Die Datei berechtigte_User anlegen: Für die Anlage der Datei einmalig mit der Option -c, weitere User ohne Option -c anlegen: htpasswd -c /etc/apache2/berechtigte_user.sec ===== Apache2: Zugriffsschutz über .htaccess ===== Datei im DocumnetenRoot: .htaccess anlegen mit folgenden Inhalt: AuthName "Authentifizierung erforderlich" AuthType Basic AuthUserFile berechtigte_User.sec Require valid-user Für die Anlage der Datei einmalig mit der Option -c, weitere User ohne Option -c anlegen: htpasswd -c /etc/apache2/berechtigte_user.sec ===== Zugriffssteuerung über .htgroup: ===== .htgroup anlegen im DokumentenRoot anlegen: cd /var/www/meinserver.de/htdocs vi .htgroup Inhalt der Datei /var/www/meinwebserver.de/htdocs all:user1,user2 agents:user1 Zum aktivieren die /var/www/meinserver.de/htdocs/.htaccess wie folgt anpassen: #AuthName "Authentifizierung erforderlich" → AuthName "Zugriff nur fuer Agents" AuthType Basic AuthUserFile password.list → AuthGroupFile htdocs/.htgroup → Require group agents #Require valid-user ==== Apache2 Zugriff für bestimmte IPs, Netze oder Domain-Mitglieder ===== Hier zu in der Datei etc/apache2/sites-available/.conf folgende Einträge setzen: ... Allow from beispiel.com Allow from 192.168 Allow 192.168.0.0/16 Allow 192.168.0.0/255.255.0.0 Allow from 2001:6F8:1D2D::/48 ...