2017-08-01 09:21:05 +02:00
|
|
|
diff --git a/src/ipsec/_ipsec.in b/src/ipsec/_ipsec.in
|
|
|
|
index ea399b8..ea8ed8a 100644
|
|
|
|
--- a/src/ipsec/_ipsec.in
|
|
|
|
+++ b/src/ipsec/_ipsec.in
|
|
|
|
@@ -46,6 +46,26 @@ IPSEC_DISTRO="Institute for Internet Technologies and Applications\nUniversity o
|
2014-11-21 13:01:59 +01:00
|
|
|
|
2017-08-01 09:21:05 +02:00
|
|
|
command_dir="$IPSEC_DIR"
|
2014-11-21 13:01:59 +01:00
|
|
|
|
|
|
|
+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]"
|
2017-08-01 09:21:05 +02:00
|
|
|
@@ -153,6 +173,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
|
2017-08-01 09:21:05 +02:00
|
|
|
@@ -162,6 +183,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
|
2017-08-01 09:21:05 +02:00
|
|
|
@@ -195,6 +217,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
|
2017-08-01 09:21:05 +02:00
|
|
|
@@ -204,6 +227,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
|
2017-08-01 09:21:05 +02:00
|
|
|
@@ -211,6 +235,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
|
2017-08-01 09:21:05 +02:00
|
|
|
@@ -289,6 +314,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
|
2017-08-01 09:21:05 +02:00
|
|
|
@@ -338,6 +364,11 @@ esac
|
2014-11-21 13:01:59 +01:00
|
|
|
cmd="$1"
|
|
|
|
shift
|
|
|
|
|
|
|
|
+case $cmd in
|
|
|
|
+_fipscheck|_copyright|pki) ;;
|
|
|
|
+*) fipscheck || exit $? ;;
|
|
|
|
+esac
|
|
|
|
+
|
2017-08-01 09:21:05 +02:00
|
|
|
path="$command_dir/$cmd"
|
2014-11-21 13:01:59 +01:00
|
|
|
|
|
|
|
if [ ! -x "$path" ]
|