Compare commits

..

No commits in common. "1a78e2b1f0e9b895ca000b4c5dbe7c38ca6cb45f" and "caebd6e24187e5f699979424c104a0b9abda9e63" have entirely different histories.

2 changed files with 10 additions and 17 deletions

View file

@ -15,8 +15,8 @@
services = {
nebula = {
publicKeyFile = toString ./keys/nebula.pub;
certificateFile = toString ./keys/nebula.crt;
publicKeyFile = ./keys/nebula.pub;
certificateFile = ./keys/nebula.crt;
};
syncthing = {

View file

@ -7,16 +7,16 @@
text = ''
if [[ $# -lt 1 ]] || [[ $# -gt 2 ]]; then
echo "Usage: $0 <hostname> [<ca-key-path>]"
echo "Usage: $0 <host> [<ca-key-path>]"
exit 1
fi
hostname="$1"
address="$(nix eval --raw ".#allHosts.$hostname.config.custom.networking.overlay.cidr")"
groups="$(nix eval --raw ".#allHosts.$hostname.config.custom.services.nebula.groups" --apply 'builtins.concatStringsSep ","')"
ca_cert="$(nix eval --raw ".#allHosts.$hostname.config.custom.services.nebula.caCertificateFile")"
host_pub="$(nix eval --raw ".#allHosts.$hostname.config.custom.services.nebula.publicKeyFile")"
host_cert="$(nix eval --raw ".#allHosts.$hostname.config.custom.services.nebula.certificateFile")"
host="$1"
address="$(nix eval --raw ".#allHosts.$host.config.custom.networking.overlay.cidr")"
groups="$(nix eval --raw ".#allHosts.$host.config.custom.services.nebula.groups" --apply 'builtins.concatStringsSep ","')"
ca_cert='modules/system/services/nebula/ca.crt'
host_pub="$(nix eval --raw ".#allHosts.$host.config.custom.services.nebula.publicKeyFile")"
host_cert="$(nix eval --raw ".#allHosts.$host.config.custom.services.nebula.certificateFile")"
host_cert="''${host_cert#*-source/}"
if [[ $# -eq 2 ]]; then
@ -34,13 +34,6 @@
fi
rm -f "$host_cert"
nebula-cert sign \
-name "$hostname" \
-networks "$address" \
-groups "$groups" \
-ca-crt "$ca_cert" \
-ca-key "$ca_key" \
-in-pub "$host_pub" \
-out-crt "$host_cert"
nebula-cert sign -name "$host" -networks "$address" -groups "$groups" -ca-crt "$ca_cert" -ca-key "$ca_key" -in-pub "$host_pub" -out-crt "$host_cert"
'';
}