如何在 Debian 11 上设置 Teampass 密码管理器
本教程适用于这些操作系统版本
- Debian 11(Bullseye)
- Debian 10(Buster)
在此页
- 先决条件
- 安装 Apache、MariaDB 和 PHP
- 为 Teampass 创建数据库
- 安装团队通行证
- 为 Tampass 创建一个 Apache 虚拟主机
- 访问 Teampass Web 界面
- 使用 Lets Encrypt SSL 保护 Teampass
- 结论
大多数用户在互联网上拥有大量社交媒体、电子邮件和其他帐户。任何人都很难管理自己所有的帐户和密码。这是密码管理器出现的地方。 Team pass 是一个开源密码管理器,可帮助您从中央位置存储和管理所有密码。它是一个协作密码管理器,允许您与团队成员共享所有存储的密码。您还可以为每个用户设置访问权限,以控制他们只能访问一组给定的数据。
在本教程中,我将向您展示如何在 Debian 11 上使用 Apache 和 Lets Encrypt SSL 安装 Tampass 密码管理器。
先决条件
- 运行 Debian 11 的服务器。
- 用您的服务器 IP 指向的有效域名。
- 在服务器上配置了根密码。
安装 Apache、MariaDB 和 PHP
首先,您需要为您的服务器安装 Apache Web 服务器、MariaDB 数据库服务器、PHP 和其他所需的扩展。您可以通过运行以下命令来安装所有这些:
apt-get install apache2 apache2-utils mariadb-server mariadb-client php7.4 libapache2-mod-php7.4 php7.4-mysql php-common php7.4-cli php7.4-common php7.4-json php7.4-opcache php7.4-readline php7.4-bcmath php7.4-curl php7.4-fpm php7.4-gd php7.4-xml php7.4-mbstring -y
安装所有软件包后,编辑 php.ini 文件并更改一些默认设置:
nano /etc/php/7.4/apache2/php.ini
更改以下设置:
max_execution_time = 60
date.timezone = Asia/Kolkata
保存并关闭文件,然后重新启动 Apache 服务以应用更改:
systemctl restart apache2
完成后,您可以继续下一步。
为 Teampass 创建数据库
Tampass 使用 MariaDB 作为数据库后端,因此您需要为 Tampass 创建数据库和用户。
首先,保护 MariaDB 安装并使用以下命令设置 MariaDB root 密码:
mysql_secure_installation
如下图所示回答所有问题:
Enter current password for root (enter for none):
Switch to unix_socket authentication [Y/n] n
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 [(none)]> create database teampass;
MariaDB [(none)]> grant all privileges on teampass.* to identified by "password";
接下来,使用以下命令刷新权限并退出 MariaDB:
MariaDB [(none)]> flush privileges;
MariaDB [(none)]> exit;
完成后,您可以继续下一步。
安装团队通行证
接下来,您需要从 Git 存储库下载最新版本的 Tampass。
首先,使用以下命令安装 git 包:
apt-get install git -y
接下来,将最新版本的 Tampass 下载到 Apache 网站根目录:
cd /var/www/html/
git clone https://github.com/nilsteampassnet/TeamPass.git
接下来,使用以下命令更改所有权和权限:
chown -R www-data:www-data TeamPass
chmod -R 775 /var/www/html/TeamPass
完成后,您可以继续下一步。
为 Teampass 创建 Apache 虚拟主机
接下来,您需要创建一个 Apache 虚拟主机配置文件以在 Internet 上托管 Tampass。
nano /etc/apache2/sites-available/teampass.conf
添加以下行:
<VirtualHost *:80>
ServerAdmin
DocumentRoot /var/www/html/TeamPass
ServerName teampass.example.com
<Directory /var/www/html/TeamPass>
Options FollowSymlinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/teampass_error.log
CustomLog ${APACHE_LOG_DIR}/teampass_access.log combined
</VirtualHost>
保存并关闭文件,然后启用 Apache 虚拟主机并重新启动 Apache 服务以应用更改:
a2ensite teampass
systemctl restart apache2
您还可以使用以下命令验证 Apache 的状态:
systemctl status apache2
您将获得以下输出:
? apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2021-11-01 03:39:47 UTC; 5s ago
Docs: https://httpd.apache.org/docs/2.4/
Process: 20013 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
Main PID: 20017 (apache2)
Tasks: 6 (limit: 2341)
Memory: 14.1M
CPU: 95ms
CGroup: /system.slice/apache2.service
??20017 /usr/sbin/apache2 -k start
??20018 /usr/sbin/apache2 -k start
??20019 /usr/sbin/apache2 -k start
??20020 /usr/sbin/apache2 -k start
??20021 /usr/sbin/apache2 -k start
??20022 /usr/sbin/apache2 -k start
Nov 01 03:39:47 debian11 systemd[1]: Starting The Apache HTTP Server..
访问 Teampass Web 界面
现在,打开 Web 浏览器并使用 URL http://teampass.example.com 访问 Tampass Web 界面。您应该会看到以下页面:

单击 LAUNCH 和 NEXT 按钮。您应该看到服务器检查屏幕:

提供您的 Teampass 路径、网站 URL,然后单击“启动”和“下一步”按钮。您应该会看到数据库连接屏幕:

提供您的数据库详细信息并单击 LAUNCH 和 NEXT 按钮。您应该看到准备屏幕:

提供您的管理员密码,然后单击“启动”和“下一步”按钮。您应该看到表创建屏幕:

单击 LAUNCH 和 NEXT 按钮。您应该看到最终确定屏幕:

单击 LAUNCH 和 NEXT 按钮。安装成功完成后,您应该会看到以下屏幕:

现在,单击移至主页按钮。您将被重定向到 TeamPass 登录屏幕,如下所示:

提供您的用户名 admin 和您在安装过程中输入的密码,然后单击“登录”按钮。您应该在以下屏幕上看到 TeamPass 仪表板:

使用 Lets Encrypt SSL 保护 Tampass
首先,您需要在服务器上安装 Certbot Lets Encrypt 客户端。它用于为您的域安装和管理 Lets Encrypt SSL 证书。运行以下命令来安装 Certbot。
apt-get install python3-certbot-apache -y
安装 Certbot 后,运行以下命令为您的网站下载并安装 Lets Encrypt SSL:
certbot --apache -d teampass.example.com
您需要提供有效的电子邮件地址并接受服务条款,如下所示:
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache
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
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for teampass.example.com
Enabled Apache rewrite module
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/apache2/sites-available/teampass-le-ssl.conf
Enabled Apache socache_shmcb module
Enabled Apache ssl module
Deploying Certificate to VirtualHost /etc/apache2/sites-available/teampass-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/teampass-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 使所有请求重定向到安全的 HTTPS 访问,然后按 Enter 键安装 Lets Encrypt SSL。安装成功完成后,您应该会看到以下输出:
Enabled Apache rewrite module
Redirecting vhost in /etc/apache2/sites-enabled/teampass.conf to ssl vhost in /etc/apache2/sites-available/teampass-le-ssl.conf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://teampass.example.com
You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=teampass.example.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/teampass.example.com/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/teampass.example.com/privkey.pem
Your cert will expire on 2022-01-30. 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"
- Your account credentials have been saved in your Certbot
configuration directory at /etc/letsencrypt. You should make a
secure backup of this folder now. This configuration directory will
also contain certificates and private keys obtained by Certbot so
making regular backups of this folder is ideal.
- 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
此时,您的网站已使用 Lets Encrypt SSL 进行保护。您现在可以使用 HTTPS 协议安全地访问它。
结论
恭喜!您已经在 Debian 11 上成功安装了带有 Apache 和 Lets Encrypt SSL 的 Tampass 密码管理器。您现在可以管理您的所有凭据并从基于 Web 的界面与您的团队共享它们。