Ubuntu 22.04에서 무료 Lets Encrypt SSL로 sysPass Password Manager 설치
이 튜토리얼은 다음 OS 버전에 대해 존재합니다.
- Ubuntu 22.04(Jammy Jellyfish)
- Ubuntu 20.04(Focal Fossa)
이 페이지에서
- 전제 조건
- Apache, MariaDB 및 PHP 설치
- sysPass용 MariaDB 구성
- sysPass 설치
- sysPass용 Apache 구성
- sysPass 관리 인터페이스 액세스
- sysPass에 Lets Encrypt SSL 설치
- 결론
sysPass는 암호를 안전한 위치에 저장하는 데 사용되는 무료 오픈 소스 PHP 기반 암호 관리 도구입니다. 웹 기반의 안전하고 신뢰할 수 있으며 다중 사용자 환경을 위해 설계되었습니다. 그것은 사용자가 LDAP 인증, 메일, 감사, 백업, 가져오기/내보내기 등과 같은 다양한 옵션을 구성하는 데 도움이 되는 사용자 친화적인 웹 인터페이스와 함께 제공됩니다. sysPass는 웹 앱, 모바일 앱 및 브라우저 확장을 통해 설치할 수 있습니다.
이 게시물에서는 Ubuntu 22.04에 sysPass 암호 관리자를 설치하는 방법을 보여줍니다.
전제 조건
- Ubuntu 22.04를 실행하는 서버.\n
- 서버 IP를 가리키는 유효한 도메인 이름입니다.\n
- 루트 암호는 서버에서 구성됩니다.\n
Apache, MariaDB 및 PHP 설치
시작하기 전에 Apache 웹 서버, MariaDB 데이터베이스 서버, PHP 및 기타 PHP 확장을 서버에 설치해야 합니다. 먼저 다음 명령을 사용하여 Apache 및 MariaDB 서버를 설치합니다.
apt-get install apache2 mariadb-server -y
기본적으로 Ubuntu 22.04는 PHP 8.1 버전과 함께 제공되지만 sysPass는 PHP 8.1 버전을 지원하지 않습니다. 따라서 서버에 다른 확장이 포함된 PHP 7.4 버전을 설치해야 합니다.
먼저 다음 명령을 사용하여 필요한 모든 종속 항목을 설치합니다.
apt install software-properties-common ca-certificates lsb-release apt-transport-https
다음으로 다음 명령을 사용하여 PHP 리포지토리를 추가합니다.
add-apt-repository ppa:ondrej/php
PHP 리포지토리가 추가되면 다음 명령을 실행하여 필요한 모든 확장과 함께 PHP 7.4를 설치합니다.
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
모든 패키지가 설치되면 php.ini 파일을 편집하고 몇 가지 사항을 변경합니다.
nano /etc/php/7.4/apache2/php.ini
다음 설정을 변경합니다.
post_max_size = 100M upload_max_filesize = 100M max_execution_time = 7200 memory_limit = 512M date.timezone = UTC
완료되면 파일을 저장하고 닫습니다. 그런 다음 Apache 서비스를 다시 시작하여 구성 변경 사항을 적용합니다.
systemctl restart apache2
sysPass용 MariaDB 구성
기본적으로 MariaDB 설치는 보안되지 않습니다. 따라서 먼저 보안을 유지해야 합니다. 다음 명령을 사용하여 보안을 설정할 수 있습니다.
mysql_secure_installation
MariaDB 루트 암호를 설정하고 설치를 보호하려면 아래와 같이 모든 질문에 답하십시오.
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
완료되면 다음 명령을 사용하여 MariaDB 인터페이스에 로그인합니다.
mysql -u root -p
MariaDB 루트 암호를 제공하라는 메시지가 표시됩니다. 로그인한 후 다음 명령을 사용하여 데이터베이스와 사용자를 생성합니다.
MariaDB [(none)]> create database syspassdb;
MariaDB [(none)]> grant all privileges on syspassdb.* to identified by "password";
그런 다음 권한을 플러시하고 다음 명령을 사용하여 MariaDB 셸을 종료합니다.
MariaDB [(none)]> flush privileges;
MariaDB [(none)]> exit;
이 시점에서 MariaDB 데이터베이스와 사용자는 sysPass를 사용할 준비가 되었습니다. 이제 다음 단계로 진행할 수 있습니다.
sysPass 설치
먼저 다음 명령을 사용하여 Git 리포지토리에서 최신 버전의 sysPass를 다운로드합니다.
git clone https://github.com/nuxsmin/sysPass.git
sysPass를 다운로드한 후 다운로드한 디렉터리를 Apache 웹 루트 디렉터리로 이동합니다.
mv sysPass /var/www/html/syspass
그런 다음 다음 명령을 사용하여 syspass 디렉터리에 적절한 소유권을 설정합니다.
chown -R www-data:www-data /var/www/html/syspass
다음으로 다른 디렉터리에 적절한 권한을 설정합니다.
chmod 750 /var/www/html/syspass/app/{config,backup}
다음으로 Composer를 시스템에 설치해야 합니다.
먼저 다음 명령을 사용하여 Composer 설치 스크립트를 만듭니다.
nano /var/www/html/syspass/install-composer.sh
다음 줄을 추가합니다.
#!/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
파일을 저장하고 닫은 후 다음 명령을 사용하여 Composer 설치 스크립트를 실행합니다.
cd /var/www/html/syspass/
sh install-composer.sh
Composer가 설치되면 다음 명령을 실행하여 필요한 모든 PHP 종속성을 설치합니다.
php composer.phar install --no-dev
모든 종속성이 설치되면 다음 단계로 진행할 수 있습니다.
sysPass용 Apache 구성
다음으로 웹에서 sysPass를 호스팅하기 위해 Apache 가상 호스트 구성 파일을 생성해야 합니다. 다음 명령을 사용하여 만들 수 있습니다.
nano /etc/apache2/sites-available/syspass.conf
다음 줄을 추가합니다.
<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>
완료되면 파일을 저장하고 닫은 후 다음 명령을 사용하여 Apache 가상 호스트를 활성화합니다.
a2ensite syspass
다음으로 Apache 서비스를 다시 시작하여 변경 사항을 적용합니다.
systemctl restart apache2
다음 명령을 사용하여 Apache 서비스의 상태를 확인할 수도 있습니다.
systemctl status apache2
다음 출력이 표시되어야 합니다.
? 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...
완료되면 다음 단계로 진행할 수 있습니다.
sysPass 관리 인터페이스에 액세스
이제 웹 브라우저를 열고 URL http://syspass.example.com을 사용하여 sysPass 관리 인터페이스에 액세스하십시오. 다음 페이지로 리디렉션됩니다.
관리자 사용자 이름, 암호, 마스터 암호, 데이터베이스 자격 증명을 제공하고 언어, 호스팅 모드를 선택하고 설치 버튼을 클릭합니다. 설치가 완료되면 sysPass 로그인 페이지로 리디렉션됩니다.
관리자 사용자 이름과 비밀번호를 제공하고 > 버튼을 클릭합니다. 다음 페이지에 sysPass 대시보드가 표시되어야 합니다.
sysPass에서 Lets Encrypt SSL 설치
Lets Encrypt SSL로 웹 사이트를 보호하는 것은 항상 좋은 생각입니다. 먼저 SSL을 설치하고 관리하려면 Certbot 클라이언트를 설치해야 합니다. 기본적으로 Certbot 패키지는 Ubuntu 22.04 기본 리포지토리에 포함되어 있으므로 다음 명령을 사용하여 설치할 수 있습니다.
apt-get install python3-certbot-apache -y
Certbot이 설치되면 다음 명령을 실행하여 Lets Encrypt SSL로 웹 사이트를 보호하십시오.
certbot --apache -d syspass.example.com
아래와 같이 이메일을 제공하고 서비스 약관에 동의하라는 메시지가 표시됩니다.
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
다음으로 아래와 같이 HTTP 트래픽을 HTTPS로 리디렉션할지 여부를 선택합니다.
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
2를 입력하고 Enter 키를 눌러 웹사이트에 Lets Encrypt SSL을 설치합니다.
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
결론
축하합니다! Apache와 함께 sysPass 암호 관리자를 성공적으로 설치했으며 Ubuntu 22.04에서 SSL을 암호화할 수 있습니다. 이제 sysPass 비밀번호 관리자를 탐색하고 프로덕션 환경에서 배포를 시작할 수 있습니다.