diff options
author | Michael Boelen <michael.boelen@cisofy.com> | 2016-08-16 09:11:51 +0300 |
---|---|---|
committer | Michael Boelen <michael.boelen@cisofy.com> | 2016-08-16 09:11:51 +0300 |
commit | 4b96452dabf7fb889366f76afc6bb6c1927fed4d (patch) | |
tree | e967fd530f19be29c7390cff0235de299021ff08 | |
parent | 1b30f6e5585e3e7ddcb10b776d64508518154db5 (diff) |
Clean out unneeded file
-rw-r--r-- | include/functions | 110 | ||||
-rw-r--r-- | include/tests_webservers | 2 |
2 files changed, 59 insertions, 53 deletions
diff --git a/include/functions b/include/functions index fde436fb..f4413b28 100644 --- a/include/functions +++ b/include/functions @@ -83,6 +83,7 @@ # ShowComplianceFinding Display a particular finding regarding compliance or a security standard # ShowSymlinkPath Show a path behind a symlink # SkipAtomicTest Test if a subtest needs to be skipped +# StoreNginxSettings Save parsed nginx settings to file # TestValue Evaluate a value in a string or key # ViewCategories Show available category of tests # ViewGroups Display test groups @@ -1558,57 +1559,6 @@ # Returns : <nothing> ################################################################################ - StoreNginxSettings() { - CONFIG_DEPTH=0; CONFIG_FILE=""; CONFIG_SETTING=""; CONFIG_TREE=""; CONFIG_VALUE="" - if [ "${NGINX_FULL_CONFIG}" = "" ]; then ExitFatal "No 'full' configuration file created before, so can't store nginx configuration snippets"; fi - while [ $# -ge 1 ]; do - case $1 in - --config) - shift - CONFIG_FILE=$1 - ;; - --depth) - shift - CONFIG_DEPTH=$1 - ;; - # none | events | server | unknown - --tree) - shift - CONFIG_TREE=$1 - case ${CONFIG_TREE} in - "/") CONFIG_COUNTER=0 ;; - "/events") CONFIG_COUNTER=${NGINX_EVENTS_COUNTER=0} ;; - "/http") CONFIG_COUNTER=${NGINX_HTTP_COUNTER=0} ;; - "/server") CONFIG_COUNTER=${NGINX_SERVER_COUNTER=0} ;; - "/server/location") CONFIG_COUNTER=${NGINX_LOCATION_COUNTER=0} ;; - *) - Debug "Unknown configuration tree of nginx ${CONFIG_TREE}" - ;; - esac - ;; - --setting) - shift - CONFIG_SETTING=$1 - ;; - --value) - shift - CONFIG_VALUE=$1 - ;; - *) - echo "INVALID OPTION (StoreNginxSettings): $1 $2" - #ExitFatal - ;; - esac - # Go to next parameter - shift - done - if [ -z "${CONFIG_DEPTH}" ]; then CONFIG_DEPTH="0"; fi - if [ -z "${CONFIG_SETTING}" ]; then CONFIG_SETTING="NA"; fi - if [ -z "${CONFIG_TREE}" ]; then CONFIG_TREE="/"; fi - if [ -z "${CONFIG_VALUE}" ]; then CONFIG_VALUE="NA"; fi - echo "nginx_config[]=|file=${CONFIG_FILE}|depth=${CONFIG_DEPTH}|tree=${CONFIG_TREE}|number=${CONFIG_COUNTER}|setting=${CONFIG_SETTING}|value=${CONFIG_VALUE}|" >> ${NGINX_FULL_CONFIG} - } - ParseNginx() { COUNT=0 BREADCRUMB="" @@ -2647,6 +2597,64 @@ ################################################################################ + # Name : StoreNginxSettings() + # Description : Store parsed settings from nginx (by ParseNginx) + # Input : multiple options + # Returns : <nothing> + ################################################################################ + + StoreNginxSettings() { + CONFIG_DEPTH=0; CONFIG_FILE=""; CONFIG_SETTING=""; CONFIG_TREE=""; CONFIG_VALUE="" + while [ $# -ge 1 ]; do + case $1 in + --config) + shift + CONFIG_FILE=$1 + ;; + --depth) + shift + CONFIG_DEPTH=$1 + ;; + # none | events | server | unknown + --tree) + shift + CONFIG_TREE=$1 + case ${CONFIG_TREE} in + "/") CONFIG_COUNTER=0 ;; + "/events") CONFIG_COUNTER=${NGINX_EVENTS_COUNTER=0} ;; + "/http") CONFIG_COUNTER=${NGINX_HTTP_COUNTER=0} ;; + "/server") CONFIG_COUNTER=${NGINX_SERVER_COUNTER=0} ;; + "/server/location") CONFIG_COUNTER=${NGINX_LOCATION_COUNTER=0} ;; + *) + Debug "Unknown configuration tree of nginx ${CONFIG_TREE}" + ;; + esac + ;; + --setting) + shift + CONFIG_SETTING=$1 + ;; + --value) + shift + CONFIG_VALUE=$1 + ;; + *) + echo "INVALID OPTION (StoreNginxSettings): $1 $2" + #ExitFatal + ;; + esac + # Go to next parameter + shift + done + if [ -z "${CONFIG_DEPTH}" ]; then CONFIG_DEPTH="0"; fi + if [ -z "${CONFIG_SETTING}" ]; then CONFIG_SETTING="NA"; fi + if [ -z "${CONFIG_TREE}" ]; then CONFIG_TREE="/"; fi + if [ -z "${CONFIG_VALUE}" ]; then CONFIG_VALUE="NA"; fi + Report "nginx_config[]=|file=${CONFIG_FILE}|depth=${CONFIG_DEPTH}|tree=${CONFIG_TREE}|number=${CONFIG_COUNTER}|setting=${CONFIG_SETTING}|value=${CONFIG_VALUE}|" + } + + + ################################################################################ # Name : TestValue() # Description : Test if a value is good/bad (e.g. according to best practices) # diff --git a/include/tests_webservers b/include/tests_webservers index 40b07e48..83e1416f 100644 --- a/include/tests_webservers +++ b/include/tests_webservers @@ -479,8 +479,6 @@ if [ ${NGINX_RUNNING} -eq 1 -a ! "${NGINX_CONF_FILES}" = "" ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi Register --test-no HTTP-6708 --preqs-met ${PREQS_MET} --weight L --network NO --category security --description "Check discovered nginx configuration settings" if [ ${SKIPTEST} -eq 0 ]; then - CreateTempFile || ExitFatal "Could not create temporary file" - NGINX_FULL_CONFIG="${TEMP_FILE}" LogText "Test: start parsing all discovered nginx options" Display --indent 4 --text "- Parsing configuration options" for I in ${NGINX_CONF_FILES}; do |