一、搭建服务端

    1. 需要一台服务器,搭建宝塔面板
    2. 安装Docker,并在线上镜像搜索“vaultwarden/server”,或Github下载Vaultwarden
    3. 按下方配置创建容器
      <span style="font-family: AlibabaPuHuiTi;">标签:
      org.opencontainers.image.created=2023-11-19T22:54:18+00:00
      org.opencontainers.image.description=Unofficial Bitwarden compatible server written in Rust - 1.30.1
      org.opencontainers.image.documentation=https://github.com/dani-garcia/vaultwarden/wiki
      org.opencontainers.image.licenses=AGPL-3.0-only
      org.opencontainers.image.revision=48836501bf348386d9bb1378fb56db33c19d3732
      org.opencontainers.image.source=https://github.com/dani-garcia/vaultwarden
      org.opencontainers.image.url=https://github.com/dani-garcia/vaultwarden
      org.opencontainers.image.version=1.30.1
      
      环境变量:
      ADMIN_TOKEN=自己设置主密码
      PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
      ROCKET_PROFILE=release
      ROCKET_ADDRESS=0.0.0.0
      ROCKET_PORT=80
      DEBIAN_FRONTEND=noninteractive
      
      其他环境变量:
      # 禁用新用户注册
      SIGNUPS_ALLOWED=false
      # 禁用邀请
      INVITATIONS_ALLOWED=false
      # 启用日志记录
      LOG_FILE=/data/bitwarden.log
      # 启用管理页面
      ADMIN_TOKEN=some_random_token_as_per_above_explanation
      # 这里的 some_random_token_as_per_above_explanation 为你自定义的一串任意字符</span>
    4. 通过IP+本地端口可访问后台页面,如服务器绑定了域名,可通过域名+本地端口访问
    5. 管理员后台地址:https://域名:端口/admin

二、配置前端

    1. 安装Bitwarden软件:官网下载
    2. 选择“自托管”> 服务器URL输入Vaultwarden服务器的地址
    3. 输入后台创建的账号密码登录
    4. 设置中“默认URL匹配检测”选择为“主机”

三、使用说明

    1. URI匹配检测
      • 基础域:基于URI的顶级域名和二级域名进行匹配,基本域匹配可用于任何国家/地区代码顶级域;
        如果URI:https://google.com 使用基本域匹配检测

        网址 是否匹配
        https://google.com/
        https://accounts.google.com/
        https://google.net/ ×
        http://yahoo.com/ ×
      • 主机:基于URI的主机名和端口(如果指定)进行匹配;
        如果URI:https://sub.bitwarden.domain.com:4000 使用主机匹配检测

        网址 是否匹配
        http://sub.bitwarden.domain.com:4000/
        https://sub.bitwarden.domain.com:4000/page.html
        htttps://bitwarden.domain.com ×
        https://sub.bitwarden.domain.com ×
        https://sub2.sub.bitwarden.domain.com:4000 ×
        https://sub.bitwarden.domain.com:5000 ×
      • 开始于:基于URI开头匹配,不管URI后面的路径是什么;
        如果URI:https://sub.bitwarden.domain.com/path/ 使用从匹配检测开始

        网址 是否匹配
        https://sub.bitwarden.domain.com/path/
        https://sub.bitwarden.domain.com/path/page.html
        https://sub.bitwarden.domain.com ×
        https://sub.bitwarden.domain.com:4000/path/page.html
        (被端口中断)
        ×
        https://sub.bitwarden.domain.com/path
        (缺少尾部斜杠)
        ×
      • 正则表达式:基于正则表达式匹配,正则表达式始终不区分大小写;
        如果URI:^https://[a-z]+\.wikipedia\.org/w/index\.php 使用正则表达式匹配检测:

        网址 是否匹配
        https://en.wikipedia.org/w/index.php?title=Special:UserLogin&returnto=Bitwarden
        https://pl.wikipedia.org/w/index.php?title=Specjalna:Zaloguj&returnto=Bitwarden
        https://en.wikipedia.org/w/index.php
        https://malicious-site.com ×
        https://en.wikipedia.org/wiki/Bitwarden ×
      • 精确:URL必须完全匹配;
        如果URI:https://www.google.com/page.html 使用完全匹配检测:

        网址 是否匹配
        https://www.google.com/page.html
        http://www.google.com/page.html ×
        https://www.google.com/page.html?query=123 ×
        https://www.google.com ×