Backuppc fuer die Verwendung von LDAP + Kerberos/GSSAPI konfigurieren
You would like to show your appreciation for our help . Gladly. 🙏 We thank you for your donation!
In-house Apt-Repo: https://apt.iteas.at
GITLAB:
BackupPC mit LDAP Authentifizierung only
Verwendetes System: Ubuntu 24.04
Voraussetzungen:
- BackupPC wurde auf 24.04 mit APT installiert
- Ein LDAP Server zur Authentifizierung ist im Netzwerk vorhanden, als Backend in meine Beispiel wird Univention UCS verwendet
- Die Kommunikation zum BackupPC Webinterface erfolgt mit Apache2 über HTTPS über ein gültiges Zertifikat
Bei der Installation von BackupPC wird auch bereits Apache mit installiert. Und bis auf die HTTPS Anbindung ist das Gespann grundsätzlich mal einsatzfähig. Für den BackupPC selbst wird kein vHost im klassischen Sinne erstellt sondern lediglich eine Config:
ls -l /etc/apache2/conf-enabled/backuppc.conf lrwxrwxrwx 1 root root 31 Dec 21 22:26 /etc/apache2/conf-enabled/backuppc.conf -> ../conf-available/backuppc.conf
Installation
Um die LDAP Authentifizierung zu ermöglichen installieren wir das dafür vorgesehene Apachemodul nach:
apt install libapache-authznetldap-perl
Die Module in Apache aktivieren:
a2enmod ldap a2enmod authnz_ldap
Konfiguration
In der Konfigfile von backuppc können nun LDAPgruppen und Benutzer für die Administration eingetragen werden. Wir reden hier ausschließlich von Administratoren. Normale Benutzer werden direkt im Webinterface von BackupPC den enzelnen Host zugeordnert.
nano /etc/backuppc/config.pl
$Conf{CgiAdminUserGroup} = 'backuppc andere_admingruppe'; $Conf{CgiAdminUsers} = 'backuppc user1 user2';
Jetzt noch LDAP in der Apacheconfig von Backuppc festlegen.
nano /etc/apache2/conf-enabled/backuppc.conf
Alias /backuppc /usr/share/backuppc/cgi-bin/ <Directory /usr/share/backuppc/cgi-bin/> <IfModule !authz_core_module> Order deny,allow Deny from all Allow from 127.0.0.1 Require valid-user </IfModule> <IfModule authz_core_module> <RequireAll> Require valid-user </RequireAll> </IfModule> AuthType Basic AuthName "BackupPC Enterprise Login" AuthBasicProvider ldap AuthLDAPURL "ldaps://dc1.tux.lan:7636/dc=tux,dc=lan?uid?sub?(objectClass=posixAccount)" AuthLDAPGroupAttribute memberUid AuthLDAPGroupAttributeIsDN off AuthLDAPBindDN "uid=ldapreader,cn=users,dc=tux,dc=lan" AuthLDAPBindPassword "secret" Require ldap-group cn=backuppc-admin,cn=tux-admingroups,cn=groups,dc=tux,dc=lan Options ExecCGI FollowSymlinks AddHandler cgi-script .cgi DirectoryIndex index.cgi </Directory>
Nach einem Neustart von Apache2 systemctl restart apache2.service
ist ab sofort nur mehr der LDPA Login verfügbar.
BackupPC mit LDAP Authentifizierung + Kerberos/GSSAPI
Der Zusatz mit GSSAPI hat den Vorteil das im Webbrowser mit dem Kerberos Loginticket automatische authentifiziert wird. Hierfür muss der Webbrowser die Anfrage aber auch verstehen.
Verwendetes System: Ubuntu 24.04
Voraussetzungen:
- Der obige Teil wurde erfolgreich durchlaufen und funktioniert
- Eine Keytab für Apache2 wurde von UCS/LDAP exportiert und auf dem BackupPC Server kopiert
Installation
Um die Kerberos/GSSAPI Authentifizierung zu ermöglichen installieren wir das dafür vorgesehene Apachemodul nach:
apt install libapache2-mod-auth-gssapi
Das Modul ist danach bereits aktiviert und einsatzbereit.
Konfiguration
Jetzt aktivieren nun unseren zusätzlichen Layer GSSAPI in der Apacheconfig von Backuppc. Dabei wird „AuthType Basic“ auskommentiert.
nano /etc/apache2/conf-enabled/backuppc.conf
Alias /backuppc /usr/share/backuppc/cgi-bin/ <Directory /usr/share/backuppc/cgi-bin/> <IfModule !authz_core_module> Order deny,allow Deny from all Allow from 127.0.0.1 Require valid-user </IfModule> <IfModule authz_core_module> <RequireAll> Require valid-user </RequireAll> </IfModule> AuthType GSSAPI require valid-user GssapiBasicAuth On GssapiLocalName On GssapiCredStore keytab:/etc/apache2/backuppc-http-apache.keytab GssapiAcceptorName HTTP GssapiBasicAuth On GssapiNegotiateOnce On GssapiSSLonly On GssapiAllowedMech krb5 GssapiBasicAuthMech krb5 GssapiUseSessions On GssapiConnectionBound On GssapiSignalPersistentAuth On #AuthType Basic AuthName "BackupPC Enterprise Login" AuthBasicProvider ldap AuthLDAPURL "ldaps://dc1.tux.lan:7636/dc=tux,dc=lan?uid?sub?(objectClass=posixAccount)" AuthLDAPGroupAttribute memberUid AuthLDAPGroupAttributeIsDN off AuthLDAPBindDN "uid=ldapreader,cn=users,dc=tux,dc=lan" AuthLDAPBindPassword "secret" Require ldap-group cn=backuppc-admin,cn=tux-admingroups,cn=groups,dc=tux,dc=lan Options ExecCGI FollowSymlinks AddHandler cgi-script .cgi DirectoryIndex index.cgi </Directory>
Die Keytab befindet sich in meine Beispiel unter /etc/apache2/backuppc-http-apache.keytab
. Ausschlaggebend für die korrekte Funktion sind auch die Berechtigungen. Die Keytab muss von dem Apache Webserver gelesen werden können:
chown www-data /etc/apache2/backuppc-http-apache.keytab chmod 400 /etc/apache2/backuppc-http-apache.keytab
Am Ende die beiden Services noch durchstarten, und schon läuft die Authentifizierung zusätzlich über GSSAPI.
Alte Kerberos Config für Apache (zu Dokuzwecken)
AuthType Kerberos AuthName "BackupPC Enterprise Login" AuthName "Network Login" KrbMethodNegotiate On KrbMethodK5Passwd On KrbAuthRealms TUX.LAN Krb5KeyTab /etc/apache2/backuppc-http-apache.keytab KrbLocalUserMapping On