Absicherung NFS: Difference between revisions

From
Jump to navigation Jump to search
Line 75: Line 75:


== Ergebnisse ==
== Ergebnisse ==

Successfully initialized wpa_supplicant
enx00e04c680106: Associated with 01:80:c2:00:00:03
enx00e04c680106: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
enx00e04c680106: CTRL-EVENT-EAP-STARTED EAP authentication started
enx00e04c680106: CTRL-EVENT-EAP-PROPOSED-METHOD vendor=0 method=4 -> NAK
enx00e04c680106: CTRL-EVENT-EAP-PROPOSED-METHOD vendor=0 method=13
enx00e04c680106: CTRL-EVENT-EAP-METHOD EAP vendor 0 method 13 (TLS) selected
enx00e04c680106: CTRL-EVENT-EAP-PEER-CERT depth=1 subject='/C=DE/ST=Berlin/L=Berlin/O=Rechnerbetriebsgruppe/emailAddress=admin@rbg.example/CN=Allm\xC3\x83\xC2\xA4chtige Rechnerbetriebgruppe ROOT' hash=e058f4d62841026bda3814acaf39337fb2dc147456d6b45298d0472181b9f059
enx00e04c680106: CTRL-EVENT-EAP-PEER-CERT depth=0 subject='/C=DE/ST=Berlin/O=Rechnerbetriebsgruppe/CN=Allm\xC3\x83\xC2\xA4chtiger RADIUS/emailAddress=admin@rbg.example' hash=bf3be5e22ed92568dc215ada7a2e2babe8da4c9fb6fbf278f485669ad1161097 tod=2
enx00e04c680106: CTRL-EVENT-EAP-SUCCESS EAP authentication completed successfully
enx00e04c680106: CTRL-EVENT-CONNECTED - Connection to 01:80:c2:00:00:03 completed [id=0 id_str=]






=== Radius ===
=== Radius ===

Revision as of 09:35, 11 October 2022

Absicherung NFS

Funktionweise von 802.1x

802.1x ist ein Standard zur Authentifizierung in Netzwerken. Ein Client kann welcher sich physisch an einem Swichtport verbindet oder drahtlos mit einer SSID verbindet kann

Plan

Step 1: Authentifizierung mit 802.1x. 1x Switch, 1x Client und 1x RADIUS Server

Step 2: CSR in TPM generieren oder Zertifikat mit Schluessel importieren.

Step 3: Zertifikat aus TPM fuer 802.1x verwenden.

Step 1

• FREERADIUS Server aufgesetzt

• mit radtest auf LOCALHOST sichergestellt, dass der Server funktioniert

• Switch mit 3 VLANs eingerichtet. Einrichtung mit Netgear umständlich, weil die GUI sehr unübersichtlich ist

• Radius Server zum Switch hinzugefügt

• Switch als Client mit Secret in der clients.conf beim Radiusserver eingerichtet, was mithilfe der offiziellen Dokumentation relativ einfach war

• Dummyuser in der users-Datei auf dem Radiusserver angelegt

• 802.1X mit Dummyuser auf Laptop eingerichtet und mit dem Switch verbunden

• Zuweisen des jeweiligen VLANs bei "Access-Accept" und "Access-Accept" funkioniert

• RADIUS Server auf Raspberry Pi migriert für mobiles setup für die Demo. 2 Test VLANs auf Raspberry PI angelegt.

• ca erstellt mit root, server und client Zertifikat. Config Templates von free radius ausgefüllt und die Zertifikate mittels des Makefiles erstellen lassen. Das Makefile benutzt openssl mit den in den config templates festgelegten Werten.

• Zertifikatsbasierte Authentifizierung mit Laptop erfolgreich. Aktuell akzeptiert der RADIUS Server alle von der ROOT CA signierten Zertifikate.

Tunnel-Type = "VLAN", Tunnel-Medium-Type = "IEEE-802", Tunnel-Private-Group-Id = "10"

• mods-available/check-eap-tls bearbeitet um in der Radius Antwort den VLAN Tag mitzugeben. Erfolgreich getestet.

• DHCP Server aufgesetzt um bei der Demo anhand des DHCP leases zu zeigen dass der Client im gewünschten VLAN ist.

Step 2

https://github.com/tpm2-software/tpm2-pkcs11 von Source installiert, da dass Package aus den Packetmanager Quellen veraltet ist und für das Zusammenspiel mit openssl3 eine neuere Funktion benötigt wurde.

Folgende Artikel helfen bei allen möglichen Fehlern während der Installation:

Zusätzliche Dependency die benötigt wird: https://github.com/tpm2-software/tpm2-openssl

https://www.howtoinstall.me/ubuntu/18-04/libengine-pkcs11-openssl/

https://github.com/tpm2-software/tpm2-pkcs11/issues/766

https://stackoverflow.com/questions/43325110/exception-version-mismatchcffi

https://stackoverflow.com/questions/62154342/configure-error-package-requirements-sqlite3-3-7-4-were-not-met

https://askubuntu.com/questions/1403837/how-do-i-use-openssl-1-1-1-in-ubuntu-22-04

Wir haben ein Install-Skript fuer Ubuntu 24 geschrieben.

Das generieren eines CSRs im TPM hat mit folgendem Tutorial funktionert: https://github.com/tpm2-software/tpm2-pkcs11/blob/master/docs/EAP-TLS.md (nach 2 Tagen Fehlersuche)

Step 3

Das generierte Client CSR auf den Radius Server geschickt, um es von unserer CA signieren zu lassen.

Damit haben wir ein Client CRT erhalten, welches wir zurück zum Client Laptop geschickt haben.

Jetzt müssen wir

Ergebnisse

Successfully initialized wpa_supplicant
enx00e04c680106: Associated with 01:80:c2:00:00:03
enx00e04c680106: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
enx00e04c680106: CTRL-EVENT-EAP-STARTED EAP authentication started
enx00e04c680106: CTRL-EVENT-EAP-PROPOSED-METHOD vendor=0 method=4 -> NAK
enx00e04c680106: CTRL-EVENT-EAP-PROPOSED-METHOD vendor=0 method=13
enx00e04c680106: CTRL-EVENT-EAP-METHOD EAP vendor 0 method 13 (TLS) selected
enx00e04c680106: CTRL-EVENT-EAP-PEER-CERT depth=1 subject='/C=DE/ST=Berlin/L=Berlin/O=Rechnerbetriebsgruppe/emailAddress=admin@rbg.example/CN=Allm\xC3\x83\xC2\xA4chtige Rechnerbetriebgruppe ROOT'      hash=e058f4d62841026bda3814acaf39337fb2dc147456d6b45298d0472181b9f059
enx00e04c680106: CTRL-EVENT-EAP-PEER-CERT depth=0 subject='/C=DE/ST=Berlin/O=Rechnerbetriebsgruppe/CN=Allm\xC3\x83\xC2\xA4chtiger RADIUS/emailAddress=admin@rbg.example' hash=bf3be5e22ed92568dc215ada7a2e2babe8da4c9fb6fbf278f485669ad1161097 tod=2
enx00e04c680106: CTRL-EVENT-EAP-SUCCESS EAP authentication completed successfully
enx00e04c680106: CTRL-EVENT-CONNECTED - Connection to 01:80:c2:00:00:03 completed [id=0 id_str=]



Radius

RADIUS uses User Datagram Protocol (UDP) port 1812 for authentication and 1813 for accounting

radiusd.conf Defines the configuration parameters for the RADIUS server. It includes references to all of the other configuration files.

clients.conf Defines information necessary to configure the RADIUS client, including IP addresses and shared secrets. This file is referenced from the radiusd.conf file.

dictionary Defines local attributes for the RADIUS server. This file references the default dictionary files. The default dictionary files include thousands of attribute definitions for over one hundred vendors.

proxy.conf Defines upstream home servers, including information on IP addresses and shared secrets. It also defines Realms. The radiusd.conf file references the proxy.conf file.

sites-enabled/default This is the default virtual server. This file handles authentication and accounting requests. It contains a configuration designed to work with the largest number of authentication protocols. The radiusd.conf file references the sites-enable/default file.

sites-enabled/inner-tunnel This virtual server handles authentication methods that are carried inside of a TLS tunnel, as part of PEAP or EAP-TTLS authentication. The radiusd.conf file references the sql.conf file.

users The traditional RADIUS configuration file for users. This file format is similar to the format defined in 1993. The files file references the users file.

Implementierung

Ein Programm schreiben, welches eine CSR erstellt, wobei der private key im TPM erstellt wird und anschließend eine wpa-supplicant config erstellt. Ähnlich wie hier nur für wired:

https://wiki.archlinux.org/title/wpa_supplicant

cat > wpa_supplicant.conf <<EOF
network={
    ssid="SSID"
    key_mgmt=WPA-EAP
    eap=TLS
    identity="testing"
    ca_cert="/etc/pki/SSID/ca.pem"
    client_cert="/etc/pki/SSID/client.crt"
    private_key="pkcs11:model=Intel;manufacturer=Intel;serial=0000000000000000;token=label;id=%32%62%37%30%65%62%36%32%66%33%32%62%31%63%65%37;object=0;type=private;pin-value=userpin"
}
EOF

Switch Config

Model: Netgear S350 8 Port PW: Radius#01

!
interface g1
 switchport hybrid allowed vlan add 10,20,50 tagged
 authentication port-control force-auth
!
interface g2
!
interface g3
 switchport hybrid pvid 10
 switchport hybrid allowed vlan add 10 untagged
!
interface g4
 switchport hybrid pvid 10
 switchport hybrid allowed vlan add 10 untagged
 switchport hybrid allowed vlan remove 1
 authentication unauth-vlan 20
!
interface g5
 authentication unauth-vlan 20
!
interface g6
!
interface g7
 switchport hybrid pvid 50
 switchport hybrid allowed vlan add 10,20 tagged
 switchport hybrid allowed vlan add 50 untagged
 switchport hybrid allowed vlan remove 1
 authentication port-control force-auth
!
interface g8
 switchport hybrid pvid 50
 switchport hybrid allowed vlan add 50 untagged
 switchport hybrid allowed vlan remove 1
 authentication port-control force-auth
!

Ressourcen

https://tpm2-software.github.io/

https://github.com/tpm2-software/tpm2-pkcs11/blob/master/tools/tpm2_ptool.py

https://en.wikipedia.org/wiki/Xsupplicant

https://www.downloads.netgear.com/files/answers/Dynamic%20VLAN%20Assignment%20using%20RADIUS.pdf

https://wiki.ubuntuusers.de/ISC-DHCPD/

https://engineerworkshop.com/blog/raspberry-pi-vlan-how-to-connect-your-rpi-to-multiple-networks/

https://networkradius.com/doc/FreeRADIUS%20Technical%20Guide.pdf

https://www.ducea.com/2006/08/01/how-to-enable-ip-forwarding-in-linux/