From 95702debd8466be0e1af1337dd2340b58fcfb6a6 Mon Sep 17 00:00:00 2001
From: Bob Mottram <bob@robotics.uk.to>
Date: Sat, 18 Mar 2017 10:50:52 +0000
Subject: [PATCH] stig tests option to lockdown permissions

---
 src/freedombone-tests | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/freedombone-tests b/src/freedombone-tests
index b91623adc..9e5c0c482 100755
--- a/src/freedombone-tests
+++ b/src/freedombone-tests
@@ -32,6 +32,7 @@ PROJECT_NAME='freedombone'
 
 export TEXTDOMAIN=${PROJECT_NAME}-tests
 export TEXTDOMAINDIR="/usr/share/locale"
+source /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-setup
 
 # Whether to run STIG tests
 RUN_STIG=
@@ -45,7 +46,7 @@ function show_help {
     echo ''
     echo $'Runs tests on the system'
     echo ''
-    echo $'     --stig [yes|no]      Run STIG tests'
+    echo $'     --stig [yes|no|fix]  Run STIG tests'
     echo $'     --help               Show help'
     echo ''
     exit 0
@@ -130,6 +131,13 @@ function stig_spinner {
     wait $1
 }
 
+function fix_stig {
+    if [[ $RUN_STIG != 'fix' ]]; then
+        return
+    fi
+    lockdown_permissions
+}
+
 function test_stig {
     if [ ! $RUN_STIG ]; then
         return
@@ -1125,7 +1133,7 @@ do
             if [[ "$1" == 'showall' ]]; then
                 SHOW_ALL_TESTS=1
             fi
-            RUN_STIG=1
+            RUN_STIG="$1"
             ;;
         *)
             # unknown option
@@ -1140,6 +1148,7 @@ fi
 
 test_app_functions
 test_unique_onion_ports
+fix_stig
 test_stig
 
 if [ ! $RUN_STIG ]; then
-- 
GitLab