Installa sysPass Password Manager con Free Lets Encrypt SSL su Ubuntu 22.04
Questo tutorial esiste per queste versioni del sistema operativo
- Ubuntu 22.04 (Jammy Jellyfish)
- Ubuntu 20.04 (Focal Fossa)
Su questa pagina
- Prerequisiti
- Installa Apache, MariaDB e PHP
- Configura MariaDB per sysPass
- Installa sysPass
- Configura Apache per sysPass
- Accedi all'interfaccia di amministrazione di sysPass
- Installa Lets Encrypt SSL su sysPass
- Conclusione
sysPass è uno strumento di gestione delle password gratuito, open source e basato su PHP utilizzato per salvare le password in un luogo sicuro. È basato sul Web, sicuro, affidabile e progettato per ambienti multiutente. Viene fornito con un'interfaccia web intuitiva che aiuta gli utenti a configurare diverse opzioni come autenticazione LDAP, posta, controllo, backup, importazione/esportazione, ecc. sysPass può essere installato tramite app Web, app mobile ed estensione del browser.
In questo post, ti mostreremo come installare il gestore di password sysPass su Ubuntu 22.04.
Prerequisiti
- Un server che esegue Ubuntu 22.04.
- Un nome di dominio valido indicato con l'IP del tuo server.
- Sul server è configurata una password di root.
Installa Apache, MariaDB e PHP
Prima di iniziare, dovrai installare il server Web Apache, il server del database MariaDB, PHP e altre estensioni PHP sul tuo server. Innanzitutto, installa il server Apache e MariaDB utilizzando il seguente comando:
apt-get install apache2 mariadb-server -y
Per impostazione predefinita, Ubuntu 22.04 viene fornito con la versione PHP 8.1, ma sysPass non supporta la versione PHP 8.1. Quindi dovrai installare la versione PHP 7.4 con altre estensioni sul tuo server.
Innanzitutto, installa tutte le dipendenze richieste con il seguente comando:
apt install software-properties-common ca-certificates lsb-release apt-transport-https
Successivamente, aggiungi il repository PHP con il seguente comando:
add-apt-repository ppa:ondrej/php
Una volta aggiunto il repository PHP, esegui il seguente comando per installare PHP 7.4 con tutte le estensioni richieste:
apt install libapache2-mod-php7.4 php7.4 php7.4-mysqli php7.4-pdo php7.4 php7.4-cgi php7.4-cli php7.4-common php7.4-gd php7.4-json php7.4-readline php7.4-curl php7.4-intl php7.4-ldap php7.4-xml php7.4-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 = UTC
Salva e chiudi il file quando hai finito. Successivamente, riavvia il servizio Apache per applicare le modifiche alla configurazione:
systemctl restart apache2
Configura MariaDB 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, scarica l'ultima versione di sysPass dal repository Git usando il seguente comando:
git clone https://github.com/nuxsmin/sysPass.git
Dopo aver scaricato sysPass, 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 per sysPass
Successivamente, dovrai creare un file di configurazione dell'host virtuale Apache per ospitare sysPass sul web. 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, quindi attiva 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 prese> Active: active (running) since Sun 2022-07-24 04:27:17 UTC; 6s ago Docs: https://httpd.apache.org/docs/2.4/ Process: 62773 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/S> Main PID: 62777 (apache2) Tasks: 6 (limit: 2242) Memory: 14.3M CPU: 109ms CGroup: /system.slice/apache2.service ??62777 /usr/sbin/apache2 -k start ??62778 /usr/sbin/apache2 -k start ??62779 /usr/sbin/apache2 -k start ??62780 /usr/sbin/apache2 -k start ??62781 /usr/sbin/apache2 -k start ??62782 /usr/sbin/apache2 -k start Jul 24 04:27:17 ubuntu systemd[1]: Starting The Apache HTTP Server...
Una volta terminato, puoi procedere al passaggio successivo.
Accedi all'interfaccia di amministrazione di sysPass
Ora, apri il tuo browser web e accedi all'interfaccia sysPass Admin 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:
Installa Lets Encrypt SSL 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 Ubuntu 22.04, quindi puoi 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 2022-10-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 e Lets Encrypt SSL su Ubuntu 22.04. Ora puoi esplorare il gestore di password sysPass e iniziare a distribuirlo nel tuo ambiente di produzione.