summaryrefslogtreecommitdiff
path: root/templates/service/ssh/node.def
blob: 585357dd441c70173c2108327eb72688a3fa023a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
help: Enable/disable Secure SHell (SSH) protocol
delete:sudo /usr/sbin/invoke-rc.d ssh stop 
       sudo sh -c "echo 'SSHD_OPTS=' > /etc/default/ssh"
end: if [ -z "$VAR(port/@)" ]; then exit 0; fi;
     if [ ! -f /etc/ssh/ssh_host_key ]; then
       sudo ssh-keygen -q -t rsa1 -N '' -f /etc/ssh/ssh_host_key
     fi
     case $VAR(protocol-version/@) in
     v2) VER=2;;
     v1) VER=1;;
     all) VER="1,2";;
      *) VER=2;;
     esac;
     STR="SSHD_OPTS=\"-p $VAR(port/@) -o Hostkey=/etc/ssh/ssh_host_key -o Protocol=${VER}\""
     if ! grep -q -s "^$STR" /etc/default/ssh; then
          sudo sh -c "echo '$STR' > /etc/default/ssh"
          sudo /usr/sbin/invoke-rc.d ssh restart
     fi