freedombone-tests 38KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328
  1. #!/bin/bash
  2. # _____ _ _
  3. # | __|___ ___ ___ _| |___ _____| |_ ___ ___ ___
  4. # | __| _| -_| -_| . | . | | . | . | | -_|
  5. # |__| |_| |___|___|___|___|_|_|_|___|___|_|_|___|
  6. #
  7. # Freedom in the Cloud
  8. #
  9. # Run tests on the system
  10. #
  11. # License
  12. # =======
  13. #
  14. # Copyright (C) 2015-2018 Bob Mottram <bob@freedombone.net>
  15. #
  16. # This program is free software: you can redistribute it and/or modify
  17. # it under the terms of the GNU Affero General Public License as published by
  18. # the Free Software Foundation, either version 3 of the License, or
  19. # (at your option) any later version.
  20. #
  21. # This program is distributed in the hope that it will be useful,
  22. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  23. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  24. # GNU Affero General Public License for more details.
  25. #
  26. # You should have received a copy of the GNU Affero General Public License
  27. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  28. PROJECT_NAME='freedombone'
  29. export TEXTDOMAIN=${PROJECT_NAME}-tests
  30. export TEXTDOMAINDIR="/usr/share/locale"
  31. source /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-setup
  32. # Whether to run STIG tests
  33. RUN_STIG=
  34. # Whether to show both passes and fails of STIG tests
  35. SHOW_ALL_TESTS=
  36. function show_help {
  37. echo ''
  38. echo $"${PROJECT_NAME}-tests"
  39. echo ''
  40. echo $'Runs tests on the system'
  41. echo ''
  42. echo $' -s --stig [yes|no|fix] Run STIG tests'
  43. echo $' -a --static Run static analysis on scripts'
  44. echo $' --help Show help'
  45. echo ''
  46. exit 0
  47. }
  48. function test_app_function_type {
  49. filename=$1
  50. fn_type=$2
  51. app_name=$(echo "${filename}" | awk -F '-app-' '{print $2}')
  52. app_function=$(grep "function ${fn_type}_${app_name} {" "${filename}" | awk -F "${fn_type}_" '{print $2}' | awk -F ' ' '{print $1}')
  53. if [ ! "${app_function}" ]; then
  54. echo $"Application ${app_name} does not contain a function called '${fn_type}_${app_name}'"
  55. echo ''
  56. echo "See ${filename}"
  57. exit 72852
  58. fi
  59. }
  60. function test_static_analysis {
  61. if [ ! -f /usr/bin/shellcheck ]; then
  62. apt-get -yq install shellcheck
  63. fi
  64. STATIC_ANALYSIS_EXCLUDED='SC2034,SC1090'
  65. FILES="/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-*"
  66. for filename in $FILES
  67. do
  68. if ! shellcheck --exclude "$STATIC_ANALYSIS_EXCLUDED" "$filename"; then
  69. echo ''
  70. echo $"${filename} failed static analysis"
  71. exit 24687242
  72. fi
  73. done
  74. FILES="/usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-*"
  75. for filename in $FILES
  76. do
  77. if ! shellcheck --exclude "$STATIC_ANALYSIS_EXCLUDED" "$filename"; then
  78. echo ''
  79. echo $"${filename} failed static analysis"
  80. exit 3857395935
  81. fi
  82. done
  83. FILES="/usr/local/bin/${PROJECT_NAME}-*"
  84. for filename in $FILES
  85. do
  86. if [[ "$filename" == *"-config-qtox" || "$filename" == *"-image-make"* ]]; then
  87. continue
  88. fi
  89. if ! shellcheck --exclude "$STATIC_ANALYSIS_EXCLUDED" "$filename"; then
  90. echo ''
  91. echo $"${filename} failed static analysis"
  92. exit 784243468435
  93. fi
  94. done
  95. }
  96. function test_app_functions {
  97. if [ $RUN_STIG ]; then
  98. return
  99. fi
  100. FILES="/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-*"
  101. # check that these functions exist
  102. interface_functions=( install remove backup_local backup_remote restore_local restore_remote upgrade reconfigure )
  103. # for all the app scripts
  104. for filename in $FILES
  105. do
  106. # for each expected interface function
  107. # shellcheck disable=SC2068
  108. for f in ${interface_functions[@]}
  109. do
  110. test_app_function_type "${filename}" "$f"
  111. done
  112. done
  113. }
  114. function test_unique_onion_ports {
  115. if [ $RUN_STIG ]; then
  116. return
  117. fi
  118. # test that some services are not assigned the same onion port
  119. FILES="/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-*"
  120. # shellcheck disable=SC2086
  121. ports=$(grep -r "_ONION_PORT=" $FILES | awk -F ':' '{print $2}' | uniq | awk -F '=' '{print $2}')
  122. # shellcheck disable=SC2086
  123. unique_ports=$(grep -r "_ONION_PORT=" $FILES | awk -F ':' '{print $2}' | uniq | awk -F '=' '{print $2}' | uniq)
  124. if [[ "$ports" != "$unique_ports" ]]; then
  125. echo $'Some onion ports are clashing'
  126. # shellcheck disable=SC2086
  127. grep -r "_ONION_PORT=" $FILES | awk -F ':' '{print $2}' | uniq
  128. exit 637252
  129. fi
  130. }
  131. function stig_log_msg {
  132. ESTATUS=$1
  133. RED=$(tput setaf 1)
  134. BOLD=$(tput bold)
  135. GREEN=$(tput setaf 2)
  136. NORMAL=$(tput sgr0)
  137. MSG="$2"
  138. if [ "$ESTATUS" -eq 0 ];then
  139. printf "%s %s" "$GREEN$BOLD[ PASS ]$NORMAL" "$MSG"
  140. echo
  141. else
  142. printf "%s %s" "$RED$BOLD[ FAIL ]$NORMAL" "$MSG"
  143. echo
  144. fi
  145. }
  146. function stig_spinner {
  147. local pid=$1
  148. local delay=0.1
  149. # shellcheck disable=SC2143
  150. while [ "$(ps -a | awk '{print $1}' | grep "$pid")" ];
  151. do
  152. sleep $delay
  153. done
  154. printf " \\b"
  155. wait "$1"
  156. }
  157. function disallow_package {
  158. package_name=$1
  159. if service --status-all | grep "+.*${package_name}";then
  160. apt-get -yq remove --purge "${package_name}"
  161. apt -yq autoremove
  162. fi
  163. }
  164. function fix_stig {
  165. if [[ $RUN_STIG != 'fix' ]]; then
  166. return
  167. fi
  168. disallow_package xinetd
  169. lockdown_permissions
  170. }
  171. function test_stig {
  172. if [ ! $RUN_STIG ]; then
  173. return
  174. fi
  175. STIG_TESTS_DIR=tests
  176. if [ ! -d $STIG_TESTS_DIR ]; then
  177. STIG_TESTS_DIR=~/${PROJECT_NAME}/tests
  178. if [ ! -d $STIG_TESTS_DIR ]; then
  179. echo $'No tests were found'
  180. exit 62725
  181. fi
  182. fi
  183. CATCOLOR=1
  184. SETLANG="en"
  185. source "$STIG_TESTS_DIR/output.sh"
  186. ##RHEL-06-000001
  187. ##The system must use a separate file system for /tmp.
  188. mount | grep "on /tmp " >/dev/null 2>&1 &
  189. stig_spinner $!
  190. output "V-38455" $? ${SETLANG}
  191. ################
  192. ##RHEL-06-000008
  193. ##Vendor-provided cryptographic certificates must be installed to verify the integrity of system software.
  194. bash $STIG_TESTS_DIR/check-apt-key.sh >/dev/null 2>&1 &
  195. stig_spinner $!
  196. output "V-38476" $? ${SETLANG}
  197. ################
  198. ##RHEL-06-000016
  199. ##A file integrity tool must be installed.
  200. dpkg -s tripwire >/dev/null 2>&1 &
  201. stig_spinner $!
  202. output "V-38489" $? ${SETLANG}
  203. ################
  204. ##RHEL-06-000019
  205. ##There must be no .rhosts or hosts.equiv files on the system.
  206. bash $STIG_TESTS_DIR/check-rhosts.sh > /dev/null 2>&1 &
  207. stig_spinner $!
  208. output "V-38491" $? ${SETLANG}
  209. ################
  210. ##RHEL-06-000027
  211. ##The system must prevent the root account from logging in from virtual consoles.
  212. bash $STIG_TESTS_DIR/check-consoles.sh virtual > /dev/null 2>&1 &
  213. stig_spinner $!
  214. output "V-38492" $? ${SETLANG}
  215. ################
  216. ##RHEL-06-000028
  217. ##The system must prevent the root account from logging in from serial consoles.
  218. bash $STIG_TESTS_DIR/check-consoles.sh serial > /dev/null 2>&1 &
  219. stig_spinner $!
  220. output "V-38494" $? ${SETLANG}
  221. ################
  222. ##RHEL-06-000029
  223. ##Default operating system accounts, other than root, must be locked.
  224. bash $STIG_TESTS_DIR/check-default-account.sh > /dev/null 2>&1 &
  225. stig_spinner $!
  226. output "V-38496" $? ${SETLANG}
  227. ################
  228. ##RHEL-06-000031
  229. ##The /etc/passwd file must not contain password hashes.
  230. awk -F: '($2 != "x") {print; err=1} END {exit err}' /etc/passwd > /dev/null 2>&1 &
  231. stig_spinner $!
  232. output "V-38499" $? ${SETLANG}
  233. ################
  234. ##RHEL-06-000032
  235. ##The root account must be the only account having a UID of 0.
  236. bash $STIG_TESTS_DIR/check-root-uid.sh > /dev/null 2>&1 &
  237. stig_spinner $!
  238. output "V-38500" $? ${SETLANG}
  239. ################
  240. ##RHEL-06-000033
  241. ##The /etc/shadow file must be owned by root.
  242. # shellcheck disable=SC2012
  243. ls -l /etc/shadow | awk '{print $3}' | grep "^root$" > /dev/null 2>&1 &
  244. stig_spinner $!
  245. output "V-38502" $? ${SETLANG}
  246. ################
  247. ##RHEL-06-000034
  248. ##The /etc/shadow file must be group-owned by root.
  249. # shellcheck disable=SC2012
  250. ls -l /etc/shadow | awk '{print $4}' | grep "^root$" > /dev/null 2>&1 &
  251. stig_spinner $!
  252. output "V-38503" $? ${SETLANG}
  253. ################
  254. ##RHEL-06-000035
  255. ##The /etc/shadow file must have mode 0000.
  256. # shellcheck disable=SC2012
  257. ls -l /etc/shadow | awk '{print $1}' | grep "^----------$" > /dev/null 2>&1 &
  258. stig_spinner $!
  259. output "V-38504" $? ${SETLANG}
  260. ################
  261. ##RHEL-06-000036
  262. ##The /etc/gshadow file must be owned by root.
  263. # shellcheck disable=SC2012
  264. ls -l /etc/gshadow | awk '{print $3}' | grep "^root$" > /dev/null 2>&1 &
  265. stig_spinner $!
  266. output "V-38443" $? ${SETLANG}
  267. ################
  268. ##RHEL-06-000037
  269. ##The /etc/gshadow file must be group-owned by root.
  270. # shellcheck disable=SC2012
  271. ls -l /etc/gshadow | awk '{print $4}' | grep "^root$" > /dev/null 2>&1 &
  272. stig_spinner $!
  273. output "V-38448" $? ${SETLANG}
  274. ################
  275. ##RHEL-06-000038
  276. ##The /etc/gshadow file must have mode 0000.
  277. # shellcheck disable=SC2012
  278. ls -l /etc/gshadow | awk '{print $1}' | grep "^----------$" > /dev/null 2>&1 &
  279. stig_spinner $!
  280. output "V-38449" $? ${SETLANG}
  281. ################
  282. ##RHEL-06-000039
  283. ##The /etc/passwd file must be owned by root.
  284. # shellcheck disable=SC2012
  285. ls -l /etc/passwd | awk '{print $3}' | grep "^root$" > /dev/null 2>&1 &
  286. stig_spinner $!
  287. output "V-38450" $? ${SETLANG}
  288. ################
  289. ##RHEL-06-000040
  290. ##The /etc/passwd file must be group-owned by root.
  291. # shellcheck disable=SC2012
  292. ls -l /etc/passwd | awk '{print $4}' | grep "^root$" > /dev/null 2>&1 &
  293. stig_spinner $!
  294. output "V-38451" $? ${SETLANG}
  295. ################
  296. ##RHEL-06-000041
  297. ##The /etc/passwd file must have mode 0644 or less permissive.
  298. bash $STIG_TESTS_DIR/check-mode.sh /etc/passwd 644 > /dev/null 2>&1 &
  299. stig_spinner $!
  300. output "V-38457" $? ${SETLANG}
  301. ################
  302. ##RHEL-06-000042
  303. ##The /etc/group file must be owned by root.
  304. # shellcheck disable=SC2012
  305. ls -l /etc/group | awk '{print $3}' | grep "^root$" > /dev/null 2>&1 &
  306. stig_spinner $!
  307. output "V-38458" $? ${SETLANG}
  308. ################
  309. ##RHEL-06-000043
  310. ##The /etc/group file must be group-owned by root.
  311. # shellcheck disable=SC2012
  312. ls -l /etc/group | awk '{print $4}' | grep "^root$" > /dev/null 2>&1 &
  313. stig_spinner $!
  314. output "V-38459" $? ${SETLANG}
  315. ################
  316. ##RHEL-06-000044
  317. ##The /etc/group file must have mode 0644 or less permissive.
  318. bash $STIG_TESTS_DIR/check-mode.sh "/etc/group" 644 > /dev/null 2>&1 &
  319. stig_spinner $!
  320. output "V-38461" $? ${SETLANG}
  321. ################
  322. ##RHEL-06-000045
  323. ##Library files must have mode 0755 or less permissive.
  324. bash $STIG_TESTS_DIR/check-libs-mode.sh > /dev/null 2>&1 &
  325. stig_spinner $!
  326. output "V-38465" $? ${SETLANG}
  327. ################
  328. ##RHEL-06-000046
  329. ##Library files must be owned by root.
  330. bash $STIG_TESTS_DIR/check-libs-owner.sh > /dev/null 2>&1 &
  331. stig_spinner $!
  332. output "V-38466" $? ${SETLANG}
  333. ################
  334. ##RHEL-06-000047
  335. ##All system command files must have mode 755 or less permissive.
  336. bash $STIG_TESTS_DIR/check-cmd-mode.sh > /dev/null 2>&1 &
  337. stig_spinner $!
  338. output "V-38469" $? ${SETLANG}
  339. ################
  340. ##RHEL-06-000048
  341. ##All system command files must be owned by root.
  342. bash $STIG_TESTS_DIR/check-cmd-owner.sh > /dev/null 2>&1 &
  343. stig_spinner $!
  344. output "V-38472" $? ${SETLANG}
  345. ################
  346. ##RHEL-06-000061
  347. ##The system must disable accounts after ten consecutive unsuccessful logon attempts.
  348. bash $STIG_TESTS_DIR/check-password.sh /etc/pam.d/common-auth pam_tally deny gt 10 > /dev/null 2>&1 &
  349. stig_spinner $!
  350. output "V-38573" $? ${SETLANG}
  351. ################
  352. ##RHEL-06-000062
  353. ##The system must use a FIPS 140-2 approved cryptographic hashing algorithm for generating account password hashes (system-auth).
  354. sed -e '/^#/d' -e '/^[ \t][ \t]*#/d' -e 's/#.*$//' -e '/^$/d' /etc/pam.d/* | grep password | grep pam_unix.so | grep sha512 > /dev/null 2>&1 &
  355. stig_spinner $!
  356. output "V-38574" $? ${SETLANG}
  357. ################
  358. ##RHEL-06-000063
  359. ##The system must use a FIPS 140-2 approved cryptographic hashing algorithm for generating account password hashes (login.defs).
  360. sed -e '/^#/d' -e '/^[ \t][ \t]*#/d' -e 's/#.*$//' -e '/^$/d' /etc/login.defs | grep "ENCRYPT_METHOD.*SHA512" > /dev/null 2>&1 &
  361. stig_spinner $!
  362. output "V-38576" $? ${SETLANG}
  363. ################
  364. ##RHEL-06-000064
  365. ##The system must use a FIPS 140-2 approved cryptographic hashing algorithm for generating account password hashes (libuser.conf).
  366. bash $STIG_TESTS_DIR/check-depends.sh > /dev/null 2>&1 &
  367. stig_spinner $!
  368. output "V-38577" $? ${SETLANG}
  369. ################
  370. ##RHEL-06-000071
  371. ##The system must allow locking of the console screen in text mode.
  372. dpkg -s screen >/dev/null 2>&1 &
  373. stig_spinner $!
  374. output "V-38590" $? ${SETLANG}
  375. ################
  376. ##RHEL-06-000078
  377. ##The system must implement virtual address space randomization.
  378. bash $STIG_TESTS_DIR/check-sysctl.sh kernel.randomize_va_space ne 2 >/dev/null 2>&1 &
  379. stig_spinner $!
  380. output "V-38596" $? ${SETLANG}
  381. ################
  382. ##RHEL-06-000080
  383. ##The system must not send ICMPv4 redirects by default.
  384. bash $STIG_TESTS_DIR/check-sysctl.sh net.ipv4.conf.default.send_redirects ne 0 >/dev/null 2>&1 &
  385. stig_spinner $!
  386. output "V-38600" $? ${SETLANG}
  387. ################
  388. ##RHEL-06-000081
  389. ##The system must not send ICMPv4 redirects from any interface.
  390. bash $STIG_TESTS_DIR/check-sysctl.sh net.ipv4.conf.all.send_redirects ne 0 >/dev/null 2>&1 &
  391. stig_spinner $!
  392. output "V-38601" $? ${SETLANG}
  393. ################
  394. ##RHEL-06-000082
  395. ##IP forwarding for IPv4 must not be enabled, unless the system is a router.
  396. bash $STIG_TESTS_DIR/check-sysctl.sh net.ipv4.ip_forward ne 0 >/dev/null 2>&1 &
  397. stig_spinner $!
  398. output "V-38511" $? ${SETLANG}
  399. ################
  400. ##RHEL-06-000083
  401. ##The system must not accept IPv4 source-routed packets on any interface.
  402. bash $STIG_TESTS_DIR/check-sysctl.sh net.ipv4.conf.all.accept_source_route ne 0 >/dev/null 2>&1 &
  403. stig_spinner $!
  404. output "V-38523" $? ${SETLANG}
  405. ################
  406. ##RHEL-06-000084
  407. ##The system must not accept ICMPv4 redirect packets on any interface.
  408. bash $STIG_TESTS_DIR/check-sysctl.sh net.ipv4.conf.all.accept_redirects ne 0 >/dev/null 2>&1 &
  409. stig_spinner $!
  410. output "V-38524" $? ${SETLANG}
  411. ################
  412. ##RHEL-06-000086
  413. ##The system must not accept ICMPv4 secure redirect packets on any interface.
  414. bash $STIG_TESTS_DIR/check-sysctl.sh net.ipv4.conf.all.secure_redirects ne 0 >/dev/null 2>&1 &
  415. stig_spinner $!
  416. output "V-38526" $? ${SETLANG}
  417. ################
  418. ##RHEL-06-000089
  419. ##The system must not accept IPv4 source-routed packets by default.
  420. bash $STIG_TESTS_DIR/check-sysctl.sh net.ipv4.conf.default.accept_source_route ne 0 >/dev/null 2>&1 &
  421. stig_spinner $!
  422. output "V-38529" $? ${SETLANG}
  423. ################
  424. ##RHEL-06-000090
  425. ##The system must not accept ICMPv4 secure redirect packets by default.
  426. bash $STIG_TESTS_DIR/check-sysctl.sh net.ipv4.conf.default.secure_redirects ne 0 >/dev/null 2>&1 &
  427. stig_spinner $!
  428. output "V-38532" $? ${SETLANG}
  429. ################
  430. ##RHEL-06-000091
  431. ##The system must ignore ICMPv4 redirect messages by default.
  432. bash $STIG_TESTS_DIR/check-sysctl.sh net.ipv4.conf.default.accept_redirects ne 0 >/dev/null 2>&1 &
  433. stig_spinner $!
  434. output "V-38533" $? ${SETLANG}
  435. ################
  436. ##RHEL-06-000092
  437. ##The system must not respond to ICMPv4 sent to a broadcast address.
  438. bash $STIG_TESTS_DIR/check-sysctl.sh net.ipv4.icmp_echo_ignore_broadcasts ne 1 >/dev/null 2>&1 &
  439. stig_spinner $!
  440. output "V-38535" $? ${SETLANG}
  441. ################
  442. ##RHEL-06-000093
  443. ##The system must ignore ICMPv4 bogus error responses.
  444. bash $STIG_TESTS_DIR/check-sysctl.sh net.ipv4.icmp_ignore_bogus_error_responses ne 1 >/dev/null 2>&1 &
  445. stig_spinner $!
  446. output "V-38537" $? ${SETLANG}
  447. ################
  448. ##RHEL-06-000095
  449. ##The system must be configured to use TCP syncookies when experiencing a TCP SYN flood.
  450. bash $STIG_TESTS_DIR/check-sysctl.sh net.ipv4.tcp_syncookies ne 1 >/dev/null 2>&1 &
  451. stig_spinner $!
  452. output "V-38539" $? ${SETLANG}
  453. ################
  454. ##RHEL-06-000096
  455. ##The system must use a reverse-path filter for IPv4 network traffic when possible on all interfaces.
  456. bash $STIG_TESTS_DIR/check-sysctl.sh net.ipv4.conf.all.rp_filter ne 1 >/dev/null 2>&1 &
  457. stig_spinner $!
  458. output "V-38542" $? ${SETLANG}
  459. ################
  460. ##RHEL-06-000097
  461. ##The system must use a reverse-path filter for IPv4 network traffic when possible by default.
  462. bash $STIG_TESTS_DIR/check-sysctl.sh net.ipv4.conf.default.rp_filter ne 1 >/dev/null 2>&1 &
  463. stig_spinner $!
  464. output "V-38544" $? ${SETLANG}
  465. ################
  466. ##RHEL-06-000099
  467. ##The system must ignore ICMPv6 redirects by default.
  468. ##If IPv6 is disabled, this is not applicable.
  469. if [ -a /proc/net/if_inet6 ];then
  470. bash $STIG_TESTS_DIR/check-sysctl.sh net.ipv6.conf.default.accept_redirects ne 1 >/dev/null 2>&1 &
  471. stig_spinner $!
  472. output "V-38548" $? ${SETLANG}
  473. fi
  474. ################
  475. ##RHEL-06-000120
  476. ##The systems local IPv4 firewall must implement a deny-all, allow-by-exception policy for inbound
  477. iptables -L INPUT | head -n1 | grep "INPUT.*DROP" >/dev/null 2>&1 &
  478. stig_spinner $!
  479. output "V-38513" $? ${SETLANG}
  480. ################
  481. ##RHEL-06-000138
  482. ##System logs must be rotated daily.
  483. bash $STIG_TESTS_DIR/check-logrotate.sh >/dev/null 2>&1 &
  484. stig_spinner $!
  485. output "V-38624" $? ${SETLANG}
  486. ################
  487. ##RHEL-06-000203
  488. ##The xinetd service must be disabled if no network services utilizing it are enabled.
  489. bash $STIG_TESTS_DIR/check-services.sh xinetd >/dev/null 2>&1 &
  490. stig_spinner $!
  491. output "V-38582" $? ${SETLANG}
  492. ################
  493. ##RHEL-06-000204
  494. ##The xinetd service must be uninstalled if no network services utilizing it are enabled.
  495. bash $STIG_TESTS_DIR/check-packages.sh xinetd >/dev/null 2>&1 &
  496. stig_spinner $!
  497. output "V-38584" $? ${SETLANG}
  498. ################
  499. ##RHEL-06-000206
  500. ##The telnet-server package must not be installed.
  501. bash $STIG_TESTS_DIR/check-packages.sh telnetd >/dev/null 2>&1 &
  502. stig_spinner $!
  503. output "V-38587" $? ${SETLANG}
  504. ################
  505. ##RHEL-06-000211
  506. ##The telnet daemon must not be running.
  507. bash $STIG_TESTS_DIR/check-services.sh telnetd >/dev/null 2>&1 &
  508. stig_spinner $!
  509. output "V-38589" $? ${SETLANG}
  510. ################
  511. ##RHEL-06-000213
  512. ##The rsh-server package must not be installed.
  513. bash $STIG_TESTS_DIR/check-packages.sh rsh-server >/dev/null 2>&1 &
  514. stig_spinner $!
  515. output "V-38591" $? ${SETLANG}
  516. ################
  517. ##RHEL-06-000214
  518. ##The rshd service must not be running.
  519. bash $STIG_TESTS_DIR/check-services.sh rshd >/dev/null 2>&1 &
  520. stig_spinner $!
  521. output "V-38594" $? ${SETLANG}
  522. ################
  523. ##RHEL-06-000216
  524. ##The rexecd service must not be running.
  525. bash $STIG_TESTS_DIR/check-services.sh rexecd >/dev/null 2>&1 &
  526. stig_spinner $!
  527. output "V-38598" $? ${SETLANG}
  528. ################
  529. ##RHEL-06-000218
  530. ##The rlogind service must not be running.
  531. bash $STIG_TESTS_DIR/check-services.sh rlogind >/dev/null 2>&1 &
  532. stig_spinner $!
  533. output "V-38602" $? ${SETLANG}
  534. ################
  535. ##RHEL-06-000220
  536. ##The NIS(ypserv) package must not be installed.
  537. bash $STIG_TESTS_DIR/check-packages.sh nis >/dev/null 2>&1 &
  538. stig_spinner $!
  539. output "V-38603" $? ${SETLANG}
  540. ################
  541. ##RHEL-06-000221
  542. ##The nis(ypbind) service must not be running.
  543. bash $STIG_TESTS_DIR/check-services.sh nis >/dev/null 2>&1 &
  544. stig_spinner $!
  545. output "V-38604" $? ${SETLANG}
  546. ################
  547. ##RHEL-06-000224
  548. ##The cron service must be running.
  549. bash $STIG_TESTS_DIR/check-services.sh cron >/dev/null 2>&1 &
  550. stig_spinner $!
  551. output "V-38605" $? ${SETLANG}
  552. ################
  553. ##Check that openssh client and server are installed
  554. bash $STIG_TESTS_DIR/check-ssh.sh installed >/dev/null 2>&1 &
  555. stig_spinner $!
  556. output "SV-86857r1_rule" $? ${SETLANG}
  557. ################
  558. ##RHEL-06-000227
  559. ##The SSH daemon must be configured to use only the SSHv2 protocol.
  560. bash $STIG_TESTS_DIR/check-ssh.sh Protocol >/dev/null 2>&1 &
  561. stig_spinner $!
  562. output "V-38607" $? ${SETLANG}
  563. ################
  564. ##RHEL-06-000230
  565. ##The SSH daemon must set a timeout interval on idle sessions.
  566. sed -e '/^#/d' -e '/^[ \t][ \t]*#/d' -e 's/#.*$//' -e '/^$/d' /etc/ssh/sshd_config | grep "ClientAliveInterval" >/dev/null 2>&1 &
  567. stig_spinner $!
  568. output "V-38608" $? ${SETLANG}
  569. ################
  570. ##RHEL-06-000231
  571. ##The SSH daemon must set a timeout count on idle sessions.
  572. sed -e '/^#/d' -e '/^[ \t][ \t]*#/d' -e 's/#.*$//' -e '/^$/d' /etc/ssh/sshd_config | grep "ClientAliveCountMax" >/dev/null 2>&1 &
  573. stig_spinner $!
  574. output "V-38610" $? ${SETLANG}
  575. ################
  576. ##RHEL-06-000234
  577. ##The SSH daemon must ignore .rhosts files.
  578. bash $STIG_TESTS_DIR/check-ssh.sh rhosts >/dev/null 2>&1 &
  579. stig_spinner $!
  580. output "V-38611" $? ${SETLANG}
  581. ################
  582. ##RHEL-06-000236
  583. ##The SSH daemon must not allow host-based authentication.
  584. bash $STIG_TESTS_DIR/check-ssh.sh hostauth >/dev/null 2>&1 &
  585. stig_spinner $!
  586. output "V-38612" $? ${SETLANG}
  587. ################
  588. ##RHEL-06-000237
  589. ##The system must not permit root logins using remote access programs such as ssh.
  590. bash $STIG_TESTS_DIR/check-ssh.sh permitroot >/dev/null 2>&1 &
  591. stig_spinner $!
  592. output "V-38613" $? ${SETLANG}
  593. ################
  594. ##RHEL-06-000239
  595. ##The SSH daemon must not allow authentication using an empty password.
  596. bash $STIG_TESTS_DIR/check-ssh.sh emptypassword >/dev/null 2>&1 &
  597. stig_spinner $!
  598. output "V-38615" $? ${SETLANG}
  599. ################
  600. ##RHEL-06-000241
  601. ##The SSH daemon must not permit user environment settings.
  602. bash $STIG_TESTS_DIR/check-ssh.sh emptypasswordenvironment >/dev/null 2>&1 &
  603. stig_spinner $!
  604. output "V-38616" $? ${SETLANG}
  605. ################
  606. ##A FIPS 140-2 approved cryptographic algorithm must be used for SSH communications.
  607. bash $STIG_TESTS_DIR/check-ssh.sh ciphers >/dev/null 2>&1 &
  608. stig_spinner $!
  609. output "SV-86845r2_rule" $? ${SETLANG}
  610. ################
  611. ##The Standard Notice must be displayed immediately prior to, or as part of, remote access logon prompts.
  612. bash $STIG_TESTS_DIR/check-ssh.sh banner >/dev/null 2>&1 &
  613. stig_spinner $!
  614. output "SV-86849r2_rule" $? ${SETLANG}
  615. ################
  616. ##All networked systems must use SSH for confidentiality and integrity of transmitted and received information as well as information during preparation for transmission.
  617. bash $STIG_TESTS_DIR/check-ssh.sh sshd_status >/dev/null 2>&1 &
  618. stig_spinner $!
  619. output "SV-86859r2_rule" $? ${SETLANG}
  620. ################
  621. ##All network connections associated with SSH traffic must terminate at the end of the session or after 10 minutes of inactivity, except to fulfill documented and validated mission requirements.
  622. bash $STIG_TESTS_DIR/check-ssh.sh ClientAliveInterval >/dev/null 2>&1 &
  623. stig_spinner $!
  624. output "SV-86861r2_rule" $? ${SETLANG}
  625. ################
  626. ##The SSH daemon must not allow authentication using RSA rhosts authentication.
  627. bash $STIG_TESTS_DIR/check-ssh.sh RhostsRSAAuthentication >/dev/null 2>&1 &
  628. stig_spinner $!
  629. output "SV-86863r2_rule" $? ${SETLANG}
  630. ################
  631. ##All network connections associated with SSH traffic must terminate after a period of inactivity.
  632. bash $STIG_TESTS_DIR/check-ssh.sh ClientAliveCountMax >/dev/null 2>&1 &
  633. stig_spinner $!
  634. output "SV-86865r2_rule" $? ${SETLANG}
  635. ################
  636. ##The SSH daemon must not allow authentication using rhosts authentication.
  637. bash $STIG_TESTS_DIR/check-ssh.sh IgnoreRhosts >/dev/null 2>&1 &
  638. stig_spinner $!
  639. output "SV-86867r2_rule" $? ${SETLANG}
  640. ################
  641. ##The system must display the date and time of the last successful account logon upon an SSH logon.
  642. bash $STIG_TESTS_DIR/check-ssh.sh PrintLastLog >/dev/null 2>&1 &
  643. stig_spinner $!
  644. output "SV-86869r2_rule" $? ${SETLANG}
  645. ################
  646. ##The system must not permit direct logons to the root account using remote access via SSH.
  647. bash $STIG_TESTS_DIR/check-ssh.sh permitroot >/dev/null 2>&1 &
  648. stig_spinner $!
  649. output "SV-86871r2_rule" $? ${SETLANG}
  650. ################
  651. ##The SSH daemon must not allow authentication using known hosts authentication.
  652. bash $STIG_TESTS_DIR/check-ssh.sh IgnoreUserKnownHosts >/dev/null 2>&1 &
  653. stig_spinner $!
  654. output "SV-86873r2_rule" $? ${SETLANG}
  655. ################
  656. ##The SSH daemon must be configured to only use the SSHv2 protocol.
  657. bash $STIG_TESTS_DIR/check-ssh.sh Protocol >/dev/null 2>&1 &
  658. stig_spinner $!
  659. output "SV-86875r2_rule" $? ${SETLANG}
  660. ################
  661. ##The SSH daemon must be configured to only use Message Authentication Codes (MACs) employing FIPS 140-2 approved cryptographic hash algorithms.
  662. bash $STIG_TESTS_DIR/check-ssh.sh macs >/dev/null 2>&1 &
  663. stig_spinner $!
  664. output "SV-86877r2_rule" $? ${SETLANG}
  665. ################
  666. ##The SSH public host key files must have mode 0644 or less permissive.
  667. bash $STIG_TESTS_DIR/check-ssh.sh pubkeypermissive >/dev/null 2>&1 &
  668. stig_spinner $!
  669. output "SV-86879r1_rule" $? ${SETLANG}
  670. ################
  671. ##The SSH private host key files must have mode 0600 or less permissive.
  672. bash $STIG_TESTS_DIR/check-ssh.sh hostkeypermissive >/dev/null 2>&1 &
  673. stig_spinner $!
  674. output "SV-86881r1_rule" $? ${SETLANG}
  675. ################
  676. ##The SSH daemon must not permit Generic Security Service Application Program Interface (GSSAPI) authentication unless needed.
  677. bash $STIG_TESTS_DIR/check-ssh.sh GSSAPIAuthentication >/dev/null 2>&1 &
  678. stig_spinner $!
  679. output "SV-86883r2_rule" $? ${SETLANG}
  680. ################
  681. ##The SSH daemon must not permit Kerberos authentication unless needed.
  682. bash $STIG_TESTS_DIR/check-ssh.sh KerberosAuthentication >/dev/null 2>&1 &
  683. stig_spinner $!
  684. output "SV-86885r2_rule" $? ${SETLANG}
  685. ################
  686. ##The SSH daemon must perform strict mode checking of home directory configuration files.
  687. bash $STIG_TESTS_DIR/check-ssh.sh StrictModes >/dev/null 2>&1 &
  688. stig_spinner $!
  689. output "SV-86887r2_rule" $? ${SETLANG}
  690. ################
  691. ##The SSH daemon must use privilege separation.
  692. bash $STIG_TESTS_DIR/check-ssh.sh UsePrivilegeSeparation >/dev/null 2>&1 &
  693. stig_spinner $!
  694. output "SV-86889r2_rule" $? ${SETLANG}
  695. ################
  696. ##The SSH daemon must not allow compression or must only allow compression after successful authentication.
  697. bash $STIG_TESTS_DIR/check-ssh.sh Compression >/dev/null 2>&1 &
  698. stig_spinner $!
  699. output "SV-86891r2_rule" $? ${SETLANG}
  700. ################
  701. ##Dont allow remote X connections.
  702. bash $STIG_TESTS_DIR/check-ssh.sh X11Forwarding >/dev/null 2>&1 &
  703. stig_spinner $!
  704. output "SV-86927r2_rule" $? ${SETLANG}
  705. ################
  706. ##Check that pam_python is not installed
  707. bash $STIG_TESTS_DIR/check-ssh.sh pam_python >/dev/null 2>&1 &
  708. stig_spinner $!
  709. output "SV-86724r2_rule" $? ${SETLANG}
  710. ################
  711. ##RHEL-06-000247
  712. ##The system clock must be synchronized continuously, or at least daily.
  713. bash $STIG_TESTS_DIR/check-services.sh ntp >/dev/null 2>&1 &
  714. stig_spinner $!
  715. output "V-38620" $? ${SETLANG}
  716. ################
  717. ##RHEL-06-000248
  718. ##The system clock must be synchronized to an authoritative time source.
  719. bash $STIG_TESTS_DIR/check-ntp-sources.sh >/dev/null 2>&1 &
  720. stig_spinner $!
  721. output "V-38621" $? ${SETLANG}
  722. ################
  723. ##RHEL-06-000252
  724. ##If the system is using LDAP for authentication or account information, the system must use a TLS connection using FIPS 140-2 approved cryptographic algorithms.
  725. #Waiting to figure out
  726. #stig_spinner $!
  727. #output "V-38625" $? ${SETLANG}
  728. ################
  729. ##RHEL-06-000253
  730. ##The LDAP client must use a TLS connection using trust certificates signed by the site CA.
  731. #Waiting to figure out
  732. #stig_spinner $!
  733. #output "V-38626" $? ${SETLANG}
  734. ################
  735. ##RHEL-06-000256
  736. ##The openldap-servers package must not be installed unless required.
  737. bash $STIG_TESTS_DIR/check-packages.sh sldap>/dev/null 2>&1 &
  738. stig_spinner $!
  739. output "V-38627" $? ${SETLANG}
  740. ################
  741. ##RHEL-06-000257
  742. ##The graphical desktop environment must set the idle timeout to no more than 15 minutes.
  743. #stig_spinner $!
  744. #output "V-38629" $? ${SETLANG}
  745. ################
  746. ##RHEL-06-000258
  747. ##The graphical desktop environment must automatically lock after 15 minutes of inactivity and the system must require user reauthentication to unlock the environment.
  748. #stig_spinner $!
  749. #output "V-38630" $? ${SETLANG}
  750. ################
  751. ##RHEL-06-000259
  752. ##The graphical desktop environment must have automatic lock enabled.
  753. #stig_spinner $!
  754. #output "V-38638" $? ${SETLANG}
  755. ################
  756. ##RHEL-06-000260
  757. ##The system must display a publicly-viewable pattern during a graphical desktop environment session lock.
  758. #stig_spinner $!
  759. #output "V-38639" $? ${SETLANG}
  760. ################
  761. ##RHEL-06-000262
  762. ##The atd service must be disabled.
  763. bash $STIG_TESTS_DIR/check-services.sh atd >/dev/null 2>&1 &
  764. stig_spinner $!
  765. output "V-38641" $? ${SETLANG}
  766. ################
  767. ##RHEL-06-000271
  768. ##The noexec option must be added to removable media partitions.
  769. if [ "$(grep -Hv ^0$ /sys/block/*/removable | sed s/removable:.*$/device\\/uevent/ | xargs grep -H ^DRIVER=sd | sed s/device.uevent.*$/size/ | xargs grep -Hv ^0$ | cut -d / -f 4 | wc -l)" -gt 0 ];then
  770. bash $STIG_TESTS_DIR/check-removable.sh >/dev/null 2>&1 &
  771. stig_spinner $!
  772. output "V-38655" $? ${SETLANG}
  773. fi
  774. ################
  775. ##RHEL-06-000272
  776. ##The system must use SMB client signing for connecting to samba servers using smbclient.
  777. bash $STIG_TESTS_DIR/check-depends.sh smb-signing >/dev/null 2>&1 &
  778. stig_spinner $!
  779. output "V-38656" $? ${SETLANG}
  780. ################
  781. ##RHEL-06-000273
  782. ##The system must use SMB client signing for connecting to samba servers using mount.cifs.
  783. bash $STIG_TESTS_DIR/check-depends.sh smb-sec >/dev/null 2>&1 &
  784. stig_spinner $!
  785. output "V-38657" $? ${SETLANG}
  786. ################
  787. ##RHEL-06-000282
  788. ##There must be no world-writable files on the system.
  789. bash $STIG_TESTS_DIR/check-world-writable.sh >/dev/null 2>&1 &
  790. stig_spinner $!
  791. output "V-38643" $? ${SETLANG}
  792. ################
  793. ##RHEL-06-000286
  794. ##The x86 Ctrl-Alt-Delete key sequence must be disabled.
  795. bash $STIG_TESTS_DIR/check-ctrl-alt-del.sh >/dev/null 2>&1 &
  796. stig_spinner $!
  797. output "V-38668" $? ${SETLANG}
  798. ################
  799. ##RHEL-06-000288
  800. ##The sendmail package must be removed.
  801. bash $STIG_TESTS_DIR/check-packages.sh sendmail >/dev/null 2>&1 &
  802. stig_spinner $!
  803. output "V-38671" $? ${SETLANG}
  804. ################
  805. ##RHEL-06-000290
  806. ##X Windows must not be enabled unless required.
  807. bash $STIG_TESTS_DIR/check-services.sh x11-common >/dev/null 2>&1 &
  808. stig_spinner $!
  809. output "V-38674" $? ${SETLANG}
  810. ################
  811. ##RHEL-06-000302
  812. ##A file integrity tool must be used at least weekly to check for unauthorized file changes, particularly the addition of unauthorized system libraries or binaries, or for unauthorized modification to authorized system libraries or binaries.
  813. bash $STIG_TESTS_DIR/check-tripwire-cron.sh > /dev/null 2>&1 &
  814. stig_spinner $!
  815. output "V-38695" $? ${SETLANG}
  816. ################
  817. ##RHEL-06-000018
  818. #For tripwire to be effective, an initial database of "known-good" information about files must be captured and it should be able to be verified against the installed files.
  819. bash $STIG_TESTS_DIR/check-tripwire-baseline.sh > /dev/null 2>&1 &
  820. stig_spinner $!
  821. output "V-51391" $? ${SETLANG}
  822. ################
  823. ##RHEL-06-000308
  824. ##Process core dumps must be disabled unless needed.
  825. bash $STIG_TESTS_DIR/check-limits.sh core-dumps > /dev/null 2>&1 &
  826. stig_spinner $!
  827. output "V-38675" $? ${SETLANG}
  828. ################
  829. ##RHEL-06-000319
  830. ##The system must limit users to 10 simultaneous system logins, or a site-defined number, in accordance with operational requirements.
  831. bash $STIG_TESTS_DIR/check-limits.sh maxlogins > /dev/null 2>&1 &
  832. stig_spinner $!
  833. output "V-38684" $? ${SETLANG}
  834. ################
  835. ##RHEL-06-000320
  836. ##The systems local firewall must implement a deny-all, allow-by-exception policy for forwarded packets.
  837. iptables -L FORWARD | head -n1 | grep "FORWARD.*DROP" >/dev/null 2>&1 &
  838. stig_spinner $!
  839. output "V-38686" $? ${SETLANG}
  840. ################
  841. ##RHEL-06-000331
  842. ##The Bluetooth service must be disabled.
  843. bash $STIG_TESTS_DIR/check-services.sh bluetooth >/dev/null 2>&1 &
  844. stig_spinner $!
  845. output "V-38691" $? ${SETLANG}
  846. ################
  847. ##RHEL-06-000336
  848. ##The sticky bit must be set on all public directories.
  849. bash $STIG_TESTS_DIR/check-sticky-bit.sh >/dev/null 2>&1 &
  850. stig_spinner $!
  851. output "V-38697" $? ${SETLANG}
  852. ################
  853. ##RHEL-06-000337
  854. ##All public directories must be owned by a system account.
  855. bash $STIG_TESTS_DIR/check-public-dir-owned.sh >/dev/null 2>&1 &
  856. stig_spinner $!
  857. output "V-38699" $? ${SETLANG}
  858. ################
  859. ##RHEL-06-000345
  860. ##The system default umask in /etc/login.defs must be 077.
  861. ##For more detial :http://stackoverflow.com/questions/10220531/how-to-set-system-wide-umask
  862. sed -e '/^#/d' -e '/^[ \t][ \t]*#/d' -e 's/#.*$//' -e '/^$/d' /etc/login.defs | grep -i "umask.*077" >/dev/null 2>&1 &
  863. stig_spinner $!
  864. output "V-38645" $? ${SETLANG}
  865. ################
  866. ##RHEL-06-000347
  867. ##There must be no .netrc files on the system.
  868. bash $STIG_TESTS_DIR/check-netrc.sh >/dev/null 2>&1 &
  869. stig_spinner $!
  870. output "V-38619" $? ${SETLANG}
  871. ################
  872. ##RHEL-06-000372
  873. ##The operating system, upon successful logon/access, must display to the user the number of unsuccessful logon/access attempts since the last successful logon/access.
  874. sed -e '/^#/d' -e '/^[ \t][ \t]*#/d' -e 's/#.*$//' -e '/^$/d' /etc/pam.d/common-session | grep -i "pam_lastlog.so.*showfailed" > /dev/null 2>&1 &
  875. stig_spinner $!
  876. output "V-38501" $? ${SETLANG}
  877. ################
  878. ##RHEL-06-000507
  879. ##The operating system, upon successful logon, must display to the user the date and time of the last logon or access via ssh.
  880. sed -e '/^#/d' -e '/^[ \t][ \t]*#/d' -e 's/#.*$//' -e '/^$/d' /etc/ssh/sshd_config | grep -i "^PrintLastLog.*yes" > /dev/null 2>&1 &
  881. stig_spinner $!
  882. output "V-38484" $? ${SETLANG}
  883. ################
  884. ##RHEL-06-000514
  885. ##The package management tool must cryptographically verify the authenticity of all software packages during installation.
  886. bash $STIG_TESTS_DIR/check-apt-gpg.sh > /dev/null 2>&1 &
  887. stig_spinner $!
  888. output "V-38462" $? ${SETLANG}
  889. ################
  890. ##RHEL-06-000523
  891. ##The systems local IPv6 firewall must implement a deny-all, allow-by-exception policy for inbound packets.
  892. ip6tables -L INPUT | head -n1 | grep "INPUT.*DROP" > /dev/null 2>&1 &
  893. stig_spinner $!
  894. output "V-38444" $? ${SETLANG}
  895. ################
  896. ##RHEL-06-000526
  897. ##Automated file system mounting tools must not be enabled unless needed.
  898. bash $STIG_TESTS_DIR/check-services.sh autofs >/dev/null 2>&1 &
  899. stig_spinner $!
  900. output "V-38437" $? ${SETLANG}
  901. ################
  902. ##RHEL-06-000528
  903. ##The noexec option must be added to the /tmp partition.
  904. sed -e '/^#/d' -e '/^[ \t][ \t]*#/d' -e 's/#.*$//' -e '/^$/d' /etc/fstab | grep "/tmp.*noexec" >/dev/null 2>&1 &
  905. stig_spinner $!
  906. output "V-57569" $? ${SETLANG}
  907. ################
  908. ##RHEL-06-000529
  909. ##The sudo command must require authentication.
  910. bash $STIG_TESTS_DIR/check-sudo.sh >/dev/null 2>&1 &
  911. stig_spinner $!
  912. output "V-58901" $? ${SETLANG}
  913. ################
  914. show_passes_fails=
  915. if [ $SHOW_ALL_TESTS ]; then
  916. show_passes_fails=1
  917. else
  918. if [ "$FAILS" -gt 0 ]; then
  919. show_passes_fails=1
  920. fi
  921. fi
  922. if [ $show_passes_fails ]; then
  923. echo ''
  924. echo $"Passes: $PASSES"
  925. echo $"Fails: $FAILS"
  926. if [ "$FAILS" -gt 0 ]; then
  927. exit 792353
  928. fi
  929. fi
  930. }
  931. while [ $# -gt 1 ]
  932. do
  933. key="$1"
  934. case $key in
  935. -h|--help)
  936. show_help
  937. ;;
  938. -a|--static)
  939. echo $'Running static analysis tests'
  940. test_static_analysis
  941. echo $'All tests passed'
  942. exit 0
  943. ;;
  944. -s|--stig)
  945. shift
  946. if [[ "$1" == 'showall' ]]; then
  947. SHOW_ALL_TESTS=1
  948. fi
  949. RUN_STIG="$1"
  950. ;;
  951. *)
  952. # unknown option
  953. ;;
  954. esac
  955. shift
  956. done
  957. if [ ! "$RUN_STIG" ]; then
  958. echo $'Running tests'
  959. fi
  960. test_app_functions
  961. test_unique_onion_ports
  962. remove_management_engine_interface
  963. freedombone-pass --test yes
  964. fix_stig
  965. test_stig
  966. if [ ! "$RUN_STIG" ]; then
  967. echo $'All tests passed'
  968. fi
  969. exit 0