|
127 | 127 | for FILE in ${MONGO_CONF_FILES}; do |
128 | 128 | if [ -f ${FILE} ]; then |
129 | 129 | LogText "Result: found MongoDB configuration file (${FILE})" |
130 | | - LogText "Test: determine authorization setting in new style YAML format" |
131 | | - AUTH_IN_CONFIG=$(${GREPBINARY} "authorization: enabled" ${FILE} | ${GREPBINARY} -E -v "(^#|#auth)") |
132 | | - if HasData "${AUTH_IN_CONFIG}"; then |
133 | | - LogText "Result: GOOD, found authorization option enabled in configuration file (YAML format)" |
134 | | - MONGODB_AUTHORIZATION_ENABLED=1 |
135 | | - else |
| 130 | + # YAML with quotes |
| 131 | + if [ ${MONGODB_AUTHORIZATION_ENABLED} -eq 0 ]; then |
| 132 | + LogText "Test: determine authorization setting in new style YAML format" |
| 133 | + AUTH_IN_CONFIG=$(${GREPBINARY} "authorization: \"enabled\"" ${FILE} | ${GREPBINARY} -E -v "(^#|#auth)") |
| 134 | + if HasData "${AUTH_IN_CONFIG}"; then |
| 135 | + LogText "Result: GOOD, found authorization option enabled in configuration file (YAML format with quotes)" |
| 136 | + MONGODB_AUTHORIZATION_ENABLED=1 |
| 137 | + fi |
| 138 | + fi |
| 139 | + # YAML without quotes |
| 140 | + if [ ${MONGODB_AUTHORIZATION_ENABLED} -eq 0 ]; then |
| 141 | + AUTH_IN_CONFIG=$(${GREPBINARY} "authorization: enabled" ${FILE} | ${GREPBINARY} -E -v "(^#|#auth)") |
| 142 | + if HasData "${AUTH_IN_CONFIG}"; then |
| 143 | + LogText "Result: GOOD, found authorization option enabled in configuration file (YAML format without quotes)" |
| 144 | + MONGODB_AUTHORIZATION_ENABLED=1 |
| 145 | + fi |
| 146 | + fi |
| 147 | + # Old style |
| 148 | + if [ ${MONGODB_AUTHORIZATION_ENABLED} -eq 0 ]; then |
136 | 149 | LogText "Result: did NOT find authorization option enabled in configuration file (with YAML format)" |
137 | 150 | LogText "Test: now searching for old style configuration (auth = true) in configuration file" |
138 | 151 | AUTH_IN_CONFIG=$(${GREPBINARY} "auth = true" ${FILE} | ${GREPBINARY} -v "noauth" | ${GREPBINARY} -E -v "(^#|#auth)") |
|
0 commit comments