re-arranging before interface config refactor

This commit is contained in:
toby 2018-10-09 16:25:45 +00:00
parent 1f58cd3918
commit 4a89aa2c93
1 changed files with 12 additions and 16 deletions

View File

@ -48,9 +48,13 @@ case "$1" in
## START writing config files
# disable password logins on ssh
sed -i -e '/#*\s*PasswordAuthentication /d' /etc/ssh/sshd_config
echo "PasswordAuthentication no" >>/etc/ssh/sshd_config
# write udev rules for device names
for if in ${!MACS[@]}
do
ifmac=${MACS[$if]}
[ "$if" == "mgmt" ] && if=mgmt1
[ -z "$ifmac" ] || echo 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=='$ifmac', ATTR{type}=="1", NAME="'${if}'"'
done >/etc/udev/rules.d/70-persistent-net.rules
@ -99,25 +103,12 @@ case "$1" in
# set ipsec config
sed -i -e "s/FQHOSTNAME/${HOSTNAME}/" /etc/ipsec.conf.wit
echo ": RSA ${HOSTNAME}.key" >/etc/ipsec.secrets
# write udev rules for device names
for if in ${!MACS[@]}
do
ifmac=${MACS[$if]}
[ "$if" == "mgmt" ] && if=mgmt1
[ -z "$ifmac" ] || echo 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=='$ifmac', ATTR{type}=="1", NAME="'${if}'"'
done >/etc/udev/rules.d/70-persistent-net.rules
# wite grub rules for serial terminal
sed -i -e '/GRUB_CMDLINE_LINUX_DEFAULT=/d' -e '/GRUB_CMDLINE_LINUX=/d' -e '/GRUB_SERIAL_COMMAND=/d' -e '/GRUB_TERMINAL=/d' /etc/default/grub
cat <<-EOF >>/etc/default/grub
@ -128,6 +119,11 @@ case "$1" in
EOF
# disable password logins on ssh
sed -i -e '/#*\s*PasswordAuthentication /d' /etc/ssh/sshd_config
echo "PasswordAuthentication no" >>/etc/ssh/sshd_config
## END config file section