2014-11-21 13:01:59 +01:00
|
|
|
--- src/ipsec/_ipsec.in
|
2015-01-05 15:41:37 +01:00
|
|
|
+++ src/ipsec/_ipsec.in
|
|
|
|
@@ -44,6 +44,26 @@ export IPSEC_DIR IPSEC_BINDIR IPSEC_SBINDIR IPSEC_CONFDIR IPSEC_PIDDIR IPSEC_SCR
|
2014-11-21 13:01:59 +01:00
|
|
|
|
|
|
|
IPSEC_DISTRO="Institute for Internet Technologies and Applications\nUniversity of Applied Sciences Rapperswil, Switzerland"
|
|
|
|
|
|
|
|
+fipscheck()
|
|
|
|
+{
|
|
|
|
+ # when fips operation mode is not enabled, just report OK
|
|
|
|
+ read 2>/dev/null fips_enabled < /proc/sys/crypto/fips_enabled
|
|
|
|
+ test "X$fips_enabled" = "X1" || return 0
|
|
|
|
+
|
|
|
|
+ # complain when _fipscheck is missed
|
|
|
|
+ test -x "$IPSEC_DIR/_fipscheck" || {
|
|
|
|
+ echo "ipsec: please install strongswan-hmac package required in fips mode" >&2
|
|
|
|
+ return 4
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ # now execute it
|
|
|
|
+ $IPSEC_DIR/_fipscheck || {
|
|
|
|
+ rc=$?
|
|
|
|
+ echo "ipsec: strongSwan fips file integrity check failed" >&2
|
|
|
|
+ return $rc
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
case "$1" in
|
|
|
|
'')
|
2015-01-05 15:41:37 +01:00
|
|
|
echo "$IPSEC_SCRIPT command [arguments]"
|
|
|
|
@@ -155,6 +175,7 @@ rereadall|purgeocsp|listcounters|resetcounters)
|
2014-11-21 13:01:59 +01:00
|
|
|
shift
|
|
|
|
if [ -e $IPSEC_CHARON_PID ]
|
|
|
|
then
|
|
|
|
+ fipscheck || exit $?
|
|
|
|
$IPSEC_STROKE "$op" "$@"
|
|
|
|
rc="$?"
|
|
|
|
fi
|
2015-01-05 15:41:37 +01:00
|
|
|
@@ -164,6 +185,7 @@ purgeike|purgecrls|purgecerts)
|
2014-11-21 13:01:59 +01:00
|
|
|
rc=7
|
|
|
|
if [ -e $IPSEC_CHARON_PID ]
|
|
|
|
then
|
|
|
|
+ fipscheck || exit $?
|
|
|
|
$IPSEC_STROKE "$1"
|
|
|
|
rc="$?"
|
|
|
|
fi
|
2015-01-05 15:41:37 +01:00
|
|
|
@@ -197,6 +219,7 @@ route|unroute)
|
2014-11-21 13:01:59 +01:00
|
|
|
fi
|
|
|
|
if [ -e $IPSEC_CHARON_PID ]
|
|
|
|
then
|
|
|
|
+ fipscheck || exit $?
|
|
|
|
$IPSEC_STROKE "$op" "$1"
|
|
|
|
rc="$?"
|
|
|
|
fi
|
2015-01-05 15:41:37 +01:00
|
|
|
@@ -206,6 +229,7 @@ secrets)
|
2014-11-21 13:01:59 +01:00
|
|
|
rc=7
|
|
|
|
if [ -e $IPSEC_CHARON_PID ]
|
|
|
|
then
|
|
|
|
+ fipscheck || exit $?
|
|
|
|
$IPSEC_STROKE rereadsecrets
|
|
|
|
rc="$?"
|
|
|
|
fi
|
2015-01-05 15:41:37 +01:00
|
|
|
@@ -213,6 +237,7 @@ secrets)
|
2014-11-21 13:01:59 +01:00
|
|
|
;;
|
|
|
|
start)
|
|
|
|
shift
|
|
|
|
+ fipscheck || exit $?
|
|
|
|
if [ -d /var/lock/subsys ]; then
|
|
|
|
touch /var/lock/subsys/ipsec
|
|
|
|
fi
|
2015-01-05 15:41:37 +01:00
|
|
|
@@ -286,6 +311,7 @@ up)
|
2014-11-21 13:01:59 +01:00
|
|
|
rc=7
|
|
|
|
if [ -e $IPSEC_CHARON_PID ]
|
|
|
|
then
|
|
|
|
+ fipscheck || exit $?
|
|
|
|
$IPSEC_STROKE up "$1"
|
|
|
|
rc="$?"
|
|
|
|
fi
|
2015-01-05 15:41:37 +01:00
|
|
|
@@ -325,6 +351,11 @@ esac
|
2014-11-21 13:01:59 +01:00
|
|
|
cmd="$1"
|
|
|
|
shift
|
|
|
|
|
|
|
|
+case $cmd in
|
|
|
|
+_fipscheck|_copyright|pki) ;;
|
|
|
|
+*) fipscheck || exit $? ;;
|
|
|
|
+esac
|
|
|
|
+
|
|
|
|
path="$IPSEC_DIR/$cmd"
|
|
|
|
|
|
|
|
if [ ! -x "$path" ]
|