GNU/Linux >> Linux Esercitazione >  >> Debian

Come installare sysPass Password Manager su Debian 11

sysPass è un'applicazione web per la gestione delle password, scritta in PHP. È sicura, affidabile e pensata per lavorare in ambienti multiutente, sia in ambito aziendale sia personale. Le password vengono salvate in un database tramite crittografia bidirezionale protetta da una password principale. L'interfaccia web, intuitiva, permette di configurare opzioni come autenticazione LDAP, posta elettronica, audit, backup e importazione/esportazione dei dati.

Caratteristiche principali

  • Gratuito e open source
  • Controllo degli accessi basato su gruppi e profili
  • Crittografia delle password
  • Gestione dei file con visualizzatore di immagini integrato
  • Integrazione con OpenLDAP e Active Directory
  • Notifiche via email

In questa guida vedremo come installare sysPass e proteggerlo con un certificato SSL gratuito di Let's Encrypt su Debian 11.

Prerequisiti

  • Un server con Debian 11.
  • Un nome di dominio valido puntato all'IP del server.
  • Una password di root configurata sul server.

Installare Apache, MariaDB e PHP

sysPass richiede un server web, usa MariaDB come database di backend ed è scritto in PHP. Dovrai quindi installare il server web Apache, il database MariaDB, PHP e le relative estensioni. Puoi installare tutto con il comando seguente:

apt-get install apache2 mariadb-server libapache2-mod-php php php-mysqli php-pdo php-pear php php-cgi php-cli php-common php-gd php-json php-readline php-curl php-intl php-ldap php-xml php-mbstring git -y

Al termine dell'installazione, modifica il file php.ini apportando alcune impostazioni:

nano /etc/php/7.4/apache2/php.ini

Modifica le seguenti voci:

post_max_size = 100M upload_max_filesize = 100M max_execution_time = 7200 memory_limit = 512M date.timezone = Europe/Rome 

Salva e chiudi il file. Successivamente, riavvia il servizio Apache per applicare le modifiche:

systemctl restart apache2

Creare un database per sysPass

Di norma l'installazione di MariaDB non è protetta, quindi conviene metterla in sicurezza. Puoi farlo con il comando seguente:

mysql_secure_installation

Rispondi alle domande come indicato qui sotto per impostare una password di root di MariaDB e proteggere l'installazione:

Enter current password for root (enter for none): Switch to unix_socket authentication [Y/n] Y Change the root password? [Y/n] Y New password: Re-enter new password: Remove anonymous users? [Y/n] Y Disallow root login remotely? [Y/n] Y Remove test database and access to it? [Y/n] Y Reload privilege tables now? [Y/n] Y 

Al termine, accedi all'interfaccia di MariaDB con il comando seguente:

mysql -u root -p

Ti verrà richiesta la password di root di MariaDB. Una volta effettuato l'accesso, crea un database e un utente con il comando seguente:

MariaDB [(none)]> create database syspassdb;
MariaDB [(none)]> grant all privileges on syspassdb.* to [email protected] identified by "password";

Ora ricarica i privilegi ed esci dalla shell di MariaDB:

MariaDB [(none)]> flush privileges;
MariaDB [(none)]> exit;

A questo punto il database e l'utente MariaDB sono pronti per sysPass. Puoi procedere con il passo successivo.

Installare sysPass

Per prima cosa scarica l'ultima versione di sysPass dal repository Git con il comando seguente:

git clone https://github.com/nuxsmin/sysPass.git

Al termine del download, sposta la cartella scaricata nella root del web server Apache:

mv sysPass /var/www/html/syspass

Assegna quindi il corretto proprietario alla directory syspass:

chown -R www-data:www-data /var/www/html/syspass

Imposta i permessi corretti sulle altre directory:

chmod 750 /var/www/html/syspass/app/{config,backup}

È inoltre necessario installare Composer sul sistema. Crea innanzitutto lo script di installazione di Composer con il comando seguente:

nano /var/www/html/syspass/install-composer.sh

Aggiungi le righe seguenti:

#!/bin/sh EXPECTED_SIGNATURE="$(wget -q -O - https://composer.github.io/installer.sig)" php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" ACTUAL_SIGNATURE="$(php -r "echo hash_file('sha384', 'composer-setup.php');")" if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ] then >&2 echo 'ERROR: Invalid installer signature' rm composer-setup.php exit 1 fi php composer-setup.php --quiet RESULT=$? rm composer-setup.php exit $RESULT 

Salva e chiudi il file, quindi esegui lo script di installazione di Composer:

cd /var/www/html/syspass/
sh install-composer.sh

Una volta installato Composer, esegui il comando seguente per installare tutte le dipendenze PHP richieste:

php composer.phar install --no-dev

Dopo l'installazione di tutte le dipendenze, puoi procedere al passo successivo.

Configurare l'host virtuale Apache per sysPass

Crea ora un file di configurazione dell'host virtuale Apache per rendere sysPass accessibile da Internet:

nano /etc/apache2/sites-available/syspass.conf

Aggiungi le righe seguenti:

<VirtualHost *:80> ServerAdmin [email protected] DocumentRoot "/var/www/html/syspass" ServerName syspass.example.com <Directory "/var/www/html/syspass/"> Options MultiViews FollowSymlinks AllowOverride All Order allow,deny Allow from all </Directory> TransferLog /var/log/apache2/syspass_access.log ErrorLog /var/log/apache2/syspass_error.log </VirtualHost> 

Salva e chiudi il file, quindi attiva l'host virtuale Apache con il comando seguente:

a2ensite syspass

Riavvia il servizio Apache per applicare le modifiche:

systemctl restart apache2

Puoi verificare lo stato del servizio Apache anche con il comando seguente:

systemctl status apache2

Dovresti ottenere un output simile al seguente:

? apache2.service - The Apache HTTP Server Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled) Active: active (running) since Sat 2021-10-16 13:41:36 UTC; 4s ago Docs: https://httpd.apache.org/docs/2.4/ Process: 17819 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS) Main PID: 17824 (apache2) Tasks: 6 (limit: 2341) Memory: 14.7M CPU: 76ms CGroup: /system.slice/apache2.service ??17824 /usr/sbin/apache2 -k start ??17825 /usr/sbin/apache2 -k start ??17826 /usr/sbin/apache2 -k start ??17827 /usr/sbin/apache2 -k start ??17828 /usr/sbin/apache2 -k start ??17829 /usr/sbin/apache2 -k start Oct 16 13:41:36 debian11 systemd[1]: Starting The Apache HTTP Server... 

Completato questo passaggio, puoi proseguire.

Accedere all'interfaccia web di sysPass

sysPass è ora installato e ospitato sul server Apache. Apri il browser e raggiungi l'interfaccia web all'indirizzo https://syspass.example.com. Verrai reindirizzato alla pagina di installazione:

Come installare sysPass Password Manager su Debian 11

Come installare sysPass Password Manager su Debian 11

Inserisci nome utente e password dell'amministratore, la password principale, le credenziali del database, scegli la lingua e la modalità di hosting, quindi fai clic sul pulsante INSTALL. Al termine verrai reindirizzato alla pagina di login di sysPass.

Come installare sysPass Password Manager su Debian 11

Inserisci nome utente e password dell'amministratore e fai clic sul pulsante >. Dovresti visualizzare la dashboard di sysPass:

Come installare sysPass Password Manager su Debian 11

Attivare il supporto SSL Let's Encrypt su sysPass

È sempre consigliabile proteggere il sito con un certificato SSL di Let's Encrypt. Per prima cosa installa il client Certbot, che si occuperà di installare e gestire il certificato. Il pacchetto Certbot è incluso nel repository predefinito di Debian 11, quindi puoi installarlo con il comando seguente:

apt-get install python3-certbot-apache -y

Al termine dell'installazione di Certbot, esegui il comando seguente per proteggere il sito con il certificato SSL di Let's Encrypt:

certbot --apache -d syspass.example.com

Ti verrà chiesto di fornire un indirizzo email e di accettare i termini di servizio, come mostrato qui sotto:

Saving debug log to /var/log/letsencrypt/letsencrypt.log Plugins selected: Authenticator standalone, Installer None Enter email address (used for urgent renewal and security notices) (Enter 'c' to cancel): [email protected] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Please read the Terms of Service at https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must agree in order to register with the ACME server at https://acme-v02.api.letsencrypt.org/directory - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (A)gree/(C)ancel: A - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Would you be willing to share your email address with the Electronic Frontier Foundation, a founding partner of the Let's Encrypt project and the non-profit organization that develops Certbot? We'd like to send you email about our work encrypting the web, EFF news, campaigns, and ways to support digital freedom. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (Y)es/(N)o: Y Plugins selected: Authenticator apache, Installer apache Obtaining a new certificate Performing the following challenges: http-01 challenge for syspass.example.com Enabled Apache rewrite module Waiting for verification... Cleaning up challenges Created an SSL vhost at /etc/apache2/sites-available/syspass-le-ssl.conf Enabled Apache socache_shmcb module Enabled Apache ssl module Deploying Certificate to VirtualHost /etc/apache2/sites-available/syspass-le-ssl.conf Enabling available site: /etc/apache2/sites-available/syspass-le-ssl.conf 

Scegli quindi se reindirizzare o meno il traffico HTTP verso HTTPS, come mostrato qui sotto:

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1: No redirect - Make no further changes to the webserver configuration. 2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for new sites, or if you're confident your site works on HTTPS. You can undo this change by editing your web server's configuration. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2 

Digita 2 e premi Invio per installare il certificato SSL Let's Encrypt:

Enabled Apache rewrite module Redirecting vhost in /etc/apache2/sites-enabled/syspass.conf to ssl vhost in /etc/apache2/sites-available/syspass-le-ssl.conf - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Congratulations! You have successfully enabled https://syspass.example.com You should test your configuration at: https://www.ssllabs.com/ssltest/analyze.html?d=syspass.example.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - IMPORTANT NOTES: - Congratulations! Your certificate and chain have been saved at: /etc/letsencrypt/live/syspass.example.com/fullchain.pem Your key file has been saved at: /etc/letsencrypt/live/syspass.example.com/privkey.pem Your cert will expire on 2021-07-20. To obtain a new or tweaked version of this certificate in the future, simply run certbot again with the "certonly" option. To non-interactively renew *all* of your certificates, run "certbot renew" - If you like Certbot, please consider supporting our work by: Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate Donating to EFF: https://eff.org/donate-le 

Conclusione

Complimenti! Hai installato correttamente sysPass con Apache su Debian 11 e lo hai protetto con un certificato SSL di Let's Encrypt. Ora puoi creare nuovi account, aggiungere utenti, gestire i privilegi di accesso e utilizzare l'applicazione nell'ambiente di produzione.


Debian
  1. Come installare MySQL su Debian 9

  2. Installare e proteggere MariaDB su Debian 9: due approcci a confronto

  3. Installare MariaDB su Debian 10

  4. Come installare MariaDB 10.x su Debian 11 e renderlo sicuro

  5. Come Installare MariaDB su Debian 11

Come Installare OwnCloud su Debian 9

Installare Joomla su Debian 10 Buster

Installare LibreNMS su Debian 10 Buster

Installare MariaDB 10.6 su Debian 11 Bullseye

Come installare Nextcloud su Debian 11 Bullseye

Installare il gestore di password sysPass su Debian 11