feat(storage01): init openbao #327
Labels
No labels
awaiting
awaiting-author
awaiting
awaiting-reviewer
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: DGNum/infrastructure#327
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "openbao"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
12c5968ea8
to3e14576e94
erreur
@ -0,0 +37,4 @@
enableACME = true;
forceSSL = true;
location."/" = {
proxyPass = "http://127.0.0.1:${toString port}";
On peut utiliser
dgn-web.simpleProxies
ici:o
3e14576e94
to56765c1a79
56765c1a79
toc9cf7dbbb4
@ -0,0 +2,4 @@
#
# SPDX-License-Identifier: EUPL-1.2
_:
Inutile
@ -0,0 +4,4 @@
_:
let
domain = "vault.dgnum.eu";
@ -0,0 +30,4 @@
'';
};
services.nginx = {
Comme dit Maurice, tout ce bloc se remplace par :
@ -0,0 +4,4 @@
{
imports = [
./module.nix
???
Si y'a rien de plus que ça met direct le module en default.nix
@ -0,0 +10,4 @@
...
}:
with lib;
Niet
@ -0,0 +14,4 @@
let
cfg = config.services.openbao;
opt = options.services.openbao;
C'est utilisé uniquement pour mettre
config.${opt.storageBackend}
à la place deconfig.storageBackend
dans le defaultText d'une option, ça peut être supprimé imo@ -0,0 +16,4 @@
cfg = config.services.openbao;
opt = options.services.openbao;
configFile = pkgs.writeText "openbao.hcl" ''
Via la documentation,
Donc on va faire du json avec
pkgs.formats.json
et faire des settings structurés c.f. la RFC42@ -0,0 +64,4 @@
services.openbao = {
enable = mkEnableOption "OpenBao daemon";
package = mkOption {
@ -0,0 +70,4 @@
description = "OpenBao package";
};
dev = mkOption {
Je pense pas qu'on en ait besoin.
Si vraiment c'est nécessaire, il y a
mkEnableOption
qui existe.@ -0,0 +78,4 @@
'';
};
devRootTokenID = mkOption {
Same as above
@ -0,0 +93,4 @@
};
tlsCertFile = mkOption {
type = types.nullOr types.str;
nullOr path
@ -0,0 +100,4 @@
};
tlsKeyFile = mkOption {
type = types.nullOr types.str;
Pareil
@ -0,0 +172,4 @@
description = "Extra text appended to {file}`vault.hcl`.";
};
extraSettingsPaths = mkOption {
Puisque la config se fera en JSON, en faisant
les secrets peuvent être indiqués dans la config avec la valeur
machin._secret = path
avecpath
qui contient le secret et ça sera remplacé comme il faut.@ -0,0 +228,4 @@
}
];
users.users.openbao = {
Pourquoi est-ce qu'on aurait besoin d'un user ? En
DynamicUser
only ça ne fonctionne pas ?@ -0,0 +236,4 @@
};
users.groups.openbao.gid = config.ids.gids.vault;
systemd.tmpfiles.rules = optional (
Ça se fait via
StateDirectory
etUMask
dans l'unit systemd@ -0,0 +252,4 @@
startLimitIntervalSec = 60;
startLimitBurst = 3;
serviceConfig = {
Pas de
DynamicUser
?@ -0,0 +255,4 @@
serviceConfig = {
User = "openbao";
Group = "openbao";
ExecStart = "${lib.getExe cfg.package} server ${configOptions}";
Et on inline
configOptions
, avec potentiellement l'ajout d'une optionextraArgs
qui y sera concaténée.@ -0,0 +256,4 @@
User = "openbao";
Group = "openbao";
ExecStart = "${lib.getExe cfg.package} server ${configOptions}";
ExecReload = "${pkgs.coreutils}/bin/kill -SIGHUP $MAINPID";
@ -0,0 +259,4 @@
ExecReload = "${pkgs.coreutils}/bin/kill -SIGHUP $MAINPID";
StateDirectory = "vault";
# In `dev` mode vault will put its token here
Environment = lib.optional cfg.dev "HOME=/var/lib/vault";
À enlever si on supprime le mode dev
@ -0,0 +48,4 @@
echo "complete -C $out/bin/openbao openbao" > openbao.bash
installShellCompletion openbao.bash
''
+ lib.optionalString stdenv.isLinux ''
À priori on n'a pas d'aarch64 qui fera tourner ça
@ -0,0 +58,4 @@
}
'';
# passthru.tests = { inherit (nixosTests) vault vault-postgresql vault-dev vault-agent; };
Inutile visiblement
c9cf7dbbb4
toded746ff59
ded746ff59
tocaa7429644
caa7429644
to0d328402df
0d328402df
tof8f5478bfb
f8f5478bfb
to302b3a1d45
302b3a1d45
to6e1927ccf6
6e1927ccf6
to15d5ff68ce
15d5ff68ce
to3b74da5a1d
@ -0,0 +8,4 @@
clusterPort = 3101;
in
{
config = {
Y'a un config en trop
@ -0,0 +14,4 @@
address = "127.0.0.1:${toString port}";
storageBackend = "raft";
listenerExtraConfig = {
Avec la modification des options ça devient :
@ -0,0 +24,4 @@
mkPackageOption
getExe'
;
Avec la liste des types que tu utilises et tu enlèves
types.
dans la définition des options.@ -0,0 +29,4 @@
cfg = config.services.openbao;
jsonFormat = pkgs.formats.json { };
@ -0,0 +72,4 @@
package = mkPackageOption pkgs "openbao" { };
address = mkOption {
À remplacer avec l'option
settings
@ -0,0 +121,4 @@
description = "The name of the type of storage backend";
};
storagePath = mkOption {
Toutes tes options jusque ligne 159 ça se remplace par (et aussi
listenerExtraOption
):Et les default sont mis dans la partie config avec des
mkDefault
c.f.74ef14eaa0/services/netbird/dashboard.nix (L95)
@ -0,0 +158,4 @@
description = "Extra text appended to {file}`vault.json`.";
};
extraSettingsPaths = mkOption {
À supprimer en rajoutant l'option
extraArgs
.@ -0,0 +215,4 @@
] ++ optional (config.services.consul.enable && cfg.storageBackend == "consul") "consul.service";
restartIfChanged = false; # do not restart on "nixos-rebuild switch". It would seal the storage and disrupt the clients.
preStart = genJqSecretsReplacementSnippet configFile "/var/lib/openbao/config.json";
@ -0,0 +222,4 @@
serviceConfig = {
DynamicUser = true;
ExecStart = escapeSystemdExecArgs [
(lib.getExe cfg.package)
Que tu inherit au début
@ -0,0 +224,4 @@
ExecStart = escapeSystemdExecArgs [
(lib.getExe cfg.package)
"server"
configOptions
Avec :
@ -0,0 +229,4 @@
ExecReload = "${getExe' pkgs.coreutils "kill"} -SIGHUP $MAINPID";
StateDirectory = "openbao";
UMask = "0700";
# In `dev` mode vault will put its token here
À supprimer
@ -37,0 +37,4 @@
# OpenBAO
(local ./nixpkgs/09-init-openbao.patch)
(local ./nixpkgs/10-bump-openbao.patch)
Comme j'ai dit dans la conv, il faut utiliser
npr
plutôt:3b74da5a1d
to0bdb227188
0bdb227188
toadbbc98d9e
adbbc98d9e
to4f711bc730
4f711bc730
toa0a229b455
a0a229b455
toa03164240e