{"id":262097,"date":"2023-02-21T09:48:08","date_gmt":"2023-02-21T01:48:08","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=262097"},"modified":"2023-01-19T11:49:24","modified_gmt":"2023-01-19T03:49:24","slug":"ubuntu-docker-bitwardenrs","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/ubuntu-docker-bitwardenrs.html","title":{"rendered":"\u5728Ubuntu18.04 \u4e0a\u91c7\u7528Docker \u5b89\u88c5bitwardenrs\u548c\u5b9e\u73b0\u81ea\u52a8\u5907\u4efd\u6570\u636e\u5e93"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\nBitwarden\u662f\u4e00\u6b3e\u5f00\u6e90\u7684\u5bc6\u7801\u7ba1\u7406\u5668\u3002\u652f\u6301 Windows\u3001MacOS \u548c Linux \u4e09\u5927\u64cd\u4f5c\u7cfb\u7edf\u548c Android\uff0ciOS \u4e24\u5927\u624b\u673a\u7aef\u5e73\u53f0\uff0c\u7528\u6237\u4e5f\u53ef\u76f4\u63a5\u8bbf\u95ee\u7f51\u7ad9\u8fdb\u884c\u767b\u5f55\uff0c\u751a\u81f3\u5176\u8fd8\u6709 Chrome\uff0cFirefox\uff0cOpera\uff0cEdge\u7b49\u8fd1\u5341\u6b3e\u6d4f\u89c8\u5668\u7684\u6269\u5c55\u7a0b\u5e8f\uff0c\u8fd8\u6709\u547d\u4ee4\u884c\u7ba1\u7406\u6a21\u5f0f\uff0c\u53ef\u4ee5\u8bf4\u662f\u8986\u76d6\u5e73\u53f0\u53ca\u5176\u5168\u9762\u7684\u8f6f\u4ef6\u4e86\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\"\"
\n\u672c\u6587\u5e72\u8d27\u541b\u4f7f\u7528\u670d\u52a1\u5668\u642d\u5efa\u4e00\u6b3e\u6570\u636e\u5728\u81ea\u5df1\u670d\u52a1\u5668\u4e0a\u7684Bitwarden\u5bc6\u7801\u7ba1\u7406\u5668\u3002<\/p>\n

\u90e8\u7f72\u73af\u5883\u4e3aubuntu\uff0c\u4f7f\u7528docker\u8fd0\u884cbitwarden_rs\u670d\u52a1\u3002bitwarden_rs\u662f\u7b2c\u4e09\u65b9\u5f00\u53d1\u8005\u4f7f\u7528Rust\u8bed\u8a00\u7f16\u5199\u7684\u5ba2\u6237\u7aef\uff0c\u4e0e\u5b98\u65b9\u5ba2\u6237\u7aef\u7684API\u76f8\u4e92\u517c\u5bb9\uff0c\u5e76\u4e14\u66f4\u52a0\u8f7b\u91cf\u7ea7\u3002<\/p>\n

https:\/\/github.com\/dani-garcia\/vaultwarden<\/pre>\n
\u4e00\u3001\u5b89\u88c5docker<\/strong><\/div>\n

\u7b80\u5355\u5b89\u88c5\u6cd5\uff1a<\/p>\n

sudo apt install docker.io<\/pre>\n

\u67e5\u770bdocker\u662f\u5426\u5b89\u88c5\u6210\u529f<\/p>\n

docker -v<\/pre>\n

\u542f\u52a8docker<\/p>\n

sudo systemctl start docker<\/pre>\n

\u8bbe\u7f6edocker\u670d\u52a1\u5f00\u673a\u81ea\u542f\u52a8<\/p>\n

sudo systemctl enable docker<\/pre>\n

\u56fd\u5185\u670d\u52a1\u5668\u5efa\u8bae\u914d\u7f6e\u955c\u50cf\u52a0\u901f\u5668<\/p>\n

\u4e8c\u3001\u90e8\u7f72bitwarden_rs<\/strong><\/div>\n

bitwarden_rs\u662f\u7531rust\u7f16\u5199\u7684\u975e\u5b98\u65b9\u5ba2\u6237\u7aef\uff0c\u4f18\u70b9\u662f\u5185\u5b58\u5360\u7528\u5c0f\uff0c\u548c\u5b98\u65b9\u517c\u5bb9\u6027\u9ad8\u3002 \u4ed3\u5e93\uff1ahttps:\/\/github.com\/dani-garcia\/bitwarden_rs<\/p>\n

\u4f7f\u7528Docker\u62c9\u53d6bitwarden_rs\u955c\u50cf<\/p>\n

docker pull bitwardenrs\/server:latest<\/pre>\n

\u8fd0\u884c \u5176\u4e2dbw-data\u4e3a\u6301\u4e45\u5316\u4fdd\u5b58\u7684\u6570\u636e\uff1a\u7f51\u7ad9\u56fe\u6807\u7f13\u5b58\u3001\u5bc6\u94a5\u548c\u6570\u636e\u5e93\u6587\u4ef6\uff0c\u60a8\u53ef\u4ee5\u6839\u636e\u81ea\u5df1\u7684\u9700\u8981\u8c03\u6574\u8def\u5f84\u3002<\/p>\n

docker run -d --name bitwarden -v \/bw-data\/:\/data\/ -p 8800:80 bitwardenrs\/server:latest<\/pre>\n

#\u5176\u4ed6\u914d\u7f6e
\n\u7981\u7528\u65b0\u7528\u6237\u6ce8\u518c<\/p>\n

docker run -d --name bitwarden \\\r\n  -e SIGNUPS_ALLOWED=false \\\r\n  -v \/bw-data\/:\/data\/ \\\r\n  -p 8800:80 \\\r\n  bitwardenrs\/server:latest<\/pre>\n

\u7981\u7528\u9080\u8bf7 \u5373\u4f7f\u7981\u7528\u6ce8\u518c\uff0c\u7ec4\u7ec7\u7ba1\u7406\u5458\u6216\u6240\u6709\u8005\u4e5f\u53ef\u4ee5\u9080\u8bf7\u7528\u6237\u52a0\u5165\u7ec4\u7ec7\u3002\u53d7\u9080\u8bf7\u540e\uff0c\u5373\u4f7fSIGNUPS_ALLOWED\u5b9e\u9645\u4e0a\u8bbe\u7f6e\u4e3a\uff0c\u4ed6\u4eec\u4e5f\u53ef\u4ee5\u5411\u53d7\u9080\u8bf7\u7684\u7535\u5b50\u90ae\u4ef6\u6ce8\u518cfalse\u3002\u60a8\u53ef\u4ee5\u901a\u8fc7\u5c06INVITATIONS_ALLOWEDenv\u53d8\u91cf\u8bbe\u7f6e\u4e3a\u6765\u5b8c\u5168\u7981\u7528\u6b64\u529f\u80fdfalse\uff1a<\/p>\n

docker run -d --name bitwarden \\\r\n  -e SIGNUPS_ALLOWED=false \\\r\n  -e INVITATIONS_ALLOWED=false \\\r\n  -v \/bw-data\/:\/data\/ \\\r\n  -p 8800:80 \\\r\n  bitwardenrs\/server:latest<\/pre>\n

\u542f\u52a8\u7ba1\u7406\u5458\u9875\u9762 https:\/\/github.com\/dani-garcia\/bitwarden_rs\/wiki<\/p>\n

\u4e09\u3001\u5b89\u88c5nginx\u505a\u53cd\u5411\u4ee3\u7406\u4e0e\u652f\u6301ssl<\/strong><\/div>\n

\u5b89\u88c5nginx<\/p>\n

sudo apt install nginx<\/pre>\n

\u4fee\u6539\u914d\u7f6e\u6587\u4ef6\u5f00\u542fssl\u4e0e\u53cd\u5411\u4ee3\u7406\uff0c\u5728\/etc\/nginx\/conf.d\u4e0b\u6dfb\u52a0\u914d\u7f6e\u6587\u4ef6youdomain.com.conf\uff0cyoudomain.com\u4e3a\u7528\u6765\u8bbf\u95ee\u7684\u57df\u540d\u3002<\/p>\n

\u6587\u4ef6\u5185\u5bb9\uff1a<\/p>\n

server\r\n    {\r\n        listen 80;\r\n        #listen [::]:80;\r\n        server_name youdomain.com;            #\u628ayoudomain.com\u4fee\u6539\u4e3a\u7528\u6765\u8bbf\u95ee\u7684\u57df\u540d\r\n\t\trewrite ^\/(.*) https:\/\/$server_name\/$1 permanent;\r\n    }\r\n\r\nserver\r\n    {\r\n        listen 443 ssl http2;\r\n        #listen [::]:443 ssl http2;\r\n        server_name youdomain.com;            #\u628ayoudomain.com\u4fee\u6539\u4e3a\u7528\u6765\u8bbf\u95ee\u7684\u57df\u540d\r\n        \r\n        location \/ {\r\n            proxy_pass http:\/\/127.0.0.1:8000;\r\n            proxy_set_header Host $host;\r\n            proxy_set_header X-Real-IP $remote_addr;\r\n            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\r\n            proxy_set_header X-Forwarded-Proto $scheme;\r\n        }\r\n  \r\n        location \/notifications\/hub {\r\n            proxy_pass http:\/\/127.0.0.1:3012;\r\n            proxy_set_header Upgrade $http_upgrade;\r\n            proxy_set_header Connection \"upgrade\";\r\n        }\r\n  \r\n        location \/notifications\/hub\/negotiate {\r\n            proxy_pass http:\/\/127.0.0.1:8000;\r\n        }\r\n        # \u52a0\u5165robots.txt \u9632\u6b62\u641c\u7d22\u5f15\u64ce\u722c\u866b\u6293\u53d6\r\n        location = \/robots.txt {\r\n            root \/home\/wwwroot\/Bitwarden;\r\n        }\r\n  }<\/pre>\n

\u5728vhost\u76ee\u5f55\/home\/wwwroot\/Bitwarden\u521b\u5efa\u4e00\u4e2arobots.txt \u6587\u4ef6\uff0c\u5199\u5165\u4ee5\u4e0b\u5185\u5bb9\u7981\u6b62\u641c\u7d22\u5f15\u64ce\u722c\u866b\u6293\u53d6<\/p>\n

User-agent: *\r\nDisallow: \/<\/pre>\n

\u91cd\u542fnginx<\/p>\n

service nginx restart<\/pre>\n
\u56db\u3001\u5907\u4efd\u6570\u636e<\/strong><\/div>\n

\u6570\u636e\u65e0\u4ef7,\u8bbe\u7f6e\u5b9a\u65f6\u5907\u4efd\u6570\u636e\u5e93\u3002bitwarden-rs\u7684\u6570\u636e\u5e93\u5728\/bw-data\u76ee\u5f55\uff0c\u91cc\u9762\u8fd8\u6709\u5bc6\u94a5\u6587\u4ef6\u548c\u7f51\u7ad9\u56fe\u6807\u7f13\u5b58\uff0c\u8fd9\u4e9b\u90fd\u662f\u53ef\u9009\u7684\uff0c\u4ee5\u4e0b\u811a\u672c\u53ea\u5907\u4efd\u6570\u636e\u5e93\u3002<\/p>\n

#!\/bin\/bash\r\n# https:\/\/gist.github.com\/vitobotta\/3a6c53c3693ff77cd0c920d0a541622d#file-bitwarden_rs-backup-sh-L25\r\nexport LC_ALL=C\r\n\r\nnow=$(date +\"%Y%m%d-%H%M%S\")\r\nparent_dir=\"\/home\/\/bitwarden\/bw-data\"\r\nbackups_dir=\"${parent_dir}\/backups\"\r\nlog_file=\"${backups_dir}\/backup-progress.log.${now}\"\r\ntmp_sqlite_backup=\"backups\/db.sqlite3.${now}\"\r\narchive=\"backups\/backup.tar.gz.${now}\"\r\n\r\nerror () {\r\n  printf \"%s: %s\\n\" \"$(basename \"${BASH_SOURCE}\")\" \"${1}\" >&2\r\n  exit 1\r\n}\r\n\r\ntrap 'error \"An unexpected error occurred.\"' ERR\r\n\r\ntake_backup () {\r\n  cd \"${parent_dir}\"\r\n  \r\n  sqlite3 db.sqlite3 \".backup '${tmp_sqlite_backup}'\"\r\n  \/bin\/tar czf \"${archive}\" \"${tmp_sqlite_backup}\" attachments\r\n\r\n  rm \"${tmp_sqlite_backup}\"\r\n\r\n  find \"${backups_dir}\/\" -type f -mtime +30 -exec rm {} \\;\r\n}\r\n\r\nprintf \"\\n=======================================================================\"\r\nprintf \"\\nBitwarden Backup\"\r\nprintf \"\\n=======================================================================\"\r\nprintf \"\\nBackup in progress...\"\r\n\r\ntake_backup 2> \"${log_file}\"\r\n\r\nif [[ -s \"${log_file}\" ]]\r\nthen\r\n  printf \"\\nBackup failure! Check ${log_file} for more information.\"\r\n  printf \"\\n=======================================================================\\n\\n\"\r\nelse\r\n  rm \"${log_file}\"\r\n  printf \"...SUCCESS!\\n\"\r\n  printf \"Backup created at ${backups_dir}\/backup.tar.gz.${now}\"\r\n  printf \"\\n=======================================================================\\n\\n\"\r\nfi<\/pre>\n

\u8bbe\u7f6e\u5b9a\u65f6\u4efb\u52a1\uff0c\u4fee\u6539\u6587\u4ef6 \/etc\/crontab\u63d2\u5165\u4e00\u4e0b\u5185\u5bb9<\/p>\n

00 1    * * *   root   \/home\/\/bitwarden\/bw-data\/backups\/bitwarden_rs-backup.sh<\/pre>\n

\u4ee5\u4e0a\u8868\u793a\uff0c\u6bcf\u5929\u51cc\u6668 1 \uff0croot \u7528\u6237\u6267\u884c\u4e00\u6b21 bitwarden_rs-backup.sh \u811a\u672c\u3002
\n\u540e\u671f\u52a0\u90ae\u4ef6\u63d0\u9192<\/p>\n

\u6ce8\u518c\u5b8c\u8d26\u53f7\u540e\uff0c\u628aSIGNUPS_ALLOWED\u9009\u9879\u6539\u6210fale\u91cd\u542f\u5b9e\u4f8b\u5173\u95ed\u6ce8\u518c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

\u672c\u6587\u5e72\u8d27\u541b\u4f7f\u7528\u670d\u52a1\u5668\u642d\u5efa\u4e00\u6b3e\u6570\u636e\u5728\u81ea\u5df1\u670d\u52a1\u5668\u4e0a\u7684Bitwarden\u5bc6\u7801\u7ba1\u7406\u5668\u3002 \u90e8\u7f72\u73af\u5883\u4e3aubuntu\uff0c\u4f7f\u7528d […]<\/p>\n","protected":false},"author":1469,"featured_media":262102,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-262097","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/262097","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1469"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=262097"}],"version-history":[{"count":4,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/262097\/revisions"}],"predecessor-version":[{"id":262103,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/262097\/revisions\/262103"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/262102"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=262097"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=262097"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=262097"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}