Add ssh external

This commit is contained in:
pgrondek 2021-02-24 02:53:29 +01:00
parent 79497476c2
commit 925289b675
5 changed files with 75 additions and 1 deletions

View File

@ -1 +1,2 @@
node-02 IPaddr::192.168.50.100/24/eth0:0 node-02 IPaddr::192.168.50.100/24/eth0:0
node-02 ssh-external

View File

@ -0,0 +1,28 @@
#!/usr/bin/env bash
SERVICE=sshd-external
case "$1" in
start)
systemctl start "${SERVICE}"
;;
stop)
systemctl stop "${SERVICE}"
;;
reload)
systemctl reload "${SERVICE}"
;;
force-reload)
systemctl force-reload "${SERVICE}"
;;
restart)
systemctl restart "${SERVICE}"
;;
status)
systemctl status "${SERVICE}"
;;
*)
echo "Usage: /etc/init.d/ssh {start|stop|reload|force-reload|restart|status}" || true
exit 1
;;
esac

View File

@ -0,0 +1,19 @@
[Unit]
Description=OpenBSD Secure Shell server
After=network.target auditd.service
ConditionPathExists=!/etc/ssh/sshd_not_to_be_run
[Service]
EnvironmentFile=-/etc/default/ssh
ExecStartPre=/usr/sbin/sshd -t
ExecStart=/usr/sbin/sshd -D $SSHD_OPTS -f /etc/ssh/sshd_config_external
ExecReload=/usr/sbin/sshd -t
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure
RestartPreventExitStatus=255
Type=notify
[Install]
WantedBy=multi-user.target
Alias=sshd-external.service

View File

@ -12,3 +12,5 @@
- import_tasks: hostfile.yml - import_tasks: hostfile.yml
- import_tasks: docker-watcher.yml - import_tasks: docker-watcher.yml
- import_tasks: ssh-external.yml

View File

@ -0,0 +1,24 @@
---
- become: yes
block:
- name: copy config
copy:
owner: root
group: root
mode: 0600
directory_mode: yes
src: etc/ssh
dest: /etc
- name: copy ha.d resource ssh-external
copy:
owner: root
group: root
mode: 0755
src: etc/ha.d/resource.d/ssh-external
dest: /etc/ha.d/resource.d/ssh-external
- name: add systemd service
copy:
src: lib/systemd/system/sshd-external.service
dest: /lib/systemd/system/sshd-external.service