#
#
KEYGEN="/usr/bin/ssh-keygen -q"
# Checks to see if RSA, and DSA host keys are available
# if any of these keys are not present, the respective keys are created.
{
keypath=$1
keytype=$2
if [ ! -f $keypath ]; then
#
# HostKey keywords in sshd_config may be preceded or
# followed by a mix of any number of space or tabs,
# and optionally have an = between keyword and
# argument. We use two grep invocations such that we
# can match HostKey case insensitively but still have
# the case of the path name be significant, keeping
# the pattern somewhat more readable.
#
# The character classes below contain one literal
# space and one literal tab.
#
if [ $? -eq 0 ]; then
if [ $? -ne 0 ]; then
exit $SMF_EXIT_ERR_CONFIG
fi
fi
fi
}
{
keypath=$1
if [ -f $keypath ]; then
if [ $? -eq 0 ]; then
fi
fi
}
#
# Makes sure, that /etc/ssh/sshd_config does not contain single line
# 'ListenAddress ::'.
#
# This used to be part of default SunSSH sshd_config and instructed SunSSH
# to listen on all interfaces. For OpenSSH, the same line means listen on all
# IPv6 interfaces.
#
{
fbackup="$SSHDIR/sshd_config.pre_listenaddress_fix"
reason4change="#\n\
# Historically default sshd_config was shipped with 'ListenAddress ::',\n\
# which means 'listen on all interfaces' in SunSSH.\n\
# In OpenSSH this setting means 'listen on all IPv6 interfaces'.\n\
# To avoid loss of service after transitioning to OpenSSH, the following\n\
# Original file was backed up to $fbackup\n\
#\n\
# "
expl4log="Historically default sshd_config was shipped with \
'ListenAddress ::', which means 'listen on all interfaces' in SunSSH. \
In OpenSSH this setting means 'listen on all IPv6 interfaces'. \
For both SunSSH and OpenSSH the default behavior when no ListenAddress \
is specified is to listen on all interfaces (both IPv4 and IPv6)."
msg_not_removed="Custom ListenAddress setting detected in \
$SSHDIR/sshd_config, the file will not be modified. Please, check your \
ListenAddress settings. $expl4log"
msg_removed="Removing 'ListenAddress ::'. $expl4log Original file has \
been backed up to $fbackup"
# only modify sshd_config, if ssh implementation is OpenSSH
return 0;
fi
# comment '# IPv4 & IPv6' indicates an old default sshd_config
# backup
# if 'ListenAddress ::' is the only ListenAddress line, comment it out
echo $msg_removed
awk_prog="/^ListenAddress ::$/ {printf(\"$reason4change\")}\
!/^# IPv4 & IPv6$/ {print}"
# no ListenAddress setting => OK, silently remove comment
awk_prog="!/^# IPv4 & IPv6$/ {print}"
else
# send warning message both to log and console
echo $msg_not_removed | smf_console
awk_prog="!/^# IPv4 & IPv6$/ {print}"
fi;
if [[ $? -ne 0 ]]; then
echo "Update error! Check your ListenAddress settings."
return 1;
else
# write the fixed content to the file
return 0;
fi
}
# This script is being used for two purposes: as part of an SMF
# application.
#
# Both, the SMF methods and sysidconfig/sys-unconfig use different
# arguments..
case $1 in
# sysidconfig/sys-unconfig arguments (-c and -u)
'-c')
;;
'-u')
# sysconfig unconfigure to remove the sshd host keys
;;
# SMF arguments (start and restart [really "refresh"])
'start')
#
# If host keys don't exist when the service is started, create
# them; sysidconfig is not run in every situation (such as on
# the install media).
#
#
# Make sure, that /etc/ssh/sshd_config does not contain single line
# 'ListenAddress ::'.
#
;;
'restart')
if [ -f "$PIDFILE" ]; then
fi
;;
*)
echo "Usage: $0 { start | restart }"
exit 1
;;
esac
exit $?