version 1.459, 2015/08/22 23:32:18 |
version 1.460, 2015/08/28 18:10:46 |
|
|
# Start daemon using the rc.d daemon control scripts. |
# Start daemon using the rc.d daemon control scripts. |
# Usage: start_daemon daemon1 daemon2 daemon3 |
# Usage: start_daemon daemon1 daemon2 daemon3 |
start_daemon() { |
start_daemon() { |
local _n |
local _daemon |
for _n; do |
|
eval _do=\${${_n}_flags} |
for _daemon; do |
if [ X"${_do}" != X"NO" ]; then |
eval "_do=\${${_daemon}_flags}" |
/etc/rc.d/${_n} start |
[[ $_do != NO ]] && /etc/rc.d/${_daemon} start |
fi |
|
done |
done |
} |
} |
|
|
# Generate keys for isakmpd, iked and sshd if the don't exist yet. |
# Generate keys for isakmpd, iked and sshd if the don't exist yet. |
make_keys() { |
make_keys() { |
if [ ! -f /etc/isakmpd/private/local.key ]; then |
local _isakmpd_key=/etc/isakmpd/private/local.key |
echo -n "openssl: generating isakmpd/iked RSA key... " |
local _isakmpd_pub=/etc/isakmpd/local.pub |
if openssl genrsa -out /etc/isakmpd/private/local.key 2048 \ |
local _iked_key=/etc/iked/private/local.key |
>/dev/null 2>&1; then |
local _iked_pub=/etc/iked/local.pub |
chmod 600 /etc/isakmpd/private/local.key |
|
openssl rsa -out /etc/isakmpd/local.pub -in \ |
if [[ ! -f $_isakmpd_key ]]; then |
/etc/isakmpd/private/local.key -pubout \ |
echo -n "openssl: generating isakmpd/iked RSA keys... " |
>/dev/null 2>&1 |
if openssl genrsa -out $_isakmpd_key 2048 >/dev/null 2>&1 && |
|
chmod 600 $_isakmpd_key && |
|
openssl rsa -out $_isakmpd_pub -in $_isakmpd_key \ |
|
-pubout >/dev/null 2>&1; then |
echo done. |
echo done. |
else |
else |
echo failed. |
echo failed. |
fi |
fi |
fi |
fi |
|
|
if [ ! -f /etc/iked/private/local.key ]; then |
if [[ ! -f $_iked_key ]]; then |
# Just copy the generated isakmpd key |
# Just copy the generated isakmpd key |
cp /etc/isakmpd/private/local.key /etc/iked/private/local.key |
cp $_isakmpd_key $_iked_key |
chmod 600 /etc/iked/private/local.key |
chmod 600 $_iked_key |
cp /etc/isakmpd/local.pub /etc/iked/local.pub |
cp $_isakmpd_pub $_iked_pub |
fi |
fi |
|
|
ssh-keygen -A |
ssh-keygen -A |