refactor!: rename bitwarden -> vaultwarden

Was renamed upstream, in NixOS 21.11.
This commit is contained in:
Henrik Lissner 2021-08-09 11:18:25 -04:00
parent 0986d3ceab
commit 327b113a07
14 changed files with 45 additions and 45 deletions

View file

@ -1,7 +1,7 @@
#!/usr/bin/env cached-nix-shell
#! nix-shell -p ruby_2_7 -i "ruby -S"
# A rofi client for bitwarden. Similar to passmenu, but uses rofi. (Badly)
# A rofi client for vaultwarden. Similar to passmenu, but uses rofi. (Badly)
# written in ruby because data persistence and frontend logic would be a pain to
# write in bash or zsh. I'll refactor this later perhaps. Maybe.
@ -91,7 +91,7 @@ module BW
end
def self.notify message, title: nil, urgency: "normal"
sh 'notify-send', '-u', urgency, '-a', "Bitwarden", *[title, message].compact
sh 'notify-send', '-u', urgency, '-a', "Vaultwarden", *[title, message].compact
end
def self.error message
@ -209,7 +209,7 @@ module BW
when true
return data[0][1]
end
rofi rofiData.merge(data.to_h), '-p', 'Bitwarden', '-filter', (query || "")
rofi rofiData.merge(data.to_h), '-p', 'Vaultwarden', '-filter', (query || "")
end
def show_item item, field: nil

View file

@ -70,7 +70,7 @@ config.bind('<Ctrl+E>', 'edit-text', mode='insert')
config.bind('<Ctrl+E>', 'hint inputs --first ;; edit-text', mode='normal')
config.bind('<Shift+Ins>', 'fake-key <Ctrl+V>', mode='insert')
# Bitwarden integration
# Vaultwarden integration
config.bind(";pp", 'spawn -u qute-bwmenu')
config.bind(";pu", 'spawn -u qute-bwmenu --field username')
config.bind(";ps", 'spawn -u qute-bwmenu --field password')

View file

@ -11,7 +11,7 @@ with lib.my;
./modules/backup.nix
./modules/gitea.nix
./modules/bitwarden.nix
./modules/vaultwarden.nix
];

View file

@ -1,13 +1,13 @@
{ config, lib, pkgs, ... }:
{
services.bitwarden_rs.backupDir = "/backups/bitwarden_rs";
services.vaultwarden.backupDir = "/backups/vaultwarden";
services.gitea.dump.enable = true;
services.gitea.dump.backupDir = "/backups/gitea";
system.activationScripts.createBackupDir = ''
mkdir -m 750 -p "${config.services.bitwarden_rs.backupDir}" || true
mkdir -m 750 -p "${config.services.vaultwarden.backupDir}" || true
mkdir -m 750 -p "${config.services.gitea.dump.backupDir}" || true
chown bitwarden_rs:bitwarden_rs "${config.services.bitwarden_rs.backupDir}"
chown vaultwarden:vaultwarden "${config.services.vaultwarden.backupDir}"
chown git:gitea "${config.services.gitea.dump.backupDir}"
'';

View file

@ -1,9 +1,9 @@
{ config, lib, ... }:
{
modules.services.bitwarden.enable = true;
modules.services.vaultwarden.enable = true;
services.bitwarden_rs.config = {
services.vaultwarden.config = {
signupsAllowed = false;
invitationsAllowed = true;
domain = "https://p.v0.io";
@ -11,8 +11,8 @@
};
# Inject secrets at runtime
systemd.services.bitwarden_rs.serviceConfig = {
EnvironmentFile = [ config.age.secrets.bitwarden-smtp-env.path ];
systemd.services.vaultwarden.serviceConfig = {
EnvironmentFile = [ config.age.secrets.vaultwarden-smtp-env.path ];
Restart = "on-failure";
RestartSec = "2s";
};

View file

@ -1,5 +1,5 @@
let key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINd+4ijlEHI98NLpgP/El73BmpBUfzka9ovdt8FoaVAG hlissner@home";
in {
"bitwarden-smtp-env.age".publicKeys = [key];
"vaultwarden-smtp-env.age".publicKeys = [key];
"gitea-smtp.age".publicKeys = [key];
}

View file

@ -26,8 +26,8 @@ with lib;
longitude = 12.5;
} else {});
# So thw bitwarden CLI knows where to find my server.
modules.shell.bitwarden.config.server = "p.v0.io";
# So the vaultwarden CLI knows where to find my server.
modules.shell.vaultwarden.config.server = "p.v0.io";
## Not using syncthing atm

View file

@ -54,7 +54,7 @@
};
shell = {
adl.enable = true;
bitwarden.enable = true;
vaultwarden.enable = true;
direnv.enable = true;
git.enable = true;
gnupg.enable = true;

View file

@ -41,7 +41,7 @@
};
dev = {};
shell = {
bitwarden.enable = true;
vaultwarden.enable = true;
direnv.enable = true;
git.enable = true;
gnupg.enable = true;

View file

@ -1,23 +0,0 @@
{ options, config, lib, pkgs, ... }:
with lib;
with lib.my;
let cfg = config.modules.services.bitwarden;
in {
options.modules.services.bitwarden = {
enable = mkBoolOpt false;
};
config = mkIf cfg.enable {
services.bitwarden_rs.enable = true;
user.extraGroups = [ "bitwarden_rs" ];
services.fail2ban.jails.bitwarden_rs = ''
enabled = true
filter = bitwarden_rs
port = 80,443,8002
maxretry = 5
'';
};
}

View file

@ -27,14 +27,14 @@ in {
# Extra filters
environment.etc = {
"fail2ban/filter.d/bitwarden_rs.conf".text = ''
"fail2ban/filter.d/vaultwarden.conf".text = ''
[INCLUDES]
before = common.conf
[Definition]
failregex = ^.*Username or password is incorrect\. Try again\. IP: <ADDR>\. Username:.*$
ignoreregex =
journalmatch = _SYSTEMD_UNIT=bitwarden_rs.service
journalmatch = _SYSTEMD_UNIT=vaultwarden.service
'';
"fail2ban/filter.d/gitea.conf".text = ''
[Definition]

View file

@ -0,0 +1,23 @@
{ options, config, lib, pkgs, ... }:
with lib;
with lib.my;
let cfg = config.modules.services.vaultwarden;
in {
options.modules.services.vaultwarden = {
enable = mkBoolOpt false;
};
config = mkIf cfg.enable {
services.vaultwarden.enable = true;
user.extraGroups = [ "vaultwarden" ];
services.fail2ban.jails.vaultwarden = ''
enabled = true
filter = vaultwarden
port = 80,443,8002
maxretry = 5
'';
};
}

View file

@ -2,9 +2,9 @@
with lib;
with lib.my;
let cfg = config.modules.shell.bitwarden;
let cfg = config.modules.shell.vaultwarden;
in {
options.modules.shell.bitwarden = with types; {
options.modules.shell.vaultwarden = with types; {
enable = mkBoolOpt false;
config = mkOpt attrs {};
};
@ -17,7 +17,7 @@ in {
modules.shell.zsh.rcInit = "_cache bw completion --shell zsh; compdef _bw bw;";
system.userActivationScripts = mkIf (cfg.config != {}) {
initBitwarden = ''
initVaultwarden = ''
${concatStringsSep "\n" (mapAttrsToList (n: v: "bw config ${n} ${v}") cfg.config)}
'';
};