Ricerca nel sito web

Come installare sysPass Password Manager su Debian 11


Su questa pagina

  1. Prerequisiti
  2. Installa Apache, MariaDB e PHP
  3. Crea un database per sysPass
  4. Installa sysPass
  5. Configura l'host virtuale Apache per sysPass
  6. Accedi all'interfaccia utente Web di sysPass
  7. Abilita Lets Encrypt SSL Support su sysPass
  8. Conclusione

sysPass è un'applicazione di gestione delle password basata sul Web scritta in PHP. È sicuro, affidabile e funziona in un ambiente multiutente per uso aziendale e personale. Salva le password utilizzando la crittografia bidirezionale con una password principale in un database. Fornisce un'interfaccia utente Web intuitiva che ti aiuta a impostare opzioni come autenticazione LDAP, posta, controllo, backup, importazione/esportazione, ecc.

Caratteristiche

  • Gratuito e open-source
  • Controllo accesso gruppo/profilo
  • Crittografia della password
  • Archiviazione di file con visualizzatore di immagini in linea
  • Integrazione tra OpenLDAP e Active Directory
  • Fornisci una notifica via email

In questo tutorial, ti mostrerò come installare l'applicazione di gestione delle password sysPass e proteggerla con un certificato SSL Lets Encrypt gratuito su Debian 11.

Prerequisiti

  • Un server che esegue Debian 11.
  • Un nome di dominio valido indicato con l'IP del tuo server.
  • Sul server è configurata una password di root.

Installa Apache, MariaDB e PHP

sysPass funziona su un server Web, utilizza MariaDB come database backend ed è scritto in PHP. Quindi dovrai installare il server web Apache, il server del database MariaDB, PHP e altre estensioni PHP sul tuo server. Puoi installarli tutti usando il seguente comando:

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

Una volta installati tutti i pacchetti, modifica il file php.ini e apporta alcune modifiche:

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

Modifica le seguenti impostazioni:

post_max_size = 100M
upload_max_filesize = 100M
max_execution_time = 7200
memory_limit = 512M
date.timezone = Asia/Kolkata

Salva e chiudi il file quando hai finito. Successivamente, riavvia il servizio Apache per applicare le modifiche alla configurazione:

systemctl restart apache2

Crea un database per sysPass

Per impostazione predefinita, l'installazione di MariaDB non è protetta. Quindi dovrai prima assicurarlo. Puoi proteggerlo usando il seguente comando:

mysql_secure_installation

Rispondi a tutte le domande come mostrato di seguito per impostare una password di root 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 MariaDB con il seguente comando:

mysql -u root -p

Ti verrà chiesto di fornire una password di root MariaDB. Una volta effettuato l'accesso, creare un database e un utente con il seguente comando:

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

Successivamente, svuota i privilegi ed esci dalla shell MariaDB con il seguente comando:

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

A questo punto, il tuo database MariaDB e l'utente sono pronti per sysPass. Ora puoi procedere al passaggio successivo.

Installa syspass

Innanzitutto, dovrai scaricare l'ultima versione di sysPass dal repository Git. Puoi scaricarlo usando il seguente comando:

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

Una volta completato il download, sposta la directory scaricata nella directory root web di Apache:

mv sysPass /var/www/html/syspass

Successivamente, imposta la proprietà corretta sulla directory syspass con il seguente comando:

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

Quindi, imposta l'autorizzazione corretta per le altre directory:

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

Successivamente, dovrai installare Composer sul tuo sistema.

Innanzitutto, crea uno script di installazione di Composer con il seguente comando:

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

Aggiungi le seguenti righe:

#!/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 utilizzando il seguente comando:

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

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

php composer.phar install --no-dev

Una volta installate tutte le dipendenze, puoi procedere al passaggio successivo.

Configura Apache Virtual Host per sysPass

Successivamente, dovrai creare un file di configurazione dell'host virtuale Apache per ospitare sysPass su Internet. Puoi crearlo usando il seguente comando:

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

Aggiungi le seguenti righe:

<VirtualHost *:80>
ServerAdmin 
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 quando hai finito di attivare l'host virtuale Apache con il seguente comando:

a2ensite syspass

Successivamente, riavvia il servizio Apache per applicare le modifiche:

systemctl restart apache2

Puoi anche controllare lo stato del servizio Apache usando il seguente comando:

systemctl status apache2

Dovresti ottenere il seguente output:

? 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...

Una volta terminato, puoi procedere al passaggio successivo.

Accedi all'interfaccia utente Web di sysPass

A questo punto, sysPass è installato e ospitato sul server web Apache. Ora, apri il tuo browser web e accedi all'interfaccia web di sysPass utilizzando l'URL http://syspass.example.com. Verrai reindirizzato alla seguente pagina:

Fornisci il tuo nome utente amministratore, password, password principale, credenziali del database, scegli la lingua, la modalità di hosting e fai clic sul pulsante INSTALLA. Una volta completata l'installazione, verrai reindirizzato alla pagina di accesso di sysPass.

Fornisci il nome utente e la password dell'amministratore e fai clic sul pulsante >. Dovresti vedere la dashboard sysPass nella pagina seguente:

Abilita Lets Encrypt SSL Support su sysPass

È sempre una buona idea proteggere il tuo sito web con Lets Encrypt SSL. Innanzitutto, dovrai installare il client Certbot per installare e gestire SSL. Per impostazione predefinita, il pacchetto Certbot è incluso nel repository predefinito di Debian 11, quindi è possibile installarlo con il seguente comando:

apt-get install python3-certbot-apache -y

Una volta installato Certbot, esegui il seguente comando per proteggere il tuo sito web con Lets Encrypt SSL:

certbot --apache -d syspass.example.com

Ti verrà chiesto di fornire la tua email e di accettare i termini di servizio come mostrato di seguito:

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): 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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

Successivamente, seleziona se reindirizzare o meno il traffico HTTP su HTTPS come mostrato di seguito:

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 Lets Encrypt SSL per il tuo sito web:

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

Congratulazioni! hai installato correttamente il gestore di password sysPass con Apache su Debian 11. Ora puoi creare un account diverso, aggiungere utenti, accedere ai privilegi e distribuirlo nel tuo ambiente di produzione.