浏览代码

stig tests option to lockdown permissions

Bob Mottram 8 年前
父节点
当前提交
95702debd8
共有 1 个文件被更改,包括 11 次插入2 次删除
  1. 11
    2
      src/freedombone-tests

+ 11
- 2
src/freedombone-tests 查看文件

@@ -32,6 +32,7 @@ PROJECT_NAME='freedombone'
32 32
 
33 33
 export TEXTDOMAIN=${PROJECT_NAME}-tests
34 34
 export TEXTDOMAINDIR="/usr/share/locale"
35
+source /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-setup
35 36
 
36 37
 # Whether to run STIG tests
37 38
 RUN_STIG=
@@ -45,7 +46,7 @@ function show_help {
45 46
     echo ''
46 47
     echo $'Runs tests on the system'
47 48
     echo ''
48
-    echo $'     --stig [yes|no]      Run STIG tests'
49
+    echo $'     --stig [yes|no|fix]  Run STIG tests'
49 50
     echo $'     --help               Show help'
50 51
     echo ''
51 52
     exit 0
@@ -130,6 +131,13 @@ function stig_spinner {
130 131
     wait $1
131 132
 }
132 133
 
134
+function fix_stig {
135
+    if [[ $RUN_STIG != 'fix' ]]; then
136
+        return
137
+    fi
138
+    lockdown_permissions
139
+}
140
+
133 141
 function test_stig {
134 142
     if [ ! $RUN_STIG ]; then
135 143
         return
@@ -1125,7 +1133,7 @@ do
1125 1133
             if [[ "$1" == 'showall' ]]; then
1126 1134
                 SHOW_ALL_TESTS=1
1127 1135
             fi
1128
-            RUN_STIG=1
1136
+            RUN_STIG="$1"
1129 1137
             ;;
1130 1138
         *)
1131 1139
             # unknown option
@@ -1140,6 +1148,7 @@ fi
1140 1148
 
1141 1149
 test_app_functions
1142 1150
 test_unique_onion_ports
1151
+fix_stig
1143 1152
 test_stig
1144 1153
 
1145 1154
 if [ ! $RUN_STIG ]; then