-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated JF docs and added openssh vpn option
- Loading branch information
1 parent
81db952
commit 10c6746
Showing
2 changed files
with
48 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# TODO: Dir creation and file permissions in nix | ||
{ | ||
config, | ||
lib, | ||
... | ||
}: | ||
with lib; let | ||
cfg = config.nixarr.openssh; | ||
in { | ||
options.nixarr.openssh.vpn.enable = { | ||
type = types.bool; | ||
default = false; | ||
description = '' | ||
Run the openssh service through a vpn. | ||
**Note:** This option does _not_ enable the sshd service you still | ||
need to setup sshd in your nixos configuration, fx: | ||
```nix | ||
services.openssh = { | ||
enable = true; | ||
settings.PasswordAuthentication = false; | ||
}; | ||
users.extraUsers.username.openssh.authorizedKeys.keyFiles = [ | ||
./path/to/public/key/machine.pub} | ||
]; | ||
``` | ||
''; | ||
}; | ||
|
||
config = mkIf cfg.enable { | ||
systemd.services.openssh = mkIf (cfg.vpn.enable && config.services.openssh.enable) { | ||
bindsTo = [ "[email protected]" ]; | ||
requires = [ "network-online.target" ]; | ||
after = [ "wg.service" ]; | ||
serviceConfig = { | ||
NetworkNamespacePath = "/var/run/netns/wg"; | ||
}; | ||
}; | ||
}; | ||
} |