diff --git a/config/update-ssh-keys.service b/config/update-ssh-keys.service new file mode 100644 index 0000000..65f2ccf --- /dev/null +++ b/config/update-ssh-keys.service @@ -0,0 +1,7 @@ +[Unit] +Description=Update SSH authorized_keys from Git +After=network.target + +[Service] +User=root +ExecStart=/usr/bin/update-ssh-keys.sh diff --git a/config/update-ssh-keys.timer b/config/update-ssh-keys.timer new file mode 100644 index 0000000..e2f3c3b --- /dev/null +++ b/config/update-ssh-keys.timer @@ -0,0 +1,11 @@ +[Unit] +Description=Run update-ssh-keys script every 10 minutes + +[Timer] +OnBootSec=5m +OnUnitActiveSec=10m +Unit=update-ssh-keys.service + +[Install] +WantedBy=timers.target + diff --git a/install.sh b/install.sh index fcb997f..475ae82 100755 --- a/install.sh +++ b/install.sh @@ -18,4 +18,8 @@ systemctl restart sshd echo "SSH je nyní nastaveno pouze pro přihlašování pomocí klíčů." - +cp ./update-ssh-keys.sh /usr/bin/update-ssh-keys.sh +cp ./config/update-ssh-keys.service /etc/systemd/system/update-ssh-keys.service +cp ./config/update-ssh-keys.timer /etc/systemd/system/update-ssh-keys.timer +systemctl daemon-reload +systemctl enable --now update-ssh-keys.timer