sops nix configured
This commit is contained in:
parent
3d0bd56fe8
commit
db022df80b
9 changed files with 143 additions and 27 deletions
|
|
@ -1,13 +1,20 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
sops = {
|
||||
secrets.awg0-spec = {};
|
||||
templates.awg0-conf.content = ''
|
||||
${config.sops.placeholder.awg-obf}
|
||||
${config.sops.placeholder.awg0-spec}
|
||||
'';
|
||||
};
|
||||
systemd.services.vps-init = {
|
||||
path = [ pkgs.openssh ];
|
||||
serviceConfig.Type = "oneshot";
|
||||
script = ''
|
||||
cd /secrets/awg
|
||||
cd /root/run/awg
|
||||
date +%s > start-time
|
||||
. vps-init.env
|
||||
scp -i /root/.ssh/vps 0.conf $SSHCONN:
|
||||
scp -i /root/.ssh/vps ${config.sops.templates.awg0-conf.path} $SSHCONN:awg0.conf
|
||||
until cat <<'EOF' | ssh -i /root/.ssh/vps $SSHCONN
|
||||
set -e
|
||||
if [ ! -e ~/vps-init-state ]; then
|
||||
|
|
@ -63,11 +70,12 @@
|
|||
export DEBIAN_FRONTEND=noninteractive
|
||||
add-apt-repository -y ppa:amnezia/ppa
|
||||
apt-get install -y gnupg2 amneziawg amneziawg-tools iptables-persistent python3-launchpadlib linux-headers-$(uname -r) software-properties-common
|
||||
mv ~/0.conf /etc/amnezia/amneziawg/awg0.conf
|
||||
mv ~/awg0.conf /etc/amnezia/amneziawg
|
||||
systemctl enable awg-quick@awg0
|
||||
apt-get autoremove --purge -y
|
||||
apt-get clean;;
|
||||
2)
|
||||
rm -f awg0.conf
|
||||
exit;;
|
||||
esac
|
||||
echo "$((1+$(cat ~/vps-init-state)))" > ~/vps-init-state
|
||||
|
|
@ -76,7 +84,6 @@
|
|||
EOF
|
||||
do sleep 1; done
|
||||
echo Installed in $(($(date +%s)-$(cat start-time)))s
|
||||
rm start-time
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue