Hi Guys,
I’m currently setting up OpenVPN as a client in NixOS and want to avoid hardcoding credentials in my configuration or storing them in plaintext files.
My goal is to dynamically provide auth-user-pass to OpenVPN in a secure, declarative way, ideally using pass (Password Store) or another encrypted secret manager.
I’m using a similiar approach with himalaya for email:
in my himalaya/config.toml:
backend.auth.type = “password”
backend.auth.command = “pass show Email/posteo-himalaya”
so if I login, I get asked for my gpg-key password and then the passwort gets returned.
Is there a similiar possibility for the configuration of openvpn. I know the passwort + username is needed at build time.
Current Setup
- I have an
.ovpnfile (e.g.,xeovo-de-udp.ovpn) with:
auth-user-pass /path/to/vpn-auth.txt
- The credentials are currently stored in a plaintext file (
vpn-auth.txt), which is not ideal for security.
Desired Solution
I want to:
- Avoid hardcoding paths like
/home/user/nixos/vpn/vpn-auth.txtin myconfiguration.nix. - Avoid plaintext credentials in files or the Nix store (unless encrypted).
- Fetch credentials at build time (e.g., from
pass,sops, orage). - Keep the solution declarative (no
systemdhacks).