/
check.sh
executable file
·2082 lines (1418 loc) · 51.4 KB
/
check.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
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
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
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
504
505
506
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
689
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
813
814
815
816
817
818
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
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
#!/bin/bash
VERSION='0.1'
DATE=`date +%F`
LOG=/var/log/STIG-Checking-$DATE.log
# support en(English) and cn(chinese)
SETLANG="en"
# Script Version
function version() {
echo "STIG For Debian (v.$VERSION)"
}
function usage() {
cat << EOF
usage: $0 [options]
-c Output Log with catable colors
-C Use Chinese output Log with catable colors
-s Perform STIG checking with NORMAL output log
-v Show version
-h Show this message
Default log file location at /var/log/STIG-Checking-*.log
STIG Check for Debian (v$VERSION)
Port DISA RHEL 6 STIG V1R7 for Debian
EOF
}
if [ $# -eq 0 ];then
usage
exit 1
elif [ $# -gt 1 ];then
tput setaf 1;echo -e "\033[1mERROR: Invalid Option Provided!\033[0m";tput sgr0
echo
usage
exit 1
fi
while getopts ":csvhqC" OPTION; do
case $OPTION in
c) CATCOLOR=1
;;
s)
;;
v)
version
exit 0
;;
h)
usage
exit 0
;;
C)
CATCOLOR=1
SETLANG="CN"
;;
?)
tput setaf 1;echo -e "\033[1mERROR: Invalid Option Provided!\033[0m";tput sgr0
echo
usage
exit 1
;;
esac
done
if [[ $EUID -ne 0 ]]; then
echo
tput setaf 1; #Setting Output Color To Red
echo -e "\033[1mPlease re-run this script as root!\033[0m";
tput sgr0 #Turn off all attributes
exit 1
fi
# CREATE LOG IF IT DOESN'T EXISIT
if [ ! -e $LOG ]; then
touch $LOG
fi
RUNTIME=$(date)
printf "SCRIPT RUN: $RUNTIME\nStarting Checking...\n\n" | tee $LOG
log_msg(){
ESTATUS=$1
RED=$(tput setaf 1)
BOLD=$(tput bold)
GREEN=$(tput setaf 2)
NORMAL=$(tput sgr0)
MSG="$2"
#let COL1=$(tput cols)-${#MSG}+${#GREEN}+${#NORMAL}+${#BOLD}-4
#let COL2=$(tput cols)-${#MSG}+${#RED}+${#NORMAL}+${#BOLD}-4
#
if [ $ESTATUS -eq 0 ];then
#printf "%s%${COL1}s" "$MSG" "$GREEN$BOLD[ PASS ]$NORMAL"
printf "%s %s" "$GREEN$BOLD[ PASS ]$NORMAL" "$MSG"
echo
if [ -z "$CATCOLOR" ];then
printf "%s %s\n\n" "[ PASS ]" "$MSG" >> $LOG
else
printf "%s %s\n\n" "$GREEN$BOLD[ PASS ]$NORMAL" "$MSG" >> $LOG
fi
else
#printf "%s%${COL2}s" "$MSG" "$RED$BOLD[ FAIL ]$NORMAL"
printf "%s %s" "$RED$BOLD[ FAIL ]$NORMAL" "$MSG"
echo
if [ -z "$CATCOLOR" ];then
printf "%s %s\n\n" "[ FAIL ]" "$MSG" >> $LOG
else
printf "%s %s\n\n" "$RED$BOLD[ FAIL ]$NORMAL" "$MSG" >> $LOG
fi
fi
}
source scripts/output.sh
spinner(){
local pid=$1
local delay=0.1
local spinstr='|/-\'
while [ "$(ps -a | awk '{print $1}' | grep "$pid")" ];
do
local temp=${spinstr#?}
printf "%c" "$spinstr"
local spinstr=$temp${spinstr%"$temp"}
sleep $delay
printf "\b"
done
printf " \b"
wait $1
}
###################################
##RHEL-06-000001
##The system must use a separate file system for /tmp.
mount | grep "on /tmp " >/dev/null 2>&1 &
spinner $!
output "V-38455" $? ${SETLANG}
################
##RHEL-06-000002
##The system must use a separate file system for /var.
mount | grep "on /var " >/dev/null 2>&1 &
spinner $!
output "V-38456" $? ${SETLANG}
################
##RHEL-06-000003
##The system must use a separate file system for /var/log.
mount | grep "on /var/log " >/dev/null 2>&1 &
spinner $!
output "V-38463" $? ${SETLANG}
################
##RHEL-06-000004
##The system must use a separate file system for the system audit data path.
mount | grep "on /var/log/audit " >/dev/null 2>&1 &
spinner $!
output "V-38467" $? ${SETLANG}
################
##RHEL-06-000005
##The audit system must alert designated staff members when the audit storage volume approaches capacity.
bash scripts/check-auditd.sh space_left_action >/dev/null 2>&1 &
spinner $!
output "V-38470" $? ${SETLANG}
################
##RHEL-06-000007
##The system must use a separate file system for user home directories.
mount | grep "on /home " >/dev/null 2>&1 &
spinner $!
output "V-38473" $? ${SETLANG}
################
##RHEL-06-000008
##Vendor-provided cryptographic certificates must be installed to verify the integrity of system software.
bash scripts/check-apt-key.sh >/dev/null 2>&1 &
spinner $!
output "V-38476" $? ${SETLANG}
################
##RHEL-06-000011
##System security patches and updates must be installed and up-to-date.
bash scripts/check-package-up2date.sh >/dev/null 2>&1 &
spinner $!
output "V-38481" $? ${SETLANG}
################
##RHEL-06-000013
##The system package management tool must cryptographically verify the authenticity of system software packages during installation.
#spinner $!
#output "V-38483" $? ${SETLANG}
################
##RHEL-06-000015
##The system package management tool must cryptographically verify the authenticity of all software packages during installation.
#spinner $!
#output "V-38487" $? ${SETLANG}
################
##RHEL-06-000016
##A file integrity tool must be installed.
dpkg -s aide >/dev/null 2>&1 &
spinner $!
output "V-38489" $? ${SETLANG}
################
##RHEL-06-000017
##The system must use a Linux Security Module at boot time.(AppArmor)
grep "apparmor=1" /boot/grub/grub.cfg >/dev/null 2>&1 &
spinner $!
output "V-51337" $? ${SETLANG}
################
##RHEL-06-000018
##A file integrity baseline must be created.
#Aide 0.16a2-19-g16ed855
bash scripts/check-aide-baseline.sh > /dev/null 2>&1 &
spinner $!
output "V-51391" $? ${SETLANG}
################
##RHEL-06-000019
##There must be no .rhosts or hosts.equiv files on the system.
bash scripts/check-rhosts.sh > /dev/null 2>&1 &
spinner $!
output "V-38491" $? ${SETLANG}
################
##RHEL-06-000020
##The system must use a Linux Security Module configured to enforce limits on system services.
#spinner $!
#output "V-51363" $? ${SETLANG}
################
##RHEL-06-000023
##The system must use a Linux Security Module configured to limit the privileges of system services.
#spinner $!
#output "V-51369" $? ${SETLANG}
################
##RHEL-06-000025
##All device files must be monitored by the system Linux Security Module.
#spinner $!
#output "V-51379" $? ${SETLANG}
################
##RHEL-06-000027
##The system must prevent the root account from logging in from virtual consoles.
bash scripts/check-consoles.sh virtual > /dev/null 2>&1 &
spinner $!
output "V-38492" $? ${SETLANG}
################
##RHEL-06-000028
##The system must prevent the root account from logging in from serial consoles.
bash scripts/check-consoles.sh serial > /dev/null 2>&1 &
spinner $!
output "V-38494" $? ${SETLANG}
################
##RHEL-06-000029
##Default operating system accounts, other than root, must be locked.
bash scripts/check-default-account.sh > /dev/null 2>&1 &
spinner $!
output "V-38496" $? ${SETLANG}
################
##RHEL-06-000030
##The system must not have accounts configured with blank or null passwords.
##For more Detial http://www.cyberciti.biz/tips/how-to-linux-prevent-the-reuse-of-old-passwords.html
##For more Detial http://www.cyberciti.biz/tips/linux-or-unix-disable-null-passwords.html
grep nullok /etc/pam.d/common-password > /dev/null 2>&1 &
spinner $!
output "V-38497" $? ${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 &
spinner $!
output "V-38499" $? ${SETLANG}
################
##RHEL-06-000032
##The root account must be the only account having a UID of 0.
bash scripts/check-root-uid.sh > /dev/null 2>&1 &
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 &
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 &
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 &
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 &
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 &
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 &
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 &
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 &
spinner $!
output "V-38451" $? ${SETLANG}
################
##RHEL-06-000041
##The /etc/passwd file must have mode 0644 or less permissive.
bash scripts/check-mode.sh /etc/passwd 644 > /dev/null 2>&1 &
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 &
spinner $!
output "V-38458" $? ${SETLANG}
################
##RHEL-06-000043
##The /etc/group file must be group-owned by root.
ls -l /etc/group | awk '{print $4}' | grep "^root$" > /dev/null 2>&1 &
spinner $!
output "V-38459" $? ${SETLANG}
################
##RHEL-06-000044
##The /etc/group file must have mode 0644 or less permissive.
bash scripts/check-mode.sh "/etc/group" 644 > /dev/null 2>&1 &
spinner $!
output "V-38461" $? ${SETLANG}
################
##RHEL-06-000045
##Library files must have mode 0755 or less permissive.
bash scripts/check-libs-mode.sh > /dev/null 2>&1 &
spinner $!
output "V-38465" $? ${SETLANG}
################
##RHEL-06-000046
##Library files must be owned by root.
bash scripts/check-libs-owner.sh > /dev/null 2>&1 &
spinner $!
output "V-38466" $? ${SETLANG}
################
##RHEL-06-000047
##All system command files must have mode 755 or less permissive.
bash scripts/check-cmd-mode.sh > /dev/null 2>&1 &
spinner $!
output "V-38469" $? ${SETLANG}
################
##RHEL-06-000048
##All system command files must be owned by root.
bash scripts/check-cmd-owner.sh > /dev/null 2>&1 &
spinner $!
output "V-38472" $? ${SETLANG}
################
##RHEL-06-000050
##The system must require passwords to contain a minimum of 14 characters.
bash scripts/check-password-min-len.sh > /dev/null 2>&1 &
spinner $!
output "V-38475" $? ${SETLANG}
################
##RHEL-06-000051
##Users must not be able to change passwords more than once every 24 hours.
bash scripts/check-password-min-day.sh > /dev/null 2>&1 &
spinner $!
output "V-38477" $? ${SETLANG}
################
##RHEL-06-000053
##User passwords must be changed at least every 60 days.
bash scripts/check-password-max-day.sh > /dev/null 2>&1 &
spinner $!
output "V-38479" $? ${SETLANG}
################
##RHEL-06-000054
##Users must be warned 7 days in advance of password expiration.
bash scripts/check-password-warn-age.sh > /dev/null 2>&1 &
spinner $!
output "V-38480" $? ${SETLANG}
################
##RHEL-06-000056
##The system must require passwords to contain at least one numeric character.
bash scripts/check-password.sh /etc/pam.d/common-password pam_cracklib.so dcredit gt -1 > /dev/null 2>&1 &
spinner $!
output "V-38482" $? ${SETLANG}
################
##RHEL-06-000057
##The system must require passwords to contain at least one uppercase alphabetic character.
bash scripts/check-password.sh /etc/pam.d/common-password pam_cracklib.so ucredit gt -1 > /dev/null 2>&1 &
spinner $!
output "V-38569" $? ${SETLANG}
################
##RHEL-06-000058
##The system must require passwords to contain at least one special character.
bash scripts/check-password.sh /etc/pam.d/common-password pam_cracklib.so ocredit gt -1 > /dev/null 2>&1 &
spinner $!
output "V-38570" $? ${SETLANG}
################
##RHEL-06-000059
##The system must require passwords to contain at least one lowercase alphabetic character.
bash scripts/check-password.sh /etc/pam.d/common-password pam_cracklib.so lcredit gt -1 > /dev/null 2>&1 &
spinner $!
output "V-38571" $? ${SETLANG}
################
##RHEL-06-000060
##The system must require at least four characters be changed between the old and new passwords during a password change.
bash scripts/check-password.sh /etc/pam.d/common-password pam_cracklib.so difok lt 4 > /dev/null 2>&1 &
spinner $!
output "V-38572" $? ${SETLANG}
################
##RHEL-06-000061
##The system must disable accounts after three consecutive unsuccessful logon attempts.
bash scripts/check-password.sh /etc/pam.d/common-auth pam_tally deny gt 3 > /dev/null 2>&1 &
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 &
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 &
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 scripts/check-depends.sh > /dev/null 2>&1 &
spinner $!
output "V-38577" $? ${SETLANG}
################
##RHEL-06-000065
##The system boot loader configuration file(s) must be owned by root.
ls -l /boot/grub/grub.cfg | awk '{print $3}' | grep "^root$" > /dev/null 2>&1 &
spinner $!
output "V-38579" $? ${SETLANG}
################
##RHEL-06-000066
##The system boot loader configuration file(s) must be group-owned by root.
ls -l /boot/grub/grub.cfg | awk '{print $4}' | grep "^root$" > /dev/null 2>&1 &
spinner $!
output "V-38581" $? ${SETLANG}
################
##RHEL-06-000067
##The system boot loader configuration file(s) must have mode 0600 or less permissive.
bash scripts/check-grub-mode.sh > /dev/null 2>&1 &
spinner $!
output "V-38583" $? ${SETLANG}
################
##RHEL-06-000068
##The system boot loader must require authentication.
sed -e '/^#/d' -e '/^[ \t][ \t]*#/d' -e 's/#.*$//' -e '/^$/d' /boot/grub/grub.cfg | grep "password.*sha512" > /dev/null 2>&1 &
spinner $!
output "V-38585" $? ${SETLANG}
################
##RHEL-06-000071
##The system must allow locking of the console screen in text mode.
dpkg -s screen >/dev/null 2>&1 &
spinner $!
output "V-38590" $? ${SETLANG}
################
##RHEL-06-000078
##The system must implement virtual address space randomization.
bash scripts/check-sysctl.sh kernel.randomize_va_space ne 2 >/dev/null 2>&1 &
spinner $!
output "V-38596" $? ${SETLANG}
################
##RHEL-06-000080
##The system must not send ICMPv4 redirects by default.
bash scripts/check-sysctl.sh net.ipv4.conf.default.send_redirects ne 0 >/dev/null 2>&1 &
spinner $!
output "V-38600" $? ${SETLANG}
################
##RHEL-06-000081
##The system must not send ICMPv4 redirects from any interface.
bash scripts/check-sysctl.sh net.ipv4.conf.all.send_redirects ne 0 >/dev/null 2>&1 &
spinner $!
output "V-38601" $? ${SETLANG}
################
##RHEL-06-000082
##IP forwarding for IPv4 must not be enabled, unless the system is a router.
bash scripts/check-sysctl.sh net.ipv4.ip_forward ne 0 >/dev/null 2>&1 &
spinner $!
output "V-38511" $? ${SETLANG}
################
##RHEL-06-000083
##The system must not accept IPv4 source-routed packets on any interface.
bash scripts/check-sysctl.sh net.ipv4.conf.all.accept_source_route ne 0 >/dev/null 2>&1 &
spinner $!
output "V-38523" $? ${SETLANG}
################
##RHEL-06-000084
##The system must not accept ICMPv4 redirect packets on any interface.
bash scripts/check-sysctl.sh net.ipv4.conf.all.accept_redirects ne 0 >/dev/null 2>&1 &
spinner $!
output "V-38524" $? ${SETLANG}
################
##RHEL-06-000086
##The system must not accept ICMPv4 secure redirect packets on any interface.
bash scripts/check-sysctl.sh net.ipv4.conf.all.secure_redirects ne 0 >/dev/null 2>&1 &
spinner $!
output "V-38526" $? ${SETLANG}
################
##RHEL-06-000088
##The system must log Martian packets.
bash scripts/check-sysctl.sh net.ipv4.conf.all.log_martians ne 1 >/dev/null 2>&1 &
spinner $!
output "V-38528" $? ${SETLANG}
################
##RHEL-06-000089
##The system must not accept IPv4 source-routed packets by default.
bash scripts/check-sysctl.sh net.ipv4.conf.default.accept_source_route ne 0 >/dev/null 2>&1 &
spinner $!
output "V-38529" $? ${SETLANG}
################
##RHEL-06-000090
##The system must not accept ICMPv4 secure redirect packets by default.
bash scripts/check-sysctl.sh net.ipv4.conf.default.secure_redirects ne 0 >/dev/null 2>&1 &
spinner $!
output "V-38532" $? ${SETLANG}
################
##RHEL-06-000091
##The system must ignore ICMPv4 redirect messages by default.
bash scripts/check-sysctl.sh net.ipv4.conf.default.accept_redirects ne 0 >/dev/null 2>&1 &
spinner $!
output "V-38533" $? ${SETLANG}
################
##RHEL-06-000092
##The system must not respond to ICMPv4 sent to a broadcast address.
bash scripts/check-sysctl.sh net.ipv4.icmp_echo_ignore_broadcasts ne 1 >/dev/null 2>&1 &
spinner $!
output "V-38535" $? ${SETLANG}
################
##RHEL-06-000093
##The system must ignore ICMPv4 bogus error responses.
bash scripts/check-sysctl.sh net.ipv4.icmp_ignore_bogus_error_responses ne 1 >/dev/null 2>&1 &
spinner $!
output "V-38537" $? ${SETLANG}
################
##RHEL-06-000095
##The system must be configured to use TCP syncookies when experiencing a TCP SYN flood.
bash scripts/check-sysctl.sh net.ipv4.tcp_syncookies ne 1 >/dev/null 2>&1 &
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 scripts/check-sysctl.sh net.ipv4.conf.all.rp_filter ne 1 >/dev/null 2>&1 &
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 scripts/check-sysctl.sh net.ipv4.conf.default.rp_filter ne 1 >/dev/null 2>&1 &
spinner $!
output "V-38544" $? ${SETLANG}
################
##RHEL-06-000098
##The IPv6 protocol handler must not be bound to the network stack unless needed.
bash scripts/check-ipv6-enable.sh >/dev/null 2>&1 &
spinner $!
output "V-38546" $? ${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 scripts/check-sysctl.sh net.ipv6.conf.default.accept_redirects ne 0 >/dev/null 2>&1 &
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 &
spinner $!
output "V-38513" $? ${SETLANG}
################
##RHEL-06-000124
##The systems local IPv4 firewall must implement a deny-all, allow-by-exception policy for inbound
grep -r dccp /etc/modprobe.conf /etc/modprobe.d >/dev/null 2>&1 &
spinner $!
output "V-38514" $? ${SETLANG}
################
##RHEL-06-000125
##The Stream Control Transmission Protocol (SCTP) must be disabled unless required.
grep -r sctp /etc/modprobe.conf /etc/modprobe.d >/dev/null 2>&1 &
spinner $!
output "V-38515" $? ${SETLANG}
################
##RHEL-06-000126
##The Reliable Datagram Sockets (RDS) protocol must be disabled unless required.
grep -r rds /etc/modprobe.conf /etc/modprobe.d >/dev/null 2>&1 &
spinner $!
output "V-38516" $? ${SETLANG}
################
##RHEL-06-000127
##The Transparent Inter-Process Communication (TIPC) protocol must be disabled unless required.
grep -r tipc /etc/modprobe.conf /etc/modprobe.d >/dev/null 2>&1 &
spinner $!
output "V-38517" $? ${SETLANG}
################
##RHEL-06-000133
##All rsyslog-generated log files must be owned by root.
bash scripts/check-rsyslog.sh owned >/dev/null 2>&1 &
spinner $!
output "V-38518" $? ${SETLANG}
################
##RHEL-06-000134
##All rsyslog-generated log files must be group-owned by root.
bash scripts/check-rsyslog.sh group-owned >/dev/null 2>&1 &
spinner $!
output "V-38519" $? ${SETLANG}
################
##RHEL-06-000135
##All rsyslog-generated log files must have mode 0600 or less permissive.
bash scripts/check-rsyslog.sh mode >/dev/null 2>&1 &
spinner $!
output "V-38623" $? ${SETLANG}
################
##RHEL-06-000136
##The operating system must back up audit records on an organization defined frequency onto a different system or media than the system being audited.
sed -e '/^#/d' -e '/^[ \t][ \t]*#/d' -e 's/#.*$//' -e '/^$/d' /etc/rsyslog.conf | grep "\..*@.*:" >/dev/null 2>&1 &
spinner $!
output "V-38520" $? ${SETLANG}
################
##RHEL-06-000137
##The operating system must support the requirement to centrally manage the content of audit records generated by organization defined information system components.
sed -e '/^#/d' -e '/^[ \t][ \t]*#/d' -e 's/#.*$//' -e '/^$/d' /etc/rsyslog.conf | grep "\..*@.*:" >/dev/null 2>&1 &
spinner $!
output "V-38521" $? ${SETLANG}
################
##RHEL-06-000138
##System logs must be rotated daily.
bash scripts/check-logrotate.sh >/dev/null 2>&1 &
spinner $!
output "V-38624" $? ${SETLANG}
################
##RHEL-06-000145
##The operating system must produce audit records containing sufficient information to establish the identity of any user/subject associated with the event.
service auditd status >/dev/null 2>&1 &
spinner $!
output "V-38628" $? ${SETLANG}
################
##RHEL-06-000148
##The operating system must employ automated mechanisms to facilitate the monitoring and control of remote access methods.
service auditd status >/dev/null 2>&1 &
spinner $!
output "V-38631" $? ${SETLANG}
################
##RHEL-06-000154
##The operating system must produce audit records containing sufficient information to establish what type of events occurred.
service auditd status >/dev/null 2>&1 &
spinner $!
output "V-38632" $? ${SETLANG}
################
##RHEL-06-000159
##The system must retain enough rotated audit logs to cover the required log retention period.
bash scripts/check-auditd.sh num_logs lt 5 >/dev/null 2>&1 &
spinner $!
output "V-38636" $? ${SETLANG}
################
##RHEL-06-000160
##The system must set a maximum audit log file size.
bash scripts/check-auditd.sh max_log_file lt 6 >/dev/null 2>&1 &
spinner $!
output "V-38633" $? ${SETLANG}
################
##RHEL-06-000161
##The system must rotate audit log files that reach the maximum file size.
bash scripts/check-auditd.sh max_log_file_action >/dev/null 2>&1 &
spinner $!
output "V-38633" $? ${SETLANG}
################
##RHEL-06-000163
##The audit system must switch the system to single-user mode when available audit storage volume becomes dangerously low.
bash scripts/check-auditd.sh admin_space_left_action >/dev/null 2>&1 &
spinner $!
output "V-54381" $? ${SETLANG}
################
##RHEL-06-000165
##The audit system must be configured to audit all attempts to alter system time through adjtimex.
grep -w "adjtimex" /etc/audit/audit.rules >/dev/null 2>&1 &
spinner $!
output "V-38635" $? ${SETLANG}
################
##RHEL-06-000167
##The audit system must be configured to audit all attempts to alter system time through settimeofday.
grep -w "settimeofday" /etc/audit/audit.rules >/dev/null 2>&1 &
spinner $!
output "V-38522" $? ${SETLANG}
################
##RHEL-06-000169
##The audit system must be configured to audit all attempts to alter system time through stime.
##32-bit system only