Skip to content

通过知识获得解放,通过技术获得自由

Menu
  • 专题目录
  • 液压相关
    • 液压技术
    • 液压相邻技术
    • 液压应用
  • 计算机相关
    • 计算机和软件
    • 网络和网站技术
  • 哲学
  • 关于本站
Menu

本地docker部署bitwarden[0]

Posted on 2023年11月14日2025年5月6日 by

本篇是网络docker部署bitwarden的续篇。

本篇需要部署ntp服务器实现高精度的时间同步。

本地部署bitwarden的部署和安全性要求,较公网上的要求低,但是bitwarden默认要求https才可以浏览器打开,本方式不再采用nginx反代的方式,因此组件要求降低。

  • 前提条件

1)部署docker

  • 部署过程
#关闭selinux
sed -i '/^SELINUX/s/enforcing/disabled/g' /etc/selinux/config
setenforce 0

#将host上的/vw-data/ 映射到docker上的/data/
mkdir /vw-data/

#创建证书路径
mkdir /ssl/
mkdir /ssl/keys/

cd  /ssl/keys/
#通过openssl生成私钥vhost.key
openssl genrsa -out vhost.key 4096

#生成证书申请文件vhost.csr
openssl req -new -key vhost.key -out vhost.csr

#使用私钥对证书申请进行签名从而生成10有效期证书vhost.crt
openssl x509 -req -in vhost.csr -out vhost.crt -signkey vhost.key -days 3650


#运行容器
docker pull vaultwarden/server:latest

docker run -d --name bitwarden --restart always \
  -e ROCKET_TLS='{certs="/ssl/vhost.crt",key="/ssl/vhost.key"}' \
  -v /ssl/keys/:/ssl/ \
  -v /vw-data/:/data/ \
  -p 443:80 \
  vaultwarden/server:latest

#防火墙开放端口
systemctl restart firewalld
firewall-cmd --permanent --zone=public --add-port=80/tcp
firewall-cmd --permanent --zone=public --add-port=443/tcp
systemctl restart firewalld

 

  • 小结

测试通过。

 

补充说明:

1)对于docker部署的软件,由于其开源特性不足,因此使用时需要考虑其可能存在的问题,一般建议在防火墙上禁止访问公网比较妥当。

2)有ipv6的情况,必要的情况下关闭ipv6避免被暴露,引来攻击。

3)对于避免docker占用主机端口,并无意开放端口的问题,可以采用以下设置:

docker run -d --name bitwarden --restart always \ 
-e ROCKET_TLS='{certs="/ssl/vhost.crt",key="/ssl/vhost.key"}' \ 
-v /ssl/keys/:/ssl/ \ 
-v /vw-data/:/data/ \ 
-p 127.0.0.1:443:80 \ 
vaultwarden/server:latest

对于外部访问可以采用nginx反向代理

4)开启管理后台

docker run -d --name bitwarden --restart always \
  -e ROCKET_TLS='{certs="/ssl/vhost.crt",key="/ssl/vhost.key"}' \
  -e ADMIN_TOKEN="randomkey" \
  -v /ssl/keys/:/ssl/ \
  -v /vw-data/:/data/ \
  -p 127.0.0.1:8443:80 \
  vaultwarden/server:latest

默认没有后台admin

欢迎回来

希望本站对你有所帮助!

如有疑问请联系info@fanlog.org
2023 年 11 月
一二三四五六日
 12345
6789101112
13141516171819
20212223242526
27282930 
« 6 月    

AI辅助 (17)

© 2025 | Powered by Superbs Personal Blog theme
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept All”, you consent to the use of ALL the cookies. However, you may visit "Cookie Settings" to provide a controlled consent.
Cookie SettingsAccept All
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Non-necessary
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
SAVE & ACCEPT