Newer
Older
# _____ _ _
# | __|___ ___ ___ _| |___ _____| |_ ___ ___ ___
# | __| _| -_| -_| . | . | | . | . | | -_|
# |__| |_| |___|___|___|___|_|_|_|___|___|_|_|___|
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
PROJECT_NAME='freedombone'
export TEXTDOMAIN=${PROJECT_NAME}-tests
export TEXTDOMAINDIR="/usr/share/locale"
source "/usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-setup"
RUN_STIG=
# Whether to show both passes and fails of STIG tests
SHOW_ALL_TESTS=
echo ''
echo $"${PROJECT_NAME}-tests"
echo ''
echo $'Runs tests on the system'
echo ''
echo $' -s --stig [yes|no|fix] Run STIG tests'
echo $' -a --static Run static analysis on scripts'
function test_curl_bash {
FILES="/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-*"
for filename in $FILES
do
curl_bash=$(grep "curl" "$filename" | grep "|" | grep "bash\\| sh")
echo ''
echo $"${filename} curl piped to bash or sh"
fi
done
FILES="/usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-*"
for filename in $FILES
do
curl_bash=$(grep "curl" "$filename" | grep "|" | grep "bash\\| sh")
echo ''
echo $"${filename} curl piped to bash or sh"
function test_for_merge_errors {
FILES="/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-*"
for filename in $FILES
do
if grep -q "<<<<<" "$filename"; then
echo ''
echo $"${filename} merge error"
fi
done
FILES="/usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-*"
for filename in $FILES
do
if grep -q "<<<<<" "$filename"; then
echo ''
echo $"${filename} merge error"
function test_app_function_type {
filename=$1
fn_type=$2
app_name=$(echo "${filename}" | awk -F '-app-' '{print $2}')
app_function=$(grep "function ${fn_type}_${app_name} {" "${filename}" | awk -F "${fn_type}_" '{print $2}' | awk -F ' ' '{print $1}')
if [ ! "${app_function}" ]; then
echo $"Application ${app_name} does not contain a function called '${fn_type}_${app_name}'"
echo ''
echo "See ${filename}"
STATIC_ANALYSIS_EXCLUDED='SC2034,SC1090'
FILES="/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-*"
for filename in $FILES
do
if ! shellcheck --exclude "$STATIC_ANALYSIS_EXCLUDED" "$filename"; then
echo ''
echo $"${filename} failed static analysis"
fi
done
FILES="/usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-*"
for filename in $FILES
do
if ! shellcheck --exclude "$STATIC_ANALYSIS_EXCLUDED" "$filename"; then
echo ''
echo $"${filename} failed static analysis"
fi
done
FILES="/usr/local/bin/${PROJECT_NAME}-*"
for filename in $FILES
do
if [[ "$filename" == *"-config-qtox" || "$filename" == *"-image-make"* ]]; then
if ! shellcheck --exclude "$STATIC_ANALYSIS_EXCLUDED" "$filename"; then
echo ''
echo $"${filename} failed static analysis"
if [ $RUN_STIG ]; then
return
fi
interface_functions=( install remove backup_local restore_local upgrade reconfigure )
# for all the app scripts
for filename in $FILES
do
# for each expected interface function
# shellcheck disable=SC2068
for f in ${interface_functions[@]}
if [ $RUN_STIG ]; then
return
fi
# test that some services are not assigned the same onion port
FILES="/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-*"
# shellcheck disable=SC2086
ports=$(grep -r "_ONION_PORT=" $FILES | awk -F ':' '{print $2}' | uniq | awk -F '=' '{print $2}')
# shellcheck disable=SC2086
unique_ports=$(grep -r "_ONION_PORT=" $FILES | awk -F ':' '{print $2}' | uniq | awk -F '=' '{print $2}' | uniq)
if [[ "$ports" != "$unique_ports" ]]; then
echo $'Some onion ports are clashing'
# shellcheck disable=SC2086
grep -r "_ONION_PORT=" $FILES | awk -F ':' '{print $2}' | uniq
function stig_log_msg {
ESTATUS=$1
RED=$(tput setaf 1)
BOLD=$(tput bold)
GREEN=$(tput setaf 2)
NORMAL=$(tput sgr0)
MSG="$2"
printf "%s %s" "$GREEN$BOLD[ PASS ]$NORMAL" "$MSG"
echo
else
printf "%s %s" "$RED$BOLD[ FAIL ]$NORMAL" "$MSG"
echo
fi
}
function stig_spinner {
local pid=$1
local delay=0.1
while [ "$(ps -a | awk '{print $1}' | grep "$pid")" ];
do
sleep $delay
done
}
function disallow_package {
package_name=$1
if service --status-all | grep "+.*${package_name}";then
function fix_stig {
if [[ $RUN_STIG != 'fix' ]]; then
return
fi
function test_stig {
if [ ! $RUN_STIG ]; then
return
fi
STIG_TESTS_DIR=tests
if [ ! -d $STIG_TESTS_DIR ]; then
STIG_TESTS_DIR=~/${PROJECT_NAME}/tests
if [ ! -d $STIG_TESTS_DIR ]; then
echo $'No tests were found'
fi
fi
CATCOLOR=1
SETLANG="en"
##RHEL-06-000001
##The system must use a separate file system for /tmp.
mount | grep "on /tmp " >/dev/null 2>&1 &
stig_spinner $!
output "V-38455" $? ${SETLANG}
################
##RHEL-06-000008
##Vendor-provided cryptographic certificates must be installed to verify the integrity of system software.
bash $STIG_TESTS_DIR/check-apt-key.sh >/dev/null 2>&1 &
stig_spinner $!
output "V-38476" $? ${SETLANG}
################
##RHEL-06-000016
##A file integrity tool must be installed.
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
stig_spinner $!
output "V-38489" $? ${SETLANG}
################
##RHEL-06-000019
##There must be no .rhosts or hosts.equiv files on the system.
bash $STIG_TESTS_DIR/check-rhosts.sh > /dev/null 2>&1 &
stig_spinner $!
output "V-38491" $? ${SETLANG}
################
##RHEL-06-000027
##The system must prevent the root account from logging in from virtual consoles.
bash $STIG_TESTS_DIR/check-consoles.sh virtual > /dev/null 2>&1 &
stig_spinner $!
output "V-38492" $? ${SETLANG}
################
##RHEL-06-000028
##The system must prevent the root account from logging in from serial consoles.
bash $STIG_TESTS_DIR/check-consoles.sh serial > /dev/null 2>&1 &
stig_spinner $!
output "V-38494" $? ${SETLANG}
################
##RHEL-06-000029
##Default operating system accounts, other than root, must be locked.
bash $STIG_TESTS_DIR/check-default-account.sh > /dev/null 2>&1 &
stig_spinner $!
output "V-38496" $? ${SETLANG}
################
##RHEL-06-000031
##The /etc/passwd file must not contain password hashes.
awk -F: '($2 != "x") {print; err=1} END {exit err}' /etc/passwd > /dev/null 2>&1 &
stig_spinner $!
output "V-38499" $? ${SETLANG}
################
##RHEL-06-000032
##The root account must be the only account having a UID of 0.
bash $STIG_TESTS_DIR/check-root-uid.sh > /dev/null 2>&1 &
stig_spinner $!
output "V-38500" $? ${SETLANG}
################
##RHEL-06-000033
##The /etc/shadow file must be owned by root.
ls -l /etc/shadow | awk '{print $3}' | grep "^root$" > /dev/null 2>&1 &
stig_spinner $!
output "V-38502" $? ${SETLANG}
################
##RHEL-06-000034
##The /etc/shadow file must be group-owned by root.
ls -l /etc/shadow | awk '{print $4}' | grep "^root$" > /dev/null 2>&1 &
stig_spinner $!
output "V-38503" $? ${SETLANG}
################
##RHEL-06-000035
##The /etc/shadow file must have mode 0000.
ls -l /etc/shadow | awk '{print $1}' | grep "^----------$" > /dev/null 2>&1 &
stig_spinner $!
output "V-38504" $? ${SETLANG}
################
##RHEL-06-000036
##The /etc/gshadow file must be owned by root.
ls -l /etc/gshadow | awk '{print $3}' | grep "^root$" > /dev/null 2>&1 &
stig_spinner $!
output "V-38443" $? ${SETLANG}
################
##RHEL-06-000037
##The /etc/gshadow file must be group-owned by root.
ls -l /etc/gshadow | awk '{print $4}' | grep "^root$" > /dev/null 2>&1 &
stig_spinner $!
output "V-38448" $? ${SETLANG}
################
##RHEL-06-000038
##The /etc/gshadow file must have mode 0000.
ls -l /etc/gshadow | awk '{print $1}' | grep "^----------$" > /dev/null 2>&1 &
stig_spinner $!
output "V-38449" $? ${SETLANG}
################
##RHEL-06-000039
##The /etc/passwd file must be owned by root.
ls -l /etc/passwd | awk '{print $3}' | grep "^root$" > /dev/null 2>&1 &
stig_spinner $!
output "V-38450" $? ${SETLANG}
################
##RHEL-06-000040
##The /etc/passwd file must be group-owned by root.
ls -l /etc/passwd | awk '{print $4}' | grep "^root$" > /dev/null 2>&1 &
stig_spinner $!
output "V-38451" $? ${SETLANG}
################
##RHEL-06-000041
##The /etc/passwd file must have mode 0644 or less permissive.
bash $STIG_TESTS_DIR/check-mode.sh /etc/passwd 644 > /dev/null 2>&1 &
stig_spinner $!
output "V-38457" $? ${SETLANG}
################
##RHEL-06-000042
##The /etc/group file must be owned by root.
ls -l /etc/group | awk '{print $3}' | grep "^root$" > /dev/null 2>&1 &
stig_spinner $!
output "V-38458" $? ${SETLANG}
################
##RHEL-06-000043
##The /etc/group file must be group-owned by root.
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
ls -l /etc/group | awk '{print $4}' | grep "^root$" > /dev/null 2>&1 &
stig_spinner $!
output "V-38459" $? ${SETLANG}
################
##RHEL-06-000044
##The /etc/group file must have mode 0644 or less permissive.
bash $STIG_TESTS_DIR/check-mode.sh "/etc/group" 644 > /dev/null 2>&1 &
stig_spinner $!
output "V-38461" $? ${SETLANG}
################
##RHEL-06-000045
##Library files must have mode 0755 or less permissive.
bash $STIG_TESTS_DIR/check-libs-mode.sh > /dev/null 2>&1 &
stig_spinner $!
output "V-38465" $? ${SETLANG}
################
##RHEL-06-000046
##Library files must be owned by root.
bash $STIG_TESTS_DIR/check-libs-owner.sh > /dev/null 2>&1 &
stig_spinner $!
output "V-38466" $? ${SETLANG}
################
##RHEL-06-000047
##All system command files must have mode 755 or less permissive.
bash $STIG_TESTS_DIR/check-cmd-mode.sh > /dev/null 2>&1 &
stig_spinner $!
output "V-38469" $? ${SETLANG}
################
##RHEL-06-000048
##All system command files must be owned by root.
bash $STIG_TESTS_DIR/check-cmd-owner.sh > /dev/null 2>&1 &
stig_spinner $!
output "V-38472" $? ${SETLANG}
################
##RHEL-06-000061
##The system must disable accounts after ten consecutive unsuccessful logon attempts.
bash $STIG_TESTS_DIR/check-password.sh /etc/pam.d/common-auth pam_tally deny gt 10 > /dev/null 2>&1 &
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
stig_spinner $!
output "V-38573" $? ${SETLANG}
################
##RHEL-06-000062
##The system must use a FIPS 140-2 approved cryptographic hashing algorithm for generating account password hashes (system-auth).
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 &
stig_spinner $!
output "V-38574" $? ${SETLANG}
################
##RHEL-06-000063
##The system must use a FIPS 140-2 approved cryptographic hashing algorithm for generating account password hashes (login.defs).
sed -e '/^#/d' -e '/^[ \t][ \t]*#/d' -e 's/#.*$//' -e '/^$/d' /etc/login.defs | grep "ENCRYPT_METHOD.*SHA512" > /dev/null 2>&1 &
stig_spinner $!
output "V-38576" $? ${SETLANG}
################
##RHEL-06-000064
##The system must use a FIPS 140-2 approved cryptographic hashing algorithm for generating account password hashes (libuser.conf).
bash $STIG_TESTS_DIR/check-depends.sh > /dev/null 2>&1 &
stig_spinner $!
output "V-38577" $? ${SETLANG}
################
##RHEL-06-000071
##The system must allow locking of the console screen in text mode.
dpkg -s screen >/dev/null 2>&1 &
stig_spinner $!
output "V-38590" $? ${SETLANG}
################
##RHEL-06-000078
##The system must implement virtual address space randomization.
bash $STIG_TESTS_DIR/check-sysctl.sh kernel.randomize_va_space ne 2 >/dev/null 2>&1 &
stig_spinner $!
output "V-38596" $? ${SETLANG}
################
##RHEL-06-000080
##The system must not send ICMPv4 redirects by default.
bash $STIG_TESTS_DIR/check-sysctl.sh net.ipv4.conf.default.send_redirects ne 0 >/dev/null 2>&1 &
stig_spinner $!
output "V-38600" $? ${SETLANG}
################
##RHEL-06-000081
##The system must not send ICMPv4 redirects from any interface.
bash $STIG_TESTS_DIR/check-sysctl.sh net.ipv4.conf.all.send_redirects ne 0 >/dev/null 2>&1 &
stig_spinner $!
output "V-38601" $? ${SETLANG}
################
##RHEL-06-000082
##IP forwarding for IPv4 must not be enabled, unless the system is a router.
bash $STIG_TESTS_DIR/check-sysctl.sh net.ipv4.ip_forward ne 0 >/dev/null 2>&1 &
stig_spinner $!
output "V-38511" $? ${SETLANG}
################
##RHEL-06-000083
##The system must not accept IPv4 source-routed packets on any interface.
bash $STIG_TESTS_DIR/check-sysctl.sh net.ipv4.conf.all.accept_source_route ne 0 >/dev/null 2>&1 &
stig_spinner $!
output "V-38523" $? ${SETLANG}
################
##RHEL-06-000084
##The system must not accept ICMPv4 redirect packets on any interface.
bash $STIG_TESTS_DIR/check-sysctl.sh net.ipv4.conf.all.accept_redirects ne 0 >/dev/null 2>&1 &
stig_spinner $!
output "V-38524" $? ${SETLANG}
################
##RHEL-06-000086
##The system must not accept ICMPv4 secure redirect packets on any interface.
bash $STIG_TESTS_DIR/check-sysctl.sh net.ipv4.conf.all.secure_redirects ne 0 >/dev/null 2>&1 &
stig_spinner $!
output "V-38526" $? ${SETLANG}
################
##RHEL-06-000089
##The system must not accept IPv4 source-routed packets by default.
bash $STIG_TESTS_DIR/check-sysctl.sh net.ipv4.conf.default.accept_source_route ne 0 >/dev/null 2>&1 &
stig_spinner $!
output "V-38529" $? ${SETLANG}
################
##RHEL-06-000090
##The system must not accept ICMPv4 secure redirect packets by default.
bash $STIG_TESTS_DIR/check-sysctl.sh net.ipv4.conf.default.secure_redirects ne 0 >/dev/null 2>&1 &
stig_spinner $!
output "V-38532" $? ${SETLANG}
################
##RHEL-06-000091
##The system must ignore ICMPv4 redirect messages by default.
bash $STIG_TESTS_DIR/check-sysctl.sh net.ipv4.conf.default.accept_redirects ne 0 >/dev/null 2>&1 &
stig_spinner $!
output "V-38533" $? ${SETLANG}
################
##RHEL-06-000092
##The system must not respond to ICMPv4 sent to a broadcast address.
bash $STIG_TESTS_DIR/check-sysctl.sh net.ipv4.icmp_echo_ignore_broadcasts ne 1 >/dev/null 2>&1 &
stig_spinner $!
output "V-38535" $? ${SETLANG}
################
##RHEL-06-000093
##The system must ignore ICMPv4 bogus error responses.
bash $STIG_TESTS_DIR/check-sysctl.sh net.ipv4.icmp_ignore_bogus_error_responses ne 1 >/dev/null 2>&1 &
stig_spinner $!
output "V-38537" $? ${SETLANG}
################
##RHEL-06-000095
##The system must be configured to use TCP syncookies when experiencing a TCP SYN flood.
bash $STIG_TESTS_DIR/check-sysctl.sh net.ipv4.tcp_syncookies ne 1 >/dev/null 2>&1 &
stig_spinner $!
output "V-38539" $? ${SETLANG}
################
##RHEL-06-000096
##The system must use a reverse-path filter for IPv4 network traffic when possible on all interfaces.
bash $STIG_TESTS_DIR/check-sysctl.sh net.ipv4.conf.all.rp_filter ne 1 >/dev/null 2>&1 &
stig_spinner $!
output "V-38542" $? ${SETLANG}
################
##RHEL-06-000097
##The system must use a reverse-path filter for IPv4 network traffic when possible by default.
bash $STIG_TESTS_DIR/check-sysctl.sh net.ipv4.conf.default.rp_filter ne 1 >/dev/null 2>&1 &
stig_spinner $!
output "V-38544" $? ${SETLANG}
################
##RHEL-06-000099
##The system must ignore ICMPv6 redirects by default.
##If IPv6 is disabled, this is not applicable.
if [ -a /proc/net/if_inet6 ];then
bash $STIG_TESTS_DIR/check-sysctl.sh net.ipv6.conf.default.accept_redirects ne 1 >/dev/null 2>&1 &
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
stig_spinner $!
output "V-38548" $? ${SETLANG}
fi
################
##RHEL-06-000120
##The systems local IPv4 firewall must implement a deny-all, allow-by-exception policy for inbound
iptables -L INPUT | head -n1 | grep "INPUT.*DROP" >/dev/null 2>&1 &
stig_spinner $!
output "V-38513" $? ${SETLANG}
################
##RHEL-06-000138
##System logs must be rotated daily.
bash $STIG_TESTS_DIR/check-logrotate.sh >/dev/null 2>&1 &
stig_spinner $!
output "V-38624" $? ${SETLANG}
################
##RHEL-06-000203
##The xinetd service must be disabled if no network services utilizing it are enabled.
bash $STIG_TESTS_DIR/check-services.sh xinetd >/dev/null 2>&1 &
stig_spinner $!
output "V-38582" $? ${SETLANG}
################
##RHEL-06-000204
##The xinetd service must be uninstalled if no network services utilizing it are enabled.
bash $STIG_TESTS_DIR/check-packages.sh xinetd >/dev/null 2>&1 &
stig_spinner $!
output "V-38584" $? ${SETLANG}
################
##RHEL-06-000206
##The telnet-server package must not be installed.
bash $STIG_TESTS_DIR/check-packages.sh telnetd >/dev/null 2>&1 &
stig_spinner $!
output "V-38587" $? ${SETLANG}
################
##RHEL-06-000211
##The telnet daemon must not be running.
bash $STIG_TESTS_DIR/check-services.sh telnetd >/dev/null 2>&1 &
stig_spinner $!
output "V-38589" $? ${SETLANG}
################
##RHEL-06-000213
##The rsh-server package must not be installed.
bash $STIG_TESTS_DIR/check-packages.sh rsh-server >/dev/null 2>&1 &
stig_spinner $!
output "V-38591" $? ${SETLANG}
################
##RHEL-06-000214
##The rshd service must not be running.
bash $STIG_TESTS_DIR/check-services.sh rshd >/dev/null 2>&1 &
stig_spinner $!
output "V-38594" $? ${SETLANG}
################
##RHEL-06-000216
##The rexecd service must not be running.
bash $STIG_TESTS_DIR/check-services.sh rexecd >/dev/null 2>&1 &
stig_spinner $!
output "V-38598" $? ${SETLANG}
################
##RHEL-06-000218
##The rlogind service must not be running.
bash $STIG_TESTS_DIR/check-services.sh rlogind >/dev/null 2>&1 &
stig_spinner $!
output "V-38602" $? ${SETLANG}
################
##RHEL-06-000220
##The NIS(ypserv) package must not be installed.
bash $STIG_TESTS_DIR/check-packages.sh nis >/dev/null 2>&1 &
stig_spinner $!
output "V-38603" $? ${SETLANG}
################
##RHEL-06-000221
##The nis(ypbind) service must not be running.
bash $STIG_TESTS_DIR/check-services.sh nis >/dev/null 2>&1 &
stig_spinner $!
output "V-38604" $? ${SETLANG}
################
##RHEL-06-000224
##The cron service must be running.
bash $STIG_TESTS_DIR/check-services.sh cron >/dev/null 2>&1 &
stig_spinner $!
output "V-38605" $? ${SETLANG}
################
##Check that openssh client and server are installed
bash $STIG_TESTS_DIR/check-ssh.sh installed >/dev/null 2>&1 &
stig_spinner $!
output "SV-86857r1_rule" $? ${SETLANG}
################
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
##RHEL-06-000227
##The SSH daemon must be configured to use only the SSHv2 protocol.
bash $STIG_TESTS_DIR/check-ssh.sh Protocol >/dev/null 2>&1 &
stig_spinner $!
output "V-38607" $? ${SETLANG}
################
##RHEL-06-000230
##The SSH daemon must set a timeout interval on idle sessions.
sed -e '/^#/d' -e '/^[ \t][ \t]*#/d' -e 's/#.*$//' -e '/^$/d' /etc/ssh/sshd_config | grep "ClientAliveInterval" >/dev/null 2>&1 &
stig_spinner $!
output "V-38608" $? ${SETLANG}
################
##RHEL-06-000231
##The SSH daemon must set a timeout count on idle sessions.
sed -e '/^#/d' -e '/^[ \t][ \t]*#/d' -e 's/#.*$//' -e '/^$/d' /etc/ssh/sshd_config | grep "ClientAliveCountMax" >/dev/null 2>&1 &
stig_spinner $!
output "V-38610" $? ${SETLANG}
################
##RHEL-06-000234
##The SSH daemon must ignore .rhosts files.
bash $STIG_TESTS_DIR/check-ssh.sh rhosts >/dev/null 2>&1 &
stig_spinner $!
output "V-38611" $? ${SETLANG}
################
##RHEL-06-000236
##The SSH daemon must not allow host-based authentication.
bash $STIG_TESTS_DIR/check-ssh.sh hostauth >/dev/null 2>&1 &
stig_spinner $!
output "V-38612" $? ${SETLANG}
################
##RHEL-06-000237
##The system must not permit root logins using remote access programs such as ssh.
bash $STIG_TESTS_DIR/check-ssh.sh permitroot >/dev/null 2>&1 &
stig_spinner $!
output "V-38613" $? ${SETLANG}
################
##RHEL-06-000239
##The SSH daemon must not allow authentication using an empty password.
bash $STIG_TESTS_DIR/check-ssh.sh emptypassword >/dev/null 2>&1 &
stig_spinner $!
output "V-38615" $? ${SETLANG}
################
##RHEL-06-000241
##The SSH daemon must not permit user environment settings.
bash $STIG_TESTS_DIR/check-ssh.sh emptypasswordenvironment >/dev/null 2>&1 &
stig_spinner $!
output "V-38616" $? ${SETLANG}
################
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
##A FIPS 140-2 approved cryptographic algorithm must be used for SSH communications.
bash $STIG_TESTS_DIR/check-ssh.sh ciphers >/dev/null 2>&1 &
stig_spinner $!
output "SV-86845r2_rule" $? ${SETLANG}
################
##The Standard Notice must be displayed immediately prior to, or as part of, remote access logon prompts.
bash $STIG_TESTS_DIR/check-ssh.sh banner >/dev/null 2>&1 &
stig_spinner $!
output "SV-86849r2_rule" $? ${SETLANG}
################
##All networked systems must use SSH for confidentiality and integrity of transmitted and received information as well as information during preparation for transmission.
bash $STIG_TESTS_DIR/check-ssh.sh sshd_status >/dev/null 2>&1 &
stig_spinner $!
output "SV-86859r2_rule" $? ${SETLANG}
################
##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.
bash $STIG_TESTS_DIR/check-ssh.sh ClientAliveInterval >/dev/null 2>&1 &
stig_spinner $!
output "SV-86861r2_rule" $? ${SETLANG}
################
##The SSH daemon must not allow authentication using RSA rhosts authentication.
bash $STIG_TESTS_DIR/check-ssh.sh RhostsRSAAuthentication >/dev/null 2>&1 &
stig_spinner $!
output "SV-86863r2_rule" $? ${SETLANG}
################
##All network connections associated with SSH traffic must terminate after a period of inactivity.
bash $STIG_TESTS_DIR/check-ssh.sh ClientAliveCountMax >/dev/null 2>&1 &
stig_spinner $!
output "SV-86865r2_rule" $? ${SETLANG}
################
##The SSH daemon must not allow authentication using rhosts authentication.
bash $STIG_TESTS_DIR/check-ssh.sh IgnoreRhosts >/dev/null 2>&1 &
stig_spinner $!
output "SV-86867r2_rule" $? ${SETLANG}
################
##The system must display the date and time of the last successful account logon upon an SSH logon.
bash $STIG_TESTS_DIR/check-ssh.sh PrintLastLog >/dev/null 2>&1 &
stig_spinner $!
output "SV-86869r2_rule" $? ${SETLANG}
################
##The system must not permit direct logons to the root account using remote access via SSH.
bash $STIG_TESTS_DIR/check-ssh.sh permitroot >/dev/null 2>&1 &
stig_spinner $!
output "SV-86871r2_rule" $? ${SETLANG}
################
##The SSH daemon must not allow authentication using known hosts authentication.
bash $STIG_TESTS_DIR/check-ssh.sh IgnoreUserKnownHosts >/dev/null 2>&1 &
stig_spinner $!
output "SV-86873r2_rule" $? ${SETLANG}
################
##The SSH daemon must be configured to only use the SSHv2 protocol.
bash $STIG_TESTS_DIR/check-ssh.sh Protocol >/dev/null 2>&1 &
stig_spinner $!
output "SV-86875r2_rule" $? ${SETLANG}
################
##The SSH daemon must be configured to only use Message Authentication Codes (MACs) employing FIPS 140-2 approved cryptographic hash algorithms.
bash $STIG_TESTS_DIR/check-ssh.sh macs >/dev/null 2>&1 &
stig_spinner $!
output "SV-86877r2_rule" $? ${SETLANG}
################
##The SSH public host key files must have mode 0644 or less permissive.
bash $STIG_TESTS_DIR/check-ssh.sh pubkeypermissive >/dev/null 2>&1 &
stig_spinner $!
output "SV-86879r1_rule" $? ${SETLANG}
################
##The SSH private host key files must have mode 0600 or less permissive.
bash $STIG_TESTS_DIR/check-ssh.sh hostkeypermissive >/dev/null 2>&1 &
stig_spinner $!
output "SV-86881r1_rule" $? ${SETLANG}
################
##The SSH daemon must not permit Generic Security Service Application Program Interface (GSSAPI) authentication unless needed.
bash $STIG_TESTS_DIR/check-ssh.sh GSSAPIAuthentication >/dev/null 2>&1 &
stig_spinner $!
output "SV-86883r2_rule" $? ${SETLANG}
################
##The SSH daemon must not permit Kerberos authentication unless needed.
bash $STIG_TESTS_DIR/check-ssh.sh KerberosAuthentication >/dev/null 2>&1 &
stig_spinner $!
output "SV-86885r2_rule" $? ${SETLANG}
################
##The SSH daemon must perform strict mode checking of home directory configuration files.
bash $STIG_TESTS_DIR/check-ssh.sh StrictModes >/dev/null 2>&1 &
stig_spinner $!
output "SV-86887r2_rule" $? ${SETLANG}
################
##The SSH daemon must use privilege separation.
bash $STIG_TESTS_DIR/check-ssh.sh UsePrivilegeSeparation >/dev/null 2>&1 &
stig_spinner $!
output "SV-86889r2_rule" $? ${SETLANG}
################
##The SSH daemon must not allow compression or must only allow compression after successful authentication.
bash $STIG_TESTS_DIR/check-ssh.sh Compression >/dev/null 2>&1 &