Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
centos:squid:auth [14.11.2011 16:33. ] – [Bind mit technischem User] django | centos:squid:auth [20.04.2018 10:35. ] (aktuell) – Externe Bearbeitung 127.0.0.1 | ||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
+ | ====== Userauthentifizierung am Squid-Proxy-Servers ====== | ||
+ | {{: | ||
+ | |||
+ | In diesem Kapitel werden wir uns eingehender mit der Benutzerathentifizierung bei bei unserem [[http:// | ||
+ | |||
+ | ===== Authentifizierung mit NCSA-AUTH ===== | ||
+ | In unserem Netzwerk soll sich jeder Benutzer an jedem Rechner anmelden und so eine Verbindung zum Internet aufbauen können. Hierzu | ||
+ | <WRAP round important> | ||
+ | </ | ||
+ | ==== Überprüfung des Authentification-Helper ==== | ||
+ | Zu erst überprüfen wir, ob der entsprechende Authentification-Helper vorhanden und installiert ist. | ||
+ | # rpm -ql squid | grep ncsa_auth | ||
+ | |||
+ | / | ||
+ | / | ||
+ | |||
+ | ==== Generierung des Passwortfiles ==== | ||
+ | Die Generierung des bnötigten Passwort-Files werden wir mit Hilfe des Programmes **htpasswd** aus dem RPM-Paket **httpd-tools** vornehmen. | ||
+ | |||
+ | Für den Fall, dass das betrffende RPM-Paket im System noch nicht installiert wurde, werden wir dies eben dieses mit Hilfe von **yum** nachholen. | ||
+ | # yum install httpd-tools -y | ||
+ | |||
+ | Anschließend legen wir uns ein entsprechendes Passwortfile (mit dem User bigchief) an: | ||
+ | # htpasswd -c / | ||
+ | |||
+ | New password: | ||
+ | | ||
+ | | ||
+ | |||
+ | Die Option **-c** verwenden wir, da das File noch nicht existiert und wir eine entsprechende Datei anlegen wollen. Alle weiteren User werden dann mit Hilfe des folgenden Befehls an die Datei angefügt. | ||
+ | # htpasswd / | ||
+ | |||
+ | New password: | ||
+ | | ||
+ | | ||
+ | |||
+ | In der Datei // | ||
+ | # cat / | ||
+ | |||
+ | | ||
+ | | ||
+ | |||
+ | ==== Konfiguration / | ||
+ | Unsere zentrale Konfigurationsdatei ergänzen wir dann entsprechend für unsere NCSA-Benutzerauthentifizierung. | ||
+ | # vim / | ||
+ | <file bash / | ||
+ | # Django : 2011-11-14 NCSA-Benutzerauthentifizierung | ||
+ | auth_param basic program / | ||
+ | auth_param basic children 4 | ||
+ | auth_param basic utf8 on | ||
+ | auth_param basic realm Bitte geben Sie Ihren Benutzernamen und Passwort fuer die Internetberechtigung ein! | ||
+ | auth_param basic credentialsttl 60 minutes | ||
+ | auth_param basic casesensitive off | ||
+ | |||
+ | # | ||
+ | # Recommended minimum configuration: | ||
+ | # | ||
+ | acl manager proto cache_object | ||
+ | acl localhost src 127.0.0.1/ | ||
+ | # Django : 2011-11-14 IPv6 deaktiviert | ||
+ | # acl localhost src ::1/128 | ||
+ | acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 | ||
+ | # Django : 2011-11-14 IPv6 deaktiviert | ||
+ | # acl to_localhost dst ::1/128 | ||
+ | |||
+ | # Example rule allowing access from your local networks. | ||
+ | # Adapt to list your (internal) IP networks from where browsing | ||
+ | # should be allowed | ||
+ | # Django : 2011-11-14 Definition des/der eigenen Netzwerke | ||
+ | # acl localnet src 10.0.0.0/ | ||
+ | # acl localnet src 172.16.0.0/ | ||
+ | # acl localnet src 192.168.0.0/ | ||
+ | # acl localnet src fc00::/ | ||
+ | # acl localnet src fe80::/ | ||
+ | acl localnet src 10.0.0.0/24 | ||
+ | acl localnet src 10.0.10.0/ | ||
+ | |||
+ | # Django : 2011-11-14 NCSA-Benutzerauthentifizierung | ||
+ | acl ncsa_users proxy_auth REQUIRED | ||
+ | |||
+ | acl SSL_ports port 443 | ||
+ | acl Safe_ports port 80 # http | ||
+ | acl Safe_ports port 21 # ftp | ||
+ | acl Safe_ports port 443 # https | ||
+ | acl Safe_ports port 70 # gopher | ||
+ | acl Safe_ports port 210 # wais | ||
+ | acl Safe_ports port 1025-65535 | ||
+ | acl Safe_ports port 280 # http-mgmt | ||
+ | acl Safe_ports port 488 # gss-http | ||
+ | acl Safe_ports port 591 # filemaker | ||
+ | acl Safe_ports port 777 # multiling http | ||
+ | acl CONNECT method CONNECT | ||
+ | |||
+ | # | ||
+ | # Recommended minimum Access Permission configuration: | ||
+ | # | ||
+ | # Only allow cachemgr access from localhost | ||
+ | http_access allow manager localhost | ||
+ | http_access deny manager | ||
+ | |||
+ | # Deny requests to certain unsafe ports | ||
+ | http_access deny !Safe_ports | ||
+ | |||
+ | # Deny CONNECT to other than secure SSL ports | ||
+ | http_access deny CONNECT !SSL_ports | ||
+ | |||
+ | # We strongly recommend the following be uncommented to protect innocent | ||
+ | # web applications running on the proxy server who think the only | ||
+ | # one who can access services on " | ||
+ | # | ||
+ | |||
+ | # | ||
+ | # INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS | ||
+ | # | ||
+ | |||
+ | # Example rule allowing access from your local networks. | ||
+ | # Adapt localnet in the ACL section to list your (internal) IP networks | ||
+ | # from where browsing should be allowed | ||
+ | # Django : 2011-11-14 Zugriffsregeln für die NCSA-Benutzerauthentifizierung | ||
+ | # default: | ||
+ | # http_access allow localnet | ||
+ | # http_access allow localhost | ||
+ | http_access allow localhost ncsa_users | ||
+ | http_access allow localnet ncsa_users | ||
+ | |||
+ | # And finally deny all other access to this proxy | ||
+ | http_access deny all | ||
+ | |||
+ | # Squid normally listens to port 3128 | ||
+ | http_port 3128 | ||
+ | |||
+ | # We recommend you to use at least the following line. | ||
+ | hierarchy_stoplist cgi-bin ? | ||
+ | |||
+ | # Uncomment and adjust the following to add a disk cache directory. | ||
+ | #cache_dir ufs / | ||
+ | # Django 2011-11-14 : Squid Cache aktiviert | ||
+ | cache_dir ufs / | ||
+ | |||
+ | # Leave coredumps in the first cache dir | ||
+ | coredump_dir / | ||
+ | |||
+ | # Add any of your own refresh_pattern entries above these. | ||
+ | refresh_pattern ^ftp: | ||
+ | refresh_pattern ^gopher: | ||
+ | refresh_pattern -i (/ | ||
+ | refresh_pattern . | ||
+ | |||
+ | # Django : 2011-11-14 Definition des Squid-Logformates | ||
+ | logformat squid %tl.%03tu %6tr %>a %un %Ss/ | ||
+ | </ | ||
+ | Anschließend starten wir unseren Proxy-Server einmal durch. | ||
+ | # service squid restart | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | ==== Konfigurationstest am Client ==== | ||
+ | Rufen wir nun an einem der Clients eine Seite im Internet auf, werden wir nach dem Benutzernamen und dem zugehörigen Passwort gefragt. | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | Im Accesslog unseres Squid-Proxyservers wird dieser Zugriff nun entsprechend protokolliert. | ||
+ | # less / | ||
+ | < | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | ... | ||
+ | </ | ||
+ | |||
+ | ===== Authentifizierung mit LDAP-AUTH (anonymous bind) ===== | ||
+ | Im Gegensatz zum vorigen Beispiel machen wir es uns doch wesentlich leichter, wenn wir die Benutzerauthentifizierung gegen unseren zentralen LDAP-Servewr laufen lassen. Die Anwender müssen sich nicht noch eine Zugangskennung extra merken. Und auf Seiten der Administration haben wir es auch noch einfacherer uns sicherer, dsa keine gesonderte Passwortdatei gepflegt werden muss. | ||
+ | |||
+ | ==== anonymous bind ==== | ||
+ | Im folgenden Beispiel befassen wir uns kurz mit der Möglichkeit, | ||
+ | |||
+ | Die Konfigurationsdatei unseres Squid-servers passen wir nun wie folgt an. | ||
+ | # vim / | ||
+ | <file bash / | ||
+ | # Django : 2011-11-14 LDAP-Benutzerauthentifizierung | ||
+ | auth_param basic program / | ||
+ | auth_param basic children 4 | ||
+ | auth_param basic utf8 on | ||
+ | auth_param basic realm Bitte geben Sie Ihren Benutzernamen und Passwort fuer die Internetberechtigung ein! | ||
+ | auth_param basic credentialsttl 60 minutes | ||
+ | auth_param basic casesensitive off | ||
+ | |||
+ | # | ||
+ | # Recommended minimum configuration: | ||
+ | # | ||
+ | acl manager proto cache_object | ||
+ | acl localhost src 127.0.0.1/ | ||
+ | # Django : 2011-11-14 IPv6 deaktiviert | ||
+ | # acl localhost src ::1/128 | ||
+ | acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 | ||
+ | # Django : 2011-11-14 IPv6 deaktiviert | ||
+ | # acl to_localhost dst ::1/128 | ||
+ | |||
+ | # Example rule allowing access from your local networks. | ||
+ | # Adapt to list your (internal) IP networks from where browsing | ||
+ | # should be allowed | ||
+ | # Django : 2011-11-14 Definition des/der eigenen Netzwerke | ||
+ | # acl localnet src 10.0.0.0/ | ||
+ | # acl localnet src 172.16.0.0/ | ||
+ | # acl localnet src 192.168.0.0/ | ||
+ | # acl localnet src fc00::/ | ||
+ | # acl localnet src fe80::/ | ||
+ | acl localnet src 10.0.0.0/24 | ||
+ | acl localnet src 10.0.10.0/ | ||
+ | |||
+ | # Django : 2011-11-14 LDAP-Benutzerauthentifizierung | ||
+ | acl ldap_auth proxy_auth REQUIRED | ||
+ | |||
+ | acl SSL_ports port 443 | ||
+ | acl Safe_ports port 80 # http | ||
+ | acl Safe_ports port 21 # ftp | ||
+ | acl Safe_ports port 443 # https | ||
+ | acl Safe_ports port 70 # gopher | ||
+ | acl Safe_ports port 210 # wais | ||
+ | acl Safe_ports port 1025-65535 | ||
+ | acl Safe_ports port 280 # http-mgmt | ||
+ | acl Safe_ports port 488 # gss-http | ||
+ | acl Safe_ports port 591 # filemaker | ||
+ | acl Safe_ports port 777 # multiling http | ||
+ | acl CONNECT method CONNECT | ||
+ | |||
+ | # | ||
+ | # Recommended minimum Access Permission configuration: | ||
+ | # | ||
+ | # Only allow cachemgr access from localhost | ||
+ | http_access allow manager localhost | ||
+ | http_access deny manager | ||
+ | |||
+ | # Deny requests to certain unsafe ports | ||
+ | http_access deny !Safe_ports | ||
+ | |||
+ | # Deny CONNECT to other than secure SSL ports | ||
+ | http_access deny CONNECT !SSL_ports | ||
+ | |||
+ | # We strongly recommend the following be uncommented to protect innocent | ||
+ | # web applications running on the proxy server who think the only | ||
+ | # one who can access services on " | ||
+ | # | ||
+ | |||
+ | # | ||
+ | # INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS | ||
+ | # | ||
+ | |||
+ | # Example rule allowing access from your local networks. | ||
+ | # Adapt localnet in the ACL section to list your (internal) IP networks | ||
+ | # from where browsing should be allowed | ||
+ | # Django : 2011-11-14 Zugriffsregeln für die LDAP-Benutzerauthentifizierung | ||
+ | # default: | ||
+ | # http_access allow localnet | ||
+ | # http_access allow localhost | ||
+ | http_access allow localhost ldap_auth | ||
+ | http_access allow localnet ldap_auth | ||
+ | |||
+ | # And finally deny all other access to this proxy | ||
+ | http_access deny all | ||
+ | |||
+ | # Squid normally listens to port 3128 | ||
+ | http_port 3128 | ||
+ | |||
+ | # We recommend you to use at least the following line. | ||
+ | hierarchy_stoplist cgi-bin ? | ||
+ | |||
+ | # Uncomment and adjust the following to add a disk cache directory. | ||
+ | #cache_dir ufs / | ||
+ | # Django 2011-11-14 : Squid Cache aktiviert | ||
+ | cache_dir ufs / | ||
+ | |||
+ | # Leave coredumps in the first cache dir | ||
+ | coredump_dir / | ||
+ | |||
+ | # Add any of your own refresh_pattern entries above these. | ||
+ | refresh_pattern ^ftp: | ||
+ | refresh_pattern ^gopher: | ||
+ | refresh_pattern -i (/ | ||
+ | refresh_pattern . | ||
+ | |||
+ | # Django : 2011-11-14 Definition des Squid-Logformates | ||
+ | logformat squid %tl.%03tu %6tr %>a %un %Ss/ | ||
+ | </ | ||
+ | # service squid restart | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | ==== Bind mit technischem User ==== | ||
+ | Im folgenden Beispiel befassen wir uns nun mit der Zugriffsmöglichkeit unter Zuhilfenahme eines technischen Benutzers, mit Hilfe dessen die [[centos: | ||
+ | |||
+ | Die Konfigurationsdatei unseres Squid-Servers passen wir nun wie folgt an. | ||
+ | # vim / | ||
+ | <file bash / | ||
+ | # Django : 2011-11-14 LDAP-Benutzerauthentifizierung | ||
+ | auth_param basic program / | ||
+ | auth_param basic children 4 | ||
+ | auth_param basic utf8 on | ||
+ | auth_param basic realm Bitte geben Sie Ihren Benutzernamen und Passwort fuer die Internetberechtigung ein! | ||
+ | auth_param basic credentialsttl 60 minutes | ||
+ | auth_param basic casesensitive off | ||
+ | |||
+ | # | ||
+ | # Recommended minimum configuration: | ||
+ | # | ||
+ | acl manager proto cache_object | ||
+ | acl localhost src 127.0.0.1/ | ||
+ | # Django : 2011-11-14 IPv6 deaktiviert | ||
+ | # acl localhost src ::1/128 | ||
+ | acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 | ||
+ | # Django : 2011-11-14 IPv6 deaktiviert | ||
+ | # acl to_localhost dst ::1/128 | ||
+ | |||
+ | # Example rule allowing access from your local networks. | ||
+ | # Adapt to list your (internal) IP networks from where browsing | ||
+ | # should be allowed | ||
+ | # Django : 2011-11-14 Definition des/der eigenen Netzwerke | ||
+ | # acl localnet src 10.0.0.0/ | ||
+ | # acl localnet src 172.16.0.0/ | ||
+ | # acl localnet src 192.168.0.0/ | ||
+ | # acl localnet src fc00::/ | ||
+ | # acl localnet src fe80::/ | ||
+ | acl localnet src 10.0.0.0/24 | ||
+ | acl localnet src 10.0.10.0/ | ||
+ | |||
+ | # Django : 2011-11-14 LDAP-Benutzerauthentifizierung | ||
+ | acl ldap_auth proxy_auth REQUIRED | ||
+ | |||
+ | acl SSL_ports port 443 | ||
+ | acl Safe_ports port 80 # http | ||
+ | acl Safe_ports port 21 # ftp | ||
+ | acl Safe_ports port 443 # https | ||
+ | acl Safe_ports port 70 # gopher | ||
+ | acl Safe_ports port 210 # wais | ||
+ | acl Safe_ports port 1025-65535 | ||
+ | acl Safe_ports port 280 # http-mgmt | ||
+ | acl Safe_ports port 488 # gss-http | ||
+ | acl Safe_ports port 591 # filemaker | ||
+ | acl Safe_ports port 777 # multiling http | ||
+ | acl CONNECT method CONNECT | ||
+ | |||
+ | # | ||
+ | # Recommended minimum Access Permission configuration: | ||
+ | # | ||
+ | # Only allow cachemgr access from localhost | ||
+ | http_access allow manager localhost | ||
+ | http_access deny manager | ||
+ | |||
+ | # Deny requests to certain unsafe ports | ||
+ | http_access deny !Safe_ports | ||
+ | |||
+ | # Deny CONNECT to other than secure SSL ports | ||
+ | http_access deny CONNECT !SSL_ports | ||
+ | |||
+ | # We strongly recommend the following be uncommented to protect innocent | ||
+ | # web applications running on the proxy server who think the only | ||
+ | # one who can access services on " | ||
+ | # | ||
+ | |||
+ | # | ||
+ | # INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS | ||
+ | # | ||
+ | |||
+ | # Example rule allowing access from your local networks. | ||
+ | # Adapt localnet in the ACL section to list your (internal) IP networks | ||
+ | # from where browsing should be allowed | ||
+ | # Django : 2011-11-14 Zugriffsregeln für die LDAP-Benutzerauthentifizierung | ||
+ | # default: | ||
+ | # http_access allow localnet | ||
+ | # http_access allow localhost | ||
+ | http_access allow localhost ldap_auth | ||
+ | http_access allow localnet ldap_auth | ||
+ | |||
+ | # And finally deny all other access to this proxy | ||
+ | http_access deny all | ||
+ | |||
+ | # Squid normally listens to port 3128 | ||
+ | http_port 3128 | ||
+ | |||
+ | # We recommend you to use at least the following line. | ||
+ | hierarchy_stoplist cgi-bin ? | ||
+ | |||
+ | # Uncomment and adjust the following to add a disk cache directory. | ||
+ | #cache_dir ufs / | ||
+ | # Django 2011-11-14 : Squid Cache aktiviert | ||
+ | cache_dir ufs / | ||
+ | |||
+ | # Leave coredumps in the first cache dir | ||
+ | coredump_dir / | ||
+ | |||
+ | # Add any of your own refresh_pattern entries above these. | ||
+ | refresh_pattern ^ftp: | ||
+ | refresh_pattern ^gopher: | ||
+ | refresh_pattern -i (/ | ||
+ | refresh_pattern . | ||
+ | |||
+ | # Django : 2011-11-14 Definition des Squid-Logformates | ||
+ | logformat squid %tl.%03tu %6tr %>a %un %Ss/ | ||
+ | </ | ||
+ | Das Passwort des technischen Users legen wir dabei in der Datei **ldap_passwd** ab. | ||
+ | # echo " | ||
+ | Anschließend passen wir noch die Dateirechte und die Benutzer- und Gruppen-rechte an. | ||
+ | # chmod 640 / | ||
+ | |||
+ | # chown root:squid / | ||
+ | |||
+ | Zum Aktivieren unserer Konfigurationsänderungen starten wir nun einmal unseren Squid-Proxyserver durch. | ||
+ | # service squid restart | ||
+ | |||
+ | ==== Konfigurationstest am Server ==== | ||
+ | Mit Hilfe des Programms **/ | ||
+ | # / | ||
+ | Anschließende geben wir folgende Werte ein: **User-Name** [Leerzeichen] **Passwort** also z.B. | ||
+ | **django Django-ist-der-volle_Geek!** | ||
+ | | ||
+ | user filter ' | ||
+ | | ||
+ | |||
+ | Im LDAP-Logfile wird der erfolgreiche Test entsprechend quittiert: | ||
+ | # tail -f / | ||
+ | <code bash> | ||
+ | Nov 14 18:26:33 vml000030 slapd[27311]: | ||
+ | Nov 14 18:26:33 vml000030 slapd[27311]: | ||
+ | Nov 14 18:26:33 vml000030 slapd[27311]: | ||
+ | Nov 14 18:26:33 vml000030 slapd[27311]: | ||
+ | Nov 14 18:26:33 vml000030 slapd[27311]: | ||
+ | Nov 14 18:26:33 vml000030 slapd[27311]: | ||
+ | Nov 14 18:26:33 vml000030 slapd[27311]: | ||
+ | Nov 14 18:26:33 vml000030 slapd[27311]: | ||
+ | Nov 14 18:26:33 vml000030 slapd[27311]: | ||
+ | Nov 14 18:26:33 vml000030 slapd[27311]: | ||
+ | Nov 14 18:26:33 vml000030 slapd[27311]: | ||
+ | Nov 14 18:26:33 vml000030 slapd[27311]: | ||
+ | Nov 14 18:26:33 vml000030 slapd[27311]: | ||
+ | </ | ||
+ | ==== Konfigurationstest am Client ==== | ||
+ | Rufen wir nun an einem der Clients eine Seite im Internet auf, werden wir nach dem Benutzernamen und dem zugehörigen Passwort gefragt. | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | Im Accesslog unseres Squid-Proxyservers wird dieser Zugriff nun entsprechend protokolliert. | ||
+ | # less / | ||
+ | < | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | </ | ||
+ | ====== Links ====== | ||
+ | * **[[centos: | ||
+ | * **[[wiki: | ||
+ | * **[[http:// | ||
+ | |||