install.fairie/home/private_dot_ssh/system/run_onchange_after_sshd.tmpl
Brian Zalewski 9de3b66c56 Update 55 files
- /home/dot_gnupg/public/0xF0A300E4199A1C33.sig
- /home/dot_gnupg/public/apt.hashicorp.sig
- /home/dot_gnupg/public/linux.wazuh.sig
- /home/dot_gnupg/public/qubes.uman.sig
- /home/dot_ssh/authorized_keys.github.tmpl
- /home/dot_ssh/endlessh/config.tmpl
- /home/dot_ssh/endlessh/run_onchange_after_endlessh.tmpl
- /home/dot_ssh/fail2ban/jail.local.tmpl
- /home/dot_ssh/fail2ban/run_onchange_after_fail2ban.tmpl
- /home/dot_ssh/private_config.tmpl
- /home/dot_ssh/private_id_rsa.tmpl
- /home/dot_ssh/private_ssh-audi.tmpl
- /home/dot_ssh/private_ssh-blue.tmpl
- /home/dot_ssh/private_ssh-fiat.tmpl
- /home/dot_ssh/private_ssh-honda.tmpl
- /home/dot_ssh/private_ssh-lab.pub.tmpl
- /home/dot_ssh/private_ssh-lab.tmpl
- /home/dot_ssh/private_ssh-mini.tmpl
- /home/dot_ssh/private_ssh-red.tmpl
- /home/dot_ssh/private_ssh-yellow.tmpl
- /home/dot_ssh/run_onchanges_after_ensure-private-key.tmpl
- /home/dot_ssh/run_onchanges_after_generate-public-keys.tmpl
- /home/dot_ssh/ssh-authorized_keys.yubikey.tmpl
- /home/dot_ssh/symlink_authorized_keys.tmpl
- /home/dot_ssh/system/banner
- /home/dot_ssh/system/run_onchange_after_sshd.tmpl
- /home/dot_ssh/system/sshd_config.tmpl
- /home/private_dot_gnupg/public/linux.wazuh.sig
- /home/private_dot_gnupg/public/0xF0A300E4199A1C33.sig
- /home/private_dot_gnupg/public/qubes.uman.sig
- /home/private_dot_gnupg/public/apt.hashicorp.sig
- /home/private_dot_ssh/endlessh/config.tmpl
- /home/private_dot_ssh/endlessh/run_onchange_after_endlessh.tmpl
- /home/private_dot_ssh/fail2ban/jail.local.tmpl
- /home/private_dot_ssh/fail2ban/run_onchange_after_fail2ban.tmpl
- /home/private_dot_ssh/system/banner
- /home/private_dot_ssh/system/run_onchange_after_sshd.tmpl
- /home/private_dot_ssh/system/sshd_config.tmpl
- /home/private_dot_ssh/private_ssh-mini.tmpl
- /home/private_dot_ssh/symlink_authorized_keys.tmpl
- /home/private_dot_ssh/private_ssh-audi.tmpl
- /home/private_dot_ssh/private_ssh-lab.pub.tmpl
- /home/private_dot_ssh/private_ssh-yellow.tmpl
- /home/private_dot_ssh/private_config.tmpl
- /home/private_dot_ssh/run_onchanges_after_generate-public-keys.tmpl
- /home/private_dot_ssh/private_ssh-fiat.tmpl
- /home/private_dot_ssh/private_ssh-blue.tmpl
- /home/private_dot_ssh/private_ssh-red.tmpl
- /home/private_dot_ssh/ssh-authorized_keys.yubikey.tmpl
- /home/private_dot_ssh/private_ssh-honda.tmpl
- /home/private_dot_ssh/authorized_keys.github.tmpl
- /home/private_dot_ssh/private_id_rsa.tmpl
- /home/private_dot_ssh/run_onchanges_after_ensure-private-key.tmpl
- /home/private_dot_ssh/private_ssh-lab.tmpl
- /home/.chezmoiscripts/universal/run_onchange_before_91-configure-gpg.tmpl
2023-02-01 16:40:47 +00:00

40 lines
1.5 KiB
Cheetah

{{- if ne .host.distro.family "windows" }}
#!/usr/bin/env bash
# sshd_config hash: {{ include (joinPath .host.home ".ssh" "system" "sshd_config") | sha256sum }}
# banner hash: {{ include (joinPath .host.home ".ssh" "system" "banner") | sha256sum }}
{{ includeTemplate "universal/profile" }}
{{ includeTemplate "universal/logg" }}
### Update /etc/ssh/sshd_config if environment is not WSL
if [[ ! "$(grep Microsoft /proc/version)" ]]; then
if [ -d /etc/ssh ]; then
logg info 'Copying ~/.ssh/system/banner to /etc/ssh/banner'
sudo cp -f "$HOME/.ssh/system/banner" /etc/ssh/banner
logg info 'Copying ~/.ssh/system/sshd_config to /etc/ssh/sshd_config'
sudo cp -f "$HOME/.ssh/system/sshd_config" /etc/ssh/sshd_config
### Restart SSH server
if [ -d /Applications ] && [ -d /System ]; then
# macOS
logg info 'Running `sudo launchctl stop com.openssh.sshd`'
sudo launchctl stop com.openssh.sshd
logg info 'Running `sudo launchctl start com.openssh.sshd`'
sudo launchctl start com.openssh.sshd
else
# Linux
logg info 'Enabling the `sshd` service'
sudo systemctl enable sshd
logg info 'Restarting the `sshd` service'
sudo systemctl restart sshd
fi
else
logg warn 'The /etc/ssh folder does not exist'
fi
else
logg info 'Skipping sshd_config application since environment is WSL'
fi
{{ end -}}