Abilitazione del login 2FA in Pfsense: Difference between revisions

From RVM Wiki
Jump to navigation Jump to search
Created page with "* L'autenticazione è basata su Freeradius con plugin OTP * L'utenza admin rimarrà utilizabile, date che viene sempre testato il ocal database come fallback * '''Attenzione: è VITALE che l'host Pfsense abbia l'orario perfettamente sincronizzato, altrimenti nel System Log si avrà sempre l'errore''' freeRADIUS: Google Authenticator - Authentication failed. User: xyz, Reason: wrong tokencode * Abilitare quindi il server NTP dai services e verificare da shell l'orario..."
 
mNo edit summary
 
Line 16: Line 16:
** Services > FreeRADIUS > NAS/Clients [Add]
** Services > FreeRADIUS > NAS/Clients [Add]
*** Client IP : 127.0.0.1
*** Client IP : 127.0.0.1
*** Clinet Shortname: FreeRadiusOTP
*** Client IP Version: IPv4
*** Client IP Version: IPv4
*** Client Shared Secret: una password massimo 31 caratteri alfanumerica
*** Client Shared Secret: una password massimo 31 caratteri alfanumerica

Latest revision as of 13:48, 14 January 2025

  • L'autenticazione è basata su Freeradius con plugin OTP
  • L'utenza admin rimarrà utilizabile, date che viene sempre testato il ocal database come fallback
  • Attenzione: è VITALE che l'host Pfsense abbia l'orario perfettamente sincronizzato, altrimenti nel System Log si avrà sempre l'errore
freeRADIUS: Google Authenticator - Authentication failed. User: xyz, Reason: wrong tokencode
  • Abilitare quindi il server NTP dai services e verificare da shell l'orario
  • Installare il package Freeradius
  • Abilitare il 2FA:
    • Services > FreeRADIUS > Settings - Mobile-One-Time-Password Configuration
      • Tick the Enable Mobile-One-Time Password Support box.
      • Set the Hash Algorithm to SHA256.
  • Abilitare il Listner:
    • Services > FreeRADIUS > Interfaces [Add] [SAVE]
  • Aggiungere un Client
    • Services > FreeRADIUS > NAS/Clients [Add]
      • Client IP : 127.0.0.1
      • Clinet Shortname: FreeRadiusOTP
      • Client IP Version: IPv4
      • Client Shared Secret: una password massimo 31 caratteri alfanumerica
    • [SAVE]
  • Creare lo user 2FA in Freeradius:
  • Services > FreeRADIUS > Users [Add] | One-Time Password Configuration
    • Username: il nome dello user freeradius (alfanumerico e punto consentiti)
    • Tick the Enable One-Time Password (OTP) for this user box.
    • OTP Auth Method: Google Authenticator.
    • [Generate OTP Secret]
    • PIN: un numero di 5 o 6 cifre
    • [Show OTP PIN]
    • Configurare l'OTP Generator usando il QRCode o l'OTP secret
    • [SAVE]
  • Aggiungere il server Freeradius ai servizi di autenticazione:
    • System > User Manager > Authentication Servers [Add]
      • Descriptive name: FreeRadiusOTP
      • Type: RADIUS
      • RADIUS Server Settings:
      • Protocol: PAP
      • Hostname or IP address: 127.0.0.1
      • Shared Secret: la password inserita nel NAS/Client
      • Services offered: Authentication
      • RADIUS NAS IP: LAN – <your LAN ip address>
      • [Save]
  • Testare l'autenticazione
  • Diagnostics > Authentication
    • Authentication Serve: FreeRadiusOTP
    • Username: il nome dello user freeradius
    • Password: Enter your OTP PIN and your Google Authenticator OTP as the . If the PIN is 123456, and Google Authenticator is giving 942 244 as the OTP, so I would enter 123456942244 in the password field
    • [Test]
  • Se tutto funziona, bene, altrimenti guardare in Status > System Logs | Filters | Message: radius
  • Abilitare il server di autenticazione
    • System > User Manager > Settings | Authentication: FreeRadiusOTP
    • [Save]`
  • Aggiungere lo user Pfsense con lo stesso username dello user Freeradius:
    • System > User Manager > Users [Add]
    • Username: the FreeRADIUS user’s username
    • Password: Enter your FreeRADIUS user’s PIN without the OTP from Google Authenticator.
    • Tick [This user cannot login box]. This disables password login and enforces login with your user PIN and OTP.
    • Group membership : Member of admins
    • [Save]
  • Sloggarsi e loggarsi con l'utenza Freeradius con password ${PIN}${OTP}
  • L'utenza admin continuerà funzionare usando come fallback l'autenticazione locale.

Riferimenti