#! /bin/bash

error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code

# currently missing from bootstrap-vz:
# init.d/expand-root
# init.d/generate-ssh-hostkeys (currently done in rc.local/CLOUD)

if ifclass DISABLE_IPV6; then
    ainsl -av /etc/sysctl.d/70-disable-ipv6.conf 'net.ipv6.conf.all.disable_ipv6 = 1'
    ainsl -av /etc/sysctl.d/70-disable-ipv6.conf 'net.ipv6.conf.lo.disable_ipv6 = 0'
fi
$ROOTCMD shadowconfig on
sed -i -e 's/^#PasswordAuthentication yes/PasswordAuthentication no/' $target/etc/ssh/sshd_config
sed -i -e 's/^PermitRootLogin .*/PermitRootLogin without-password/' $target/etc/ssh/sshd_config
ainsl /etc/ssh/sshd_config 'ClientAliveInterval 120'
