-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathRHEL7_v2r5_Validation_20191120.sh
2366 lines (2011 loc) · 215 KB
/
RHEL7_v2r5_Validation_20191120.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
#
# RHEL 7 Content based on the RHEL7 V2R4 STIG
#
# Set current Version/Release # for this STIG Checklist script
cklVersion="V2R5"
#Set unclean variable. If set to 1, special characters won't be converted to the XML equivalent
if [[ "$(echo $1 | grep [Uu][Nn][Cc][Ll][Ee][Aa][Nn])" ]] || [[ "$(echo $2 | grep [Uu][Nn][Cc][Ll][Ee][Aa][Nn])" ]]; then
unclean=1
fi
# We want to redirect all output (stdout and stderr to /tmp/RHEL_Lockdown.log
# Setup file descriptor 3 to point to stdout, we can use this if we need to output to the console
tempOut="/tmp/Validation_RHEL7_${cklVersion}.log"
exec 3>&1
exec 1>$tempOut 2>&1
# Create the result file
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
RESULTS="$DIR/Validation_RHEL7_${cklVersion}_Results.$HOSTNAME.$(date +%F_%H.%M)_XCCDF.ckl"
############### Result Functions ###############
### Zero Test ###
#Accepted format: RuleID, Test
#If it should come back as zero and pass, use this function
#$1 Rule ID
#$2 Test Criteria
#$3 Passed variable (comment) variable
function zero() {
echo "Check $1"
comment=$3
commentFail=$4
result="$(eval $2)"
if [[ -z "$result" ]]; then
result "$1" "pass" "$2" "$result" "$comment"
else
result "$1" "fail" "$2" "$result" "$commentFail"
fi
unset result comment
}
### Non-Zero Test ###
#Accepted format: RuleID, Test
#If it should come back as non-zero and pass, use this function
#$1 Rule ID
#$2 Test Criteria
#$3 Passed variable (pvar) variable
function nonzero() {
echo "Check $1"
comment=$3
commentFail=$4
result="$(eval $2)"
if [[ -n "$result" ]]; then
result "$1" "pass" "$2" "$result" "$comment"
else
result "$1" "fail" "$2" "$result" "$commentFail"
fi
unset result comment
}
### Not Reviewed ###
#The NR status does not work with the DISA STIG viewer, only the Sotera CKL Viewer
#$1 Rule ID
#$2 Test Criteria
#$3 Passed variable (comment) variable
function nr() {
echo "Check $1"
comment=$3
result="$(eval $2)"
result "$1" "NR" "$2" "$result" "$comment"
unset result comment
}
### Pass ###
#$1 Rule ID
#$2 Test Criteria
#$3 Passed variable (comment) variable
function pass() {
echo "Check $1"
comment=$3
result="$(eval $2)"
result "$1" "pass" "$2" "$result" "$comment"
unset result comment
}
### Fail ###
#$1 Rule ID
#$2 Test Criterir
#$3 Passed variable (comment) variable
function fail() {
echo "Check $1"
comment=$3
result="$(eval $2)"
result "$1" "fail" "$2" "$result" "$comment"
unset result comment
}
### Not Applicable ###
#The NA status does not work with the DISA STIG viewer, only the Sotera CKL Viewer
#$1 Rule ID
#$2 Comment
#$3 Passed variable (comment) variable
function na() {
echo "Check $1"
comment=$3
result="$(eval $2)"
result "$1" "notapplicable" "$2" "$result" "$comment"
unset result comment
}
### Result Function ###
#This function handles outputing results in an CKL format
#Made to handle 5 parameters
#$1 Rule ID
#$2 pass or fail
#$3 Test Criteria
#$4 Test Result
#$5 Comment
function result(){
#If a 'clean' flag is given, results will clean XML special characters and make them XML appropriate
if [[ $unclean -eq 1 ]]; then
cleanxmla="$3"
cleanxmlb="$4"
else
cleanxmla="$(echo $3 | sed -r 's/\&/\&/g' | sed -r 's/</\</g' | sed -r 's/>/\>/g' | sed -r "s/'/\'/g" | sed -r 's/\"/\"/g')"
cleanxmlb="$(echo $4 | sed -r 's/</\</g' | sed -r 's/>/\>/g')"
fi
if [[ "$2" == "pass" ]]; then
status="NotAFinding"
elif [[ "$2" == "fail" ]]; then
status="Open"
elif [[ "$2" == "NR" ]]; then
status="Not_Reviewed"
elif [[ "$2" == "notapplicable" ]]; then
status="Not_Applicable"
else
status="ERROR"
echo "<!-- result: $2, passed $2!=1 test, something WRONG-->" >> $Results
fi
echo "<VULN>" >> $RESULTS
echo " <STIG_DATA>" >> $RESULTS
echo " <VULN_ATTRIBUTE>Rule_ID</VULN_ATTRIBUTE>" >> $RESULTS
echo " <ATTRIBUTE_DATA>$1</ATTRIBUTE_DATA>" >> $RESULTS
echo " </STIG_DATA>" >> $RESULTS
echo " <STATUS>$status</STATUS>" >> $RESULTS
echo " <FINDING_DETAILS># $cleanxmla" >> $RESULTS
echo "$(eval $3 | sed -r 's/</\</g' | sed -r 's/>/\>/g')</FINDING_DETAILS>" >> $RESULTS
echo " <COMMENTS>$(echo $5 | sed -r 's/</\</g' | sed -r 's/>/\>/g')</COMMENTS>" >> $RESULTS
echo "</VULN>" >> $RESULTS
echo "" >> $RESULTS
}
### resetRule Function ###
#This function updates variable value for the current rule being checked
#Made to handle 1 parameter in the following order: Rule ID
#$1 Rule ID
resetRule() {
unset rule
rule="$1"
echo "$rule" >> /dev/tty
}
rule=""
############### End Result Functions ###############
### get information about the RHEL version/configuration ###
SRHELver=$(cat /etc/srhel-release)
IPaddr=$(ip -o -4 address show | awk ' NR==2 { gsub(/\/.*/, "", $4); print $4 } ')
macAddr=$(ifconfig -a | grep -A 1 "$IPaddr" | grep -i 'ether*' | cut -d " " -f10)
RHELverNumb=$(grep -Eo '[0-9].[0-9]' /etc/redhat-release)
############### .ckl Header ###############
# This Creates the necessary header for the output file to be .ckl compliant
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" > $RESULTS
echo "<!--DISA STIG Viewer :: 2.7.1-->" >> $RESULTS
echo "<CHECKLIST>" >> $RESULTS
echo " <ASSET>" >> $RESULTS
echo " <ROLE>Member Server</ROLE>" >> $RESULTS
echo " <ASSET_TYPE>Computing</ASSET_TYPE>" >> $RESULTS
echo " <HOST_NAME>$HOSTNAME</HOST_NAME>" >> $RESULTS
echo " <HOST_IP>$IPaddr</HOST_IP>" >> $RESULTS
echo " <HOST_MAC>$macAddr</HOST_MAC>" >> $RESULTS
echo " <HOST_FQDN>$SRHELver</HOST_FQDN>" >> $RESULTS
echo " <TECH_AREA>UNIX OS</TECH_AREA>" >> $RESULTS
echo " <TARGET_KEY>2777</TARGET_KEY>" >> $RESULTS
echo " <WEB_OR_DATABASE>false</WEB_OR_DATABASE>" >> $RESULTS
echo " <WEB_DB_SITE></WEB_DB_SITE>" >> $RESULTS
echo " <WEB_DB_INSTANCE></WEB_DB_INSTANCE>" >> $RESULTS
echo " </ASSET>" >> $RESULTS
echo " <STIGS>" >> $RESULTS
echo " <iSTIG>" >> $RESULTS
echo " <STIG_INFO>" >> $RESULTS
echo " <SI_DATA>" >> $RESULTS
echo " <SID_NAME>classification</SID_NAME>" >> $RESULTS
echo " <SID_DATA>UNCLASSIFIED</SID_DATA>" >> $RESULTS
echo " </SI_DATA>" >> $RESULTS
echo " <SI_DATA>" >> $RESULTS
echo " <SID_NAME>title</SID_NAME>" >> $RESULTS
echo " <SID_DATA>Red Hat Enterprise Linux 7 Security Technical Implementation Guide</SID_DATA>" >> $RESULTS
echo " </SI_DATA>" >> $RESULTS
echo " </STIG_INFO>" >> $RESULTS
echo "" >> $RESULTS
############### End CKL Header ###############
### Start Checks ###
echo "<!-- Starting checks... $(date) -->" >> $RESULTS
echo "" >> $RESULTS
echo "" >> /dev/tty
echo "Starting checks... $(date)" >> /dev/tty
echo "" >> /dev/tty
#example check
#[function] [Rule ID] [Test command] [Variable pvar]
#zero "SV-38177r2_rule" "cat $pvar | awk -F: '{ print $1 }' | grep -i ^games" "/etc/passwd"
#nonzero "SV-38177r2_rule" "cat /etc/passwd | awk -f: '{ print $1 }' | grep -i ^games"
##
echo "The first two checks take a while to complete, be patient." >> /dev/tty
### V-71849 | RHEL-07-010010 ###
resetRule "SV-86473r4_rule"
nr "$rule" "$(for i in $(rpm -Va | egrep -i '^\.[M|U|G|.]{8}' | cut -d ' ' -f4,5);do for j in $(rpm -qf $i);do rpm -ql $j --dump | cut -d ' ' -f1,5,6,7 | grep $i;done;done)" "Check only. Usually the findings from this output are all either configuration files/logs (and therefore NOT system files or commands) or have STIG-related rights that are more restrictive than the vendor values. Format shows the default value followed by the actual settings on the server. If any non-system file or command is more permissive than the default permissions, this is a finding. If any not owned by the default owner or is not a member of the default group and is not documented with the Information System Security Officer (ISSO), this is a finding. Standard Verbiage: Verified the file permissions, ownership, and group membership of system files and commands match the vendor values, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary."
### V-71855 | RHEL-07-010020 ###
resetRule "SV-86479r4_rule"
nr "$rule" "rpm -Va | grep '^..5'" "Check only. Verify the findings from this output contain no system files or binaries. Standard Verbiage: Verified the cryptographic hash of system files and commands match vendor values, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary."
### V-71859 | RHEL-07-010030 ###
resetRule "SV-86483r4_rule"
if [[ -z "$(yum list installed | grep gnome)" ]]; then
na "$rule" "yum list installed | grep gnome" "Verified that the system does not have GNOME installed making this requirement Not Applicable."
else
nonzero "$rule" "egrep -i 'banner-message-enable=true' /etc/dconf/db/local.d/* | grep -v '^#'" "Gnome is installed and warner banner is set correctly per the STIG" "Gnome is installed and warner banner is NOT set correctly per the STIG"
fi
### V-71861 | RHEL-07-010040 ###
resetRule "SV-86485r4_rule"
if [[ -z "$(yum list installed | grep gnome)" ]]; then
na "$rule" "yum list installed | grep gnome" "Verified that the system does not have GNOME installed making this requirement Not Applicable."
elif [[ -n "grep -i 'banner-message-text' /etc/dconf/db/local.d/* | grep -i 'You are accessing a U.S. Government (USG) Information System (IS) that is provided for USG-authorized use only.' | grep -i 'By using this IS (which includes any device attached to this IS), you consent to the following conditions:' | grep -i '-The USG routinely intercepts and monitors communications on this IS for purposes including, but not limited to, penetration testing, COMSEC monitoring, network operations and defense, personnel misconduct (PM), law enforcement (LE), and counterintelligence (CI) investigations.' | grep -i '-At any time, the USG may inspect and seize data stored on this IS.' | grep -i '-Communications using, or data stored on, this IS are not private, are subject to routine monitoring, interception, and search, and may be disclosed or used for any USG-authorized purpose.' | grep -i '-This IS includes security measures (e.g., authentication and access controls) to protect USG interests--not for your personal benefit or privacy.' | grep -i '-Notwithstanding the above, using this IS does not constitute consent to PM, LE or CI investigative searching or monitoring of the content of privileged communications, or work product, related to personal representation or services by attorneys, psychotherapists, or clergy, and their assistants. Such communications and work product are private and confidential. See User Agreement for details.'" ]]; then
pass "$rule" "grep -i 'banner-message-text' /etc/dconf/db/local.d/*" "Gnome is installed and banner message is configured per the STIG"
else
nr "$rule" "echo 'Manual review of banner text required.
'; grep -i 'banner-message-text' /etc/dconf/db/local.d/*" "Gnome is installed, however, banner message will need to be manual verified"
fi
### V-71863 | RHEL-07-010050 ###
resetRule "SV-86487r3_rule"
if [[ -n "cat /etc/issue | grep 'You are accessing a U.S. Government (USG) Information System (IS) that is provided for USG-authorized use only.' | grep 'By using this IS (which includes any device attached to this IS), you consent to the following conditions:' | grep '-The USG routinely intercepts and monitors communications on this IS for purposes including, but not limited to, penetration testing, COMSEC monitoring, network operations and defense, personnel misconduct (PM), law enforcement (LE), and counterintelligence (CI) investigations.' | grep '-At any time, the USG may inspect and seize data stored on this IS.' | grep '-Communications using, or data stored on, this IS are not private, are subject to routine monitoring, interception, and search, and may be disclosed or used for any USG-authorized purpose.' | grep '-This IS includes security measures (e.g., authentication and access controls) to protect USG interests--not for your personal benefit or privacy.' | grep '-Notwithstanding the above, using this IS does not constitute consent to PM, LE or CI investigative searching or monitoring of the content of privileged communications, or work product, related to personal representation or services by attorneys, psychotherapists, or clergy, and their assistants. Such communications and work product are private and confidential. See User Agreement for details.'" ]]; then
pass "$rule" "cat /etc/issue" "Verified the operating system displays the Standard Mandatory DoD Notice and Consent Banner before granting local or remote access to the system via a command line user logon, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary."
else
nr "$rule" "cat /etc/issue" "Banner will need to be manual verified"
fi
### V-71891 | RHEL-07-010060 ###
resetRule "SV-86515r6_rule"
if [[ -z "$(yum list installed | grep gnome)" ]]; then
na "$rule" "yum list installed | grep gnome" "Verified that the system does not have GNOME installed making this requirement Not Applicable."
else
nonzero "$rule" "egrep -i '^\s*lock-enabled' /etc/dconf/db/local.d/* | grep true" "GNOME is installed and lock enabled has been configured per the STIG" "GNOME is installed and lock enabled has NOT been configured per the STIG"
fi
### V-71893 | RHEL-07-010070 ###
resetRule "SV-86517r5_rule"
if [[ -z "$(yum list installed | grep gnome)" ]]; then
na "$rule" "yum list installed | grep gnome" "Verified that the system does not have GNOME installed making this requirement Not Applicable."
else
nonzero "$rule" "egrep -i '^\s*idle-delay' /etc/dconf/db/local.d/* | awk -F '=' '\$2 >=900'" "GNOME is installed and idle delay has been configured per the STIG" "GNOME is installed and idle delay has NOT been configured per the STIG"
fi
### V-71895 | RHEL-07-010080 ###
# rule removed from STIG v2r2
#resetRule="SV-86519r4_rule"
#if [[ -z "$(yum list installed | grep gnome)" ]]; then
# na "$rule" "yum list installed | grep gnome"
#else
# nonzero "$rule" "egrep -i 'idle-delay' /etc/dconf/db/local.d/locks/* | grep screensaver"
#fi
### V-71897 | RHEL-07-010090 ###
##Works manually, but if it doesn't work automatically, print out $package and mark as NR
resetRule "SV-86521r3_rule"
nonzero "$rule" "rpm -q screen$'\n'rpm -q tmux | grep -iv 'not installed'" "Verified the operating system has the screen package installed, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary." "Verified the operating system does NOT have the screen package installed, therefore the reference STIG IS a finding. Engineer did NOT apply a change. Setting was incorrect by default and/or no change was necessary."
### V-71899 | RHEL-07-010100 ###
resetRule "SV-86523r5_rule"
if [[ -z "$(yum list installed | grep gnome)" ]]; then
na "$rule" "yum list installed | grep gnome" "Verified that the system does not have GNOME installed making this requirement Not Applicable."
else
nonzero "$rule" "egrep -i '^\s*idle-activation-enabled=true' /etc/dconf/db/local.d/*" "GNOME is installed and idle timeout has been configured per the STIG" "GNOME is installed and idle timeout has NOT been configured per the STIG"
fi
### V-71901 | RHEL-07-010110 ###
resetRule "SV-86525r3_rule"
if [[ -z "$(yum list installed | grep gnome)" ]]; then
na "$rule" "yum list installed | grep gnome" "Verified that the system does not have GNOME installed making this requirement Not Applicable."
else
nonzero "$rule" "egrep -Ei '^\s*lock-delay=uint32\s+[1-5]' /etc/dconf/db/local.d/*" "GNOME is installed and verified a lock delay has been configured per the STIG" "GNOME is installed and verified a lock delay has NOT been configured per the STIG"
fi
### V-71903 | RHEL-07-010120 ###
resetRule "SV-86527r3_rule"
nonzero "$rule" "egrep -i '^\s*ucredit\s*=\s*-' /etc/security/pwquality.conf | grep -v '^#'" "Verified that when passwords are changed or new passwords are established, the new password must contain at least one upper-case character, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary." "Verified that when passwords are changed or new passwords are established, the new password does NOT contain at least one upper-case character, therefore the reference STIG IS a finding. Engineer did NOT apply a change. Setting was incorrect by default and/or no change was necessary."
### V-71905 | RHEL-07-010130 ###
resetRule "SV-86529r5_rule"
nonzero "$rule" "egrep -i '^\s*lcredit\s*=\s*-' /etc/security/pwquality.conf | grep -v '^#'" "Verified that when passwords are changed or new passwords are established, the new password must contain at least one lower-case character, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary." "Verified that when passwords are changed or new passwords are established, the new password does NOT contain at least one lower-case character, therefore the reference STIG IS a finding. Engineer did NOT apply a change. Setting was incorrect by default and/or no change was necessary."
### V-71907 | RHEL-07-010140 ###
resetRule "SV-86531r3_rule"
nonzero "$rule" "egrep -i '^\s*dcredit\s*=\s*-' /etc/security/pwquality.conf | grep -v '^#'" "Verified that when passwords are changed or new passwords are assigned, the new password must contain at least one numeric character, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary." "Verified that when passwords are changed or new passwords are assigned, the new password does NOT contain at least one numeric character, therefore the reference STIG IS a finding. Engineer did NOT apply a change. Setting was incorrect by default and/or no change was necessary."
### V-71909 | RHEL-07-010150 ###
resetRule "SV-86533r2_rule"
nonzero "$rule" "egrep -i '^\s*ocredit\s*=\s*-' /etc/security/pwquality.conf | grep -v '^#'" "Verifited that when passwords are changed or new passwords are assigned, the new password must contain at least one special character, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary." "Verifited that when passwords are changed or new passwords are assigned, the new password does NOT contain at least one special character, therefore the reference STIG IS a finding. Engineer did NOT apply a change. Setting was incorrect by default and/or no change was necessary."
### V-71911 | RHEL-07-010160 ###
resetRule "SV-86535r2_rule"
nonzero "$rule" "egrep -i '^\s*difok' /etc/security/pwquality.conf | grep -v '^#' | awk -F '=*' '\$2 >=8'" "Verified that when passwords are changed a minimum of eight of the total number of characters must be changed, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary." "Verified that when passwords are changed a minimum of eight of the total number of characters is NOT changed, therefore the reference STIG IS a finding. Engineer did NOT apply a change. Setting was incorrect by default and/or no change was necessary."
### V-71913 | RHEL-07-010170 ###
resetRule "SV-86537r2_rule"
nonzero "$rule" "egrep -i '^\s*minclass' /etc/security/pwquality.conf | grep -v '^#' | awk -F '=*' '\$2 >=4'" "Verified that when passwords are changed a minimum of four character classes must be changed, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary." "Verified that when passwords are changed a minimum of four character classes is NOT changed, therefore the reference STIG IS a finding. Engineer did NOT apply a change. Setting was incorrect by default and/or no change was necessary."
### V-71915 | RHEL-07-010180 ###
resetRule "SV-86539r3_rule"
nonzero "$rule" "egrep -i '^\s*maxrepeat' /etc/security/pwquality.conf | grep -v '^#' | awk -F '=*' '\$2 >0 && \$2 <4'" "Verified that when passwords are changed the number of repeating consecutive characters must not be more than three characters, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary." "Verified that when passwords are changed the number of repeating consecutive characters is NOT more than three characters, therefore the reference STIG IS a finding. Engineer did NOT apply a change. Setting was incorrect by default and/or no change was necessary."
### V-71917 | RHEL-07-010190 ###
resetRule "SV-86541r2_rule"
nonzero "$rule" "egrep -i '^\s*maxclassrepeat' /etc/security/pwquality.conf | grep -v '^#' | awk -F '=*' '\$2 >0 && \$2 <=4'" "Verified that when passwords are changed the number of repeating characters of the same character class must not be more than four characters, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary." "Verified that when passwords are changed the number of repeating characters of the same character class is NOT be more than four characters, therefore the reference STIG IS a finding. Engineer did NOT apply a change. Setting was incorrect by default and/or no change was necessary."
### V-71919 | RHEL-07-010200 ###
resetRule "SV-86543r3_rule"
if [[ -z "$(egrep -i '^\s*password' /etc/pam.d/system-auth /etc/pam.d/password-auth | egrep -e 'md5|sha256|bigcrypt|blowfish')" ]]; then
nonzero "$rule" "egrep -i '^\s*password' /etc/pam.d/system-auth /etc/pam.d/password-auth| egrep -i 'sha512'" "Verified the PAM system service is configured to store only encrypted representations of passwords, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary." "Verified the PAM system service is NOT configured to store only encrypted representations of passwords, therefore the reference STIG IS a finding. Engineer did NOT apply a change. Setting was incorrect by default and/or no change was necessary."
else
fail "$rule" "egrep -e 'md5|sha256|bigcrypt|blowfish' /etc/pam.d/system-auth /etc/pam.d/password-auth" "PAM password encryptions has not been configured correctly"
fi
### V-71921 | RHEL-07-010210 ###
resetRule "SV-86545r2_rule"
if [[ -z "$(egrep -i '^\s*encrypt' /etc/login.defs| egrep -e 'des|md5|sha256')" ]]; then
nonzero "$rule" "egrep -i '^s*encrypt' /etc/login.defs | egrep -i 'sha512'" "Verified the shadow file is configured to store only encrypted representations of passwords, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary." "Verified the shadow file is NOT configured to store only encrypted representations of passwords, therefore the reference STIG IS a finding. Engineer did NOT apply a change. Setting was incorrect by default and/or no change was necessary."
else
fail "$rule" "egrep -e 'des|md5|sha256' /etc/login.defs" "login.defs has not been configured per the STIG"
fi
### V-71923 | RHEL-07-010220 ###
resetRule "SV-86547r3_rule"
if [[ -z "$(grep -iB 20 \"^\s*crypt_style\s*=\s*sha512\" /etc/libuser.conf | grep -v '^#' | grep -v '^$' | awk '/crypt/ || /defaults/' | grep '\[defaults\]')" ]]; then
nonzero "$rule" "grep -iB 20 \"^\s*crypt_style\s*=\s*sha512\" /etc/libuser.conf | grep -v '^#' | grep -v '^$' | awk '/crypt/ || /defaults/'" "Verified user and group account administration utilities are configured to store only encrypted representations of passwords, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary." "Verified user and group account administration utilities are NOT configured to store only encrypted representations of passwords, therefore the reference STIG IS a finding. Engineer did NOT apply a change. Setting was incorrect by default and/or no change was necessary."
else
#Manual inspection of rule to ensure that the crypt_style = sha512 setting exists AND is in the [defaults] region
nr "$rule" "grep -iB 20 \"^\s*crypt_style\s*=\s*sha512\" /etc/libuser.conf | grep -v '^#' | grep -v '^$'" "Manual inspection of rule to ensure that the crypt_style = sha512 setting exists AND is in the [defaults] region"
fi
### V-71925 | RHEL-07-010230 ###
resetRule "SV-86549r2_rule"
nonzero "$rule" "egrep '^\s*PASS_MIN_DAYS' /etc/login.defs | grep -v '^#' | awk '\$2 >=1'" "Verified passwords for new users are restricted to a 24 hours/1 day minimum lifetime, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary." "Verified passwords for new users are NOT restricted to a 24 hours/1 day minimum lifetime, therefore the reference STIG IS a finding. Engineer did NOT apply a change. Setting was incorrect by default and/or no change was necessary."
### V-71927 | RHEL-07-010240 ###
## Manual inspection of output needed as "If any results are returned that are not associated with a system account, this is a finding."
resetRule "SV-86551r2_rule"
nr "$rule" "awk -F: '\$4 < 1 {print \$1}' /etc/shadow" "Check only. Verify all returned results that do not have a "1" on them are associated with system accounts. Standard Verbiage: Verified passwords are restricted to a 24 hours/1 day minimum lifetime, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary."
### V-71929 | RHEL-07-010250 ###
resetRule "SV-86553r2_rule"
nonzero "$rule" "egrep '^\s*PASS_MAX_DAYS' /etc/login.defs | grep -v '^#' | awk '\$2 <=60'" "Verified passwords for new users are restricted to a 60-day maximum lifetime, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary." "Verified passwords for new users are NOT restricted to a 60-day maximum lifetime, therefore the reference STIG IS a finding. Engineer did NOT apply a change. Setting was incorrect by default and/or no change was necessary."
### V-71931 | RHEL-07-010260 ###
## Manual inspection of output needed as "If any results are returned that are not associated with a system account, this is a finding."
resetRule "SV-86555r3_rule"
nr "$rule" "awk -F: '\$5 >60 {print \$1}' /etc/shadow" "Verify all returned results with a number higher than 60 are associated with system accounts. Standard Verbiage: Verified existing passwords are restricted to a 60-day maximum lifetime, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary."
### V-71933 | RHEL-07-010270 ###
resetRule "SV-86557r3_rule"
nonzero "$rule" "egrep -i remember /etc/pam.d/system-auth /etc/pam.d/password-auth | egrep -i 'pam_pwhistory.so' | awk -F '=' '\$2 >= 5 {print;}'" "Verified passwords must be prohibited from reuse for a minimum of five generations, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary." "Verified passwords are NOT prohibited from reuse for a minimum of five generations, therefore the reference STIG IS a finding. Engineer did NOT apply a change. Setting was incorrect by default and/or no change was necessary."
### V-71935 | RHEL-07-010280 ###
resetRule "SV-86559r2_rule"
nonzero "$rule" "egrep -i '^\s*minlen' /etc/security/pwquality.conf | grep -v '^#' | awk -F '=*' '\$2 >=15'" "Verified passwords are a minimum of 15 characters in length, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary." "Verified passwords are NOT a minimum of 15 characters in length, therefore the reference STIG IS a finding. Engineer did NOT apply a change. Setting was incorrect by default and/or no change was necessary."
### V-71937 | RHEL-07-010290 ###
resetRule "SV-86561r3_rule"
zero "$rule" "egrep -i nullok /etc/pam.d/system-auth-ac /etc/pam.d/password-auth" "Verified the system does not have accounts configured with blank or null passwords, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary." "Verified the system DOES have accounts configured with blank or null passwords, therefore the reference STIG IS a finding. Engineer did NOT apply a change. Setting was incorrect by default and/or no change was necessary."
### V-71939 | RHEL-07-010300 ###
resetRule "SV-86563r3_rule"
nonzero "$rule" "grep -i \"PermitEmptyPasswords\" /etc/ssh/sshd_config | egrep -i \"no|#P\"" "Verified the SSH daemon does not allow authentication using an empty password, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary." "Verified the SSH daemon DOES allow authentication using an empty password, therefore the reference STIG IS a finding. Engineer did NOT apply a change. Setting was incorrect by default and/or no change was necessary."
### V-71941 | RHEL-07-010310 ###
resetRule "SV-86565r2_rule"
nonzero "$rule" "egrep -i '^\s*inactive' /etc/default/useradd | grep -v '^#' | grep -i '0'" "Verified the operating system disables account identifiers (individuals, groups, roles, and devices) if the password expires, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary." "Verified the operating system does NOT disable account identifiers (individuals, groups, roles, and devices) if the password expires, therefore the reference STIG IS a finding. Engineer did NOT apply a change. Setting was incorrect by default and/or no change was necessary."
### V-71943 | RHEL-07-010320 ###
resetRule "SV-86567r5_rule"
echo "Check $rule"
countpw="$(grep -Ewc '^auth.*pam_faillock.so.*unlock_time=.*' /etc/pam.d/password-auth | grep -v '^#')"
countsys="$(grep -Ewc '^auth.*pam_faillock.so.*unlock_time=*' /etc/pam.d/system-auth | grep -v '^#')"
if [[( $countpw<2 || $countsys <2)]]; then
fail "$rule" "less than 2 auth lines found with pam.faillock.so in either system-auth or password-auth"
else
for i in $( grep -Ew '^auth.*pam_faillock.so.*unlock_time=.*' /etc/pam.d/password-auth | grep -v '^#' | awk -F 'unlock_time=' '{print $2}' ); do
if [[ ($i=0 || $i>=900) ]]; then
echo "PW ($i=0 || $i>=900)"
else
echo "PW ($i>0 && $i<900)"
if [[ -z "$(grep -E '^auth.*unlocktime=never' /etc/pam.d/password-auth)" ]]; then
fail "$rule" "unlock_time lines in password-auth found not set to never, 0, or >900"
break
else
echo "PW ($i=never)"
fi
fi
countpw=$(($countpw-1))
if [[ ($countpw == 0) ]]; then
break
else
continue
fi
done
for i in $(grep -Ew '^auth.*pam_faillock.so.*unlock_time=.*' /etc/pam.d/system-auth | grep -v '^#' | awk -F 'unlock_time=' '{print $2}'); do
if [[ $i=0 || $i>=900 ]]; then
echo "Sys ($i=0 || $i>=900)"
else
echo "Sys ($i>0 && $i<900)"
if [[ -z "$(grep -E '^auth.*unlocktime=never' /etc/pam.d/system-auth)" ]]; then
fail "$rule" "unlock_time lines in system-auth found not set to never, 0, or >900"
break
else
echo "Sys ($i=never)"
fi
fi
countsys=$(($countsys-1))
if [[ ($countsys==0) ]]; then
pass "$rule" "grep pam_faillock.so /etc/pam.d/system-auth" "Verified accounts subject to three unsuccessful login attempts within 15 minutes are locked for the maximum configurable period, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary."
break
else
continue
fi
done
fi
### V-71945 | RHEL-07-010330 ###
resetRule "SV-86569r4_rule"
nonzero "$rule" "grep 'pam_faillock.so.*even_deny_root' /etc/pam.d/password-auth /etc/pam.d/system-auth | grep -v '^#' | wc -l | awk -F ' ' '\$1 >=4'" "Verified if three unsuccessful root logon attempts within 15 minutes occur the associated account will be locked, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary." "Verified if three unsuccessful root logon attempts within 15 minutes occur the associated account will NOT be locked, therefore the reference STIG IS a finding. Engineer did NOT apply a change. Setting was incorrect by default and/or no change was necessary."
### V-71947 | RHEL-07-010340 ###
resetRule "SV-86571r3_rule"
set +H
zero "$rule" "egrep \"^[^#]*NOPASSWD\" /etc/sudoers /etc/sudoers.d/*" "Please note that accounts/groups connecting to the system that will use sudo use key authentication and not passwords, and, per the Check Content, for those accounts/groups this STIG item is Not Applicable. The local accounts, such as those in the eng group, should be the only ones that need the NOPASSWD tag removed from them. Standard Verbiage: Verified users must provide a password for privilege escalation, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary." "Please note that accounts/groups connecting to the system that will use sudo use key authentication and not passwords, and, per the Check Content, for those accounts/groups this STIG item is Not Applicable. The local accounts, such as those in the eng group, should be the only ones that need the NOPASSWD tag removed from them. Standard Verbiage: Verified users must provide a password for privilege escalation, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary."
set -H
### V-71949 | RHEL-07-010350 ###
resetRule "SV-86573r3_rule"
set +H
zero "$rule" "egrep \"^[^#]*!authenticate\" /etc/sudoers /etc/sudoers.d/*" "Verified users must re-authenticate for privilege escalation, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary." "Verified users do NOT re-authenticate for privilege escalation, therefore the reference STIG IS a finding. Engineer did NOT apply a change. Setting was incorrect by default and/or no change was necessary."
set -H
### V-71951 | RHEL-07-010430 ###
resetRule "SV-86575r2_rule"
nonzero "$rule" "egrep -i '^\s*fail_delay' /etc/login.defs | grep -v '^#' | awk -F ' ' '\$2 >=4'" "Verified the delay between logon prompts following a failed console logon attempt are at least four seconds, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary." "Verified the delay between logon prompts following a failed console logon attempt is NOT at least four seconds, therefore the reference STIG IS a finding. Engineer did NOT apply a change. Setting was incorrect by default and/or no change was necessary."
### V-71953 | RHEL-07-010440 ###
resetRule "SV-86577r2_rule"
if [[ -z "$(yum list installed | grep gnome)" ]]; then
na "$rule" "yum list installed | grep gnome" "Verified that the system does not have GNOME installed making this requirement Not Applicable."
else
nonzero "$rule" "egrep -i '^\s*automaticloginenable=false' /etc/gdm/custom.conf* | grep -v '^#'" "GNOME is installed and automatic login has been disabled" "GNOME is installed and automatic login has NOT been disabled"
fi
### V-71955 | RHEL-07-010450 ###
resetRule "SV-86579r3_rule"
if [[ -z "$(yum list installed | grep gnome)" ]]; then
na "$rule" "yum list installed | grep gnome" "Verified that the system does not have GNOME installed making this requirement Not Applicable."
else
nonzero "$rule" "egrep -i '^\s*timedloginenable=false' /etc/gdm/custom.conf* | grep -v '^#'" "GNOME is installed and timed login has been disabled" "GNOME is installed and timed login has NOT been disabled"
fi
### V-71957 | RHEL-07-010460 ###
resetRule "SV-86581r3_rule"
nonzero "$rule" "grep -i '^\s*PermitUserEnvironment no' /etc/ssh/sshd_config | grep -v '^#' " "Verified the operating system does not allow users to override SSH environment variables, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary." "Verified the operating system DOES allow users to override SSH environment variables, therefore the reference STIG IS a finding. Engineer did NOT apply a change. Setting was incorrect by default and/or no change was necessary."
### V-71959 | RHEL-07-010470 ###
resetRule "SV-86583r3_rule"
nonzero "$rule" "grep -i '^\s*HostbasedAuthentication no' /etc/ssh/sshd_config | grep -v '^#' " "Verified the operating system does not allow a non-certificate trusted host SSH logon to the system, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary." "Verified the operating system DOES allow a non-certificate trusted host SSH logon to the system, therefore the reference STIG IS a finding. Engineer did NOT apply a change. Setting was incorrect by default and/or no change was necessary."
### V-71961 | RHEL-07-010480 ###
resetRule "SV-86585r6_rule"
if [[ -d /sys/firmware/efi ]]; then
#Using EFI/UEFI
na "$rule" "EFI/UEFI in use" "EFI/UEFI in use"
else
#Using BIOS
if [[ -n "$(echo "$RHELverNumb" | grep -Eo '7.[2-9]')" ]]; then
na "$rule" "$HOSTNAME is running RHEL $RHELverNumb. This requirement is Not Applicable." "Verified the systems is running RHEL 7.2 or newer, therefore this is Not Applicable."
else
nonzero "$rule" "grep -Ei 'password_pbkdf2\s+root' /boot/grub2/grub.cfg" "Grub password has been configured" "Grub password has NOT been configured"
fi
fi
### V-71963 | RHEL-07-010490 ###
resetRule "SV-86587r4_rule"
if [[ -d /sys/firmware/efi ]]; then
#Using EFI/UEFI
if [[ -n "$(echo "$RHELverNumb" | grep -Eo '7.[2-9]')" ]]; then
na "$rule" "echo \"Redhat Version: $RHELverNumb\"" "Verified the systems is running RHEL 7.2 or newer, therefore this is Not Applicable."
else
nonzero "$rule" "grep -i '^\s*password_pbkdf2\s+root' /boot/efi/EFI/redhat/grub.cfg" "Grub password has been configured" "Grub password has NOT been configured"
fi
else
#Using BIOS
na "$rule" "echo 'System is using BIOS: this check is NA.
'; ls -l /sys/firmware/efi" "Verified the system uses BIOS, therefore this is Not Applicable."
fi
### V-71965 | RHEL-07-010500 ###
resetRule "SV-86589r2_rule"
if [[ -n "$(authconfig --test | grep -i '^\s*pam_pkcs11 is enabled')" ]]; then
if [[ -z "$(authconfig --test | grep -i '^\s*smartcard module = \n')" ]]; then
zero "$rule" "authconfig --test | grep -i '^\s*smartcard removal action = \n'" "Smartcard authentication has been configured per the STIG" "Smartcard authentication has NOT been configured per the STIG"
else
fail "$rule" "authconfig --test | grep -i '^\s*smartcard module = \n'" 'Check Only. Open Finding. Standard Verbiage: Smartcard and smartcard removal actions are not blank. This server is a VM which does not, and cannot, have a smartcard reader installed onto it. Instead authentication to the system is achieved either through the VMWare console (only used for local admistrative access and locked down through mulitple layers of rights and privildeges as well as being locked to smartcard passthrough authentication itself, therefore providing multiple layers of multi-factor authentication) or through ssh. We are currently working on a process for utilizing key authentication through a smartcard or the use of Kerberos tickets to ensure multi-factor authentication to the server. Commentary sent 4/4/17 to DISA explaining how we are at a loss as to how this would even be possible to implement on a virtual server. The settings in question require a smartcard reader that is physically connected to the server (which is accessed through a PAM module library), which is simply not possible on a VM. We could implement or require Token authentication through SSH, which could be from the smartcard token or possibly through the use of a Kerberos ticket created by smartcard authentication done on the originating system (for our site that would be through Citrix or a local workstation that is smartcard authenticated to an AD domain, whether through SSH from there or to the VMWare console.) DISAs response (Brian Snodgrass, 4/4/17): "RHEL-07-010500 has been required by USCYBERCOM for several years and the STIG Signing authority is no longer allowing UNIX/Linux operating system STIGs to not include how to deploy the capability. If you cannot implement smartcards your Authorizing Official will have to accept the risk." Based on this response we are leaving this item open but we expect our efforts to implement passthrough PKI or Kerberos authentication methods will provide mitigating factors for this item. Follow-up sent to DISA (Mr. Snodgrass) on 4/4/17 as follows: "Just one more comment on the below, if you dont mind: You wrote: "RHEL-07-010500 has been required by USCYBERCOM for several years and the STIG Signing authority is no longer allowing UNIX/Linux operating system STIGs to not include how to deploy the capability. If you cannot implement smartcards your Authorizing Official will have to accept the risk." I think my suggestion here is that the check, as currently written, locks in a single solution for smartcard authentication, one that requires a physical card-reader attached to the system in question. Perfectly implementable for workstations, for example, but on a virtual server thats not possible. Instead we have to utilize other methods, such as forcing only key authentication through SSH (or for sites with web servers you can set up smartcard authentication that way, but that is handled by the appropriate application STIG rather than the OS STIG anyway). So, for example, some kind of check that might add the following text: --- For systems which do not have the ability to include hardware smart card readers and the only access is through SSH, multifactor authentication usage can be checked with the following: # grep -I PasswordAuthentication /etc/ssh/sshd_config -- PasswordAuthentication no If the "PasswordAuthentication" setting is missing, commented out, or not set to "no", this is a finding. --- Arguably that could be a separate STIG item on its own and arguably configuring and using GSSAPI for Kerberos authentication would also be an acceptable replacement for this (although a couple of other STIG items do discourage that method by requiring those item not be configured "unless needed"), in which case simply replacing the final sentence in the Check Content, if at all possible, would be very helpful in dealing with auditors: "If smartcard authentication is disabled or the smartcard and smartcard removal actions are blank, or there is no other approved, verified method for enforcing multifactor authentication documented with the ISSO, this is a finding." That kind of wording is similar to allowing sites the flexibility to use Splunk instead of rsyslog, for example. I know it may be a long shot asking for that, but even that kind of simple wording change goes a LONG way to how the DoN has decided we need to strictly implement the STIG "guidelines", unfortunately." DISAs response (Brian Snodgrass, 4/4/17): "Ill take your comments into consideration for the requirement. The one thing that you have to remember about UNIX/Linux STIGs is that there are several different ways to meet some requirements - log rotation using splunk/rsyslog is just one example. I couldnt put splunk in as a way to meet the requirement(s) as the Red Hat rep that I was working with would object that its not a core Red Hat operating system application. A lot of the political nature of this STIG came down to those kinds of discussions. In several cases I am collecting input from the field to modify requirements so that when the Red Hat rep makes the statement that Ive made a change we did not agree on I can make my argument as to why I changed the check/fix."'
fi
else
fail "$rule" "authconfig --test | grep -i '^\s*pam_pkcs11 is enabled'" 'Check Only. Open Finding. Standard Verbiage: Smartcard and smartcard removal actions are not blank. This server is a VM which does not, and cannot, have a smartcard reader installed onto it. Instead authentication to the system is achieved either through the VMWare console (only used for local admistrative access and locked down through mulitple layers of rights and privildeges as well as being locked to smartcard passthrough authentication itself, therefore providing multiple layers of multi-factor authentication) or through ssh. We are currently working on a process for utilizing key authentication through a smartcard or the use of Kerberos tickets to ensure multi-factor authentication to the server. Commentary sent 4/4/17 to DISA explaining how we are at a loss as to how this would even be possible to implement on a virtual server. The settings in question require a smartcard reader that is physically connected to the server (which is accessed through a PAM module library), which is simply not possible on a VM. We could implement or require Token authentication through SSH, which could be from the smartcard token or possibly through the use of a Kerberos ticket created by smartcard authentication done on the originating system (for our site that would be through Citrix or a local workstation that is smartcard authenticated to an AD domain, whether through SSH from there or to the VMWare console.) DISAs response (Brian Snodgrass, 4/4/17): "RHEL-07-010500 has been required by USCYBERCOM for several years and the STIG Signing authority is no longer allowing UNIX/Linux operating system STIGs to not include how to deploy the capability. If you cannot implement smartcards your Authorizing Official will have to accept the risk." Based on this response we are leaving this item open but we expect our efforts to implement passthrough PKI or Kerberos authentication methods will provide mitigating factors for this item. Follow-up sent to DISA (Mr. Snodgrass) on 4/4/17 as follows: "Just one more comment on the below, if you dont mind: You wrote: "RHEL-07-010500 has been required by USCYBERCOM for several years and the STIG Signing authority is no longer allowing UNIX/Linux operating system STIGs to not include how to deploy the capability. If you cannot implement smartcards your Authorizing Official will have to accept the risk." I think my suggestion here is that the check, as currently written, locks in a single solution for smartcard authentication, one that requires a physical card-reader attached to the system in question. Perfectly implementable for workstations, for example, but on a virtual server thats not possible. Instead we have to utilize other methods, such as forcing only key authentication through SSH (or for sites with web servers you can set up smartcard authentication that way, but that is handled by the appropriate application STIG rather than the OS STIG anyway). So, for example, some kind of check that might add the following text: --- For systems which do not have the ability to include hardware smart card readers and the only access is through SSH, multifactor authentication usage can be checked with the following: # grep -I PasswordAuthentication /etc/ssh/sshd_config -- PasswordAuthentication no If the "PasswordAuthentication" setting is missing, commented out, or not set to "no", this is a finding. --- Arguably that could be a separate STIG item on its own and arguably configuring and using GSSAPI for Kerberos authentication would also be an acceptable replacement for this (although a couple of other STIG items do discourage that method by requiring those item not be configured "unless needed"), in which case simply replacing the final sentence in the Check Content, if at all possible, would be very helpful in dealing with auditors: "If smartcard authentication is disabled or the smartcard and smartcard removal actions are blank, or there is no other approved, verified method for enforcing multifactor authentication documented with the ISSO, this is a finding." That kind of wording is similar to allowing sites the flexibility to use Splunk instead of rsyslog, for example. I know it may be a long shot asking for that, but even that kind of simple wording change goes a LONG way to how the DoN has decided we need to strictly implement the STIG "guidelines", unfortunately." DISAs response (Brian Snodgrass, 4/4/17): "Ill take your comments into consideration for the requirement. The one thing that you have to remember about UNIX/Linux STIGs is that there are several different ways to meet some requirements - log rotation using splunk/rsyslog is just one example. I couldnt put splunk in as a way to meet the requirement(s) as the Red Hat rep that I was working with would object that its not a core Red Hat operating system application. A lot of the political nature of this STIG came down to those kinds of discussions. In several cases I am collecting input from the field to modify requirements so that when the Red Hat rep makes the statement that Ive made a change we did not agree on I can make my argument as to why I changed the check/fix."'
fi
### V-71967 | RHEL-07-020000 ###
resetRule "SV-86591r2_rule"
zero "$rule" "rpm -q rsh-server | grep -iv \"package.*is not installed\"" "Verified the rsh-server package is not installed, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary." "Verified the rsh-server package IS installed, therefore the reference STIG IS a finding. Engineer did NOT apply a change. Setting was incorrect by default and/or no change was necessary."
### V-71969 | RHEL-07-020010 ###
resetRule "SV-86593r2_rule"
zero "$rule" "rpm -q ypserv | grep -iv \"package.*is not installed\"" "Verified the ypserv package is not installed, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary." "Verified the ypserv package IS installed, therefore the reference STIG IS a finding. Engineer did NOT apply a change. Setting was incorrect by default and/or no change was necessary."
### V-71971 | RHEL-07-020020 ###
# Manual inspection - requires analyst to reconcile users against a local site list.
resetRule "SV-86595r2_rule"
nr "$rule" "semanage login -l" "Verify that all administrators are mapped to the "sysadm_u" or "staff_u" users role and that all authorized non-administrative users are mapped to the "user_u" role. Standard Verbiage: Verified the operating system prevents non-privileged users from executing privileged functions to include disabling, circumventing, or altering implemented security safeguards/countermeasures, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary."
### V-71973 | RHEL-07-020030 ###
# Manual inspection - Tools other than AIDE are permitted per STIG text. Aide is only used as an example.
# nonzero "RHEL-07-020130_rule" "grep aide /etc/crontab /etc/cron.*/* | egrep \"[0-9]*\s[0-9]*\s\*\s\*\s[0-7]|[0-9]*\s[0-9]*\s\*\s\*\s\*|[0-9]*\s\*\s\*\s\*\s\*\" | grep -v ^#"
resetRule "SV-86597r2_rule"
if [[ -n "$(yum list installed | grep aide)" ]]; then
nonzero "$rule" "grep aide /etc/crontab /etc/cron.*/* /var/spool/cron/root | grep '\-\-check' | awk -F ':' '{print $1}' | grep -v monthly | grep -v '^#'" "Verified a file integrity tool verifies the baseline operating system configuration at least weekly, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary." "Verified a file integrity tool does NOT verify the baseline operating system configuration at least weekly, therefore the reference STIG IS a finding. Engineer did NOT apply a change. Setting was incorrect by default and/or no change was necessary."
else
nr "$rule" "echo 'Manual inspection required.
'; yum list installed | grep aide"
fi
### V-71975 | RHEL-07-020040 ###
# Manual inspection - Tools other than AIDE are permitted per STIG text. Aide is only used as an example.
resetRule "SV-86599r2_rule"
if [[ -n "$(yum list installed | grep aide)" ]]; then
#AIDE installed, check crontab script file
nonzero "$rule" "grep aide /etc/crontab /etc/cron.*/* /var/spool/cron/root | grep 'mail' | grep -v '^#'" "Verified designated personnel are notified if baseline configurations are changed in an unauthorized manner, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary." "Verified designated personnel are NOT notified if baseline configurations are changed in an unauthorized manner, therefore the reference STIG IS a finding. Engineer did NOT apply a change. Setting was incorrect by default and/or no change was necessary."
else
#AIDE is not installed. Manual review required.
nr "$rule" "yum list installed | grep aide"
fi
### V-71977 | RHEL-07-020050 ###
resetRule "SV-86601r2_rule"
nonzero "$rule" "grep \"^gpgcheck\s*=\s*1\" /etc/yum.conf | grep -v '^#'" "Verified the operating system prevents the installation of software, patches, service packs, device drivers, or operating system components from a repository without verification they have been digitally signed using a certificate that is issued by a Certificate Authority (CA) that is recognized and approved by the organization, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary." "Verified the operating system does NOT prevent the installation of software, patches, service packs, device drivers, or operating system components from a repository without verification they have been digitally signed using a certificate that is issued by a Certificate Authority (CA) that is recognized and approved by the organization, therefore the reference STIG IS a finding. Engineer did NOT apply a change. Setting was incorrect by default and/or no change was necessary."
### V-71979 | RHEL-07-020060 ###
resetRule "SV-86603r2_rule"
nonzero "$rule" "grep \"^localpkg_gpgcheck\s*=\s*1\" /etc/yum.conf | grep -v '^#'" "Verified the operating system prevents the installation of software, patches, service packs, device drivers, or operating system components of local packages without verification they have been digitally signed using a certificate that is issued by a Certificate Authority (CA) that is recognized and approved by the organization, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary." "Verified the operating system does NOT prevent the installation of software, patches, service packs, device drivers, or operating system components of local packages without verification they have been digitally signed using a certificate that is issued by a Certificate Authority (CA) that is recognized and approved by the organization, therefore the reference STIG IS a finding. Engineer did NOT apply a change. Setting was incorrect by default and/or no change was necessary."
### V-71981 | RHEL-07-020070 ###
#Removed in v2r1
#resetRule="SV-86605r2_rule"
#nonzero "$rule" "grep \"^repo_gpgcheck=\s*1\" /etc/yum.conf | grep -v '^#' "
### V-71983 | RHEL-07-020100 ###
# May need to make this manual - if HBSS is configured on the system w/ DCM and DLP the check is NA
# alternatively, if the check check below fails, the local ISSO can document as permissable.
resetRule "SV-86607r4_rule"
nonzero "$rule" "grep -i 'blacklist usb-storage\|install usb-storage /bin/true' /etc/modprobe.d/blacklist.conf /etc/modprobe.d/usb-storage.conf | grep -v '^#' | wc -l | awk '\$0 > 1'" "Verified USB mass storage is disabled, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary." "Verified USB mass storage is NOT disabled, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was incorrect by default and/or no change was necessary."
### V-71985 | RHEL-07-020110 ###
# May need to make this manual if the check check below fails, the local ISSO can document as permissable.
resetRule "SV-86609r2_rule"
if [[ -z "$(systemctl status autofs | grep running)" ]]; then
pass "$rule" "systemctl status autofs" "Verified the Red Hat Enterprise Linux operating system disables the file system automounter unless required, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary."
else
pass "$rule" "systemctl status autofs" "autofs status is set to active, however it is documented with the Information System Security Officer (ISSO) that this is an operational requirement, therefore the reference STIG is not a finding. Engineer did NOT apply a change."
fi
### V-71987 | RHEL-07-020200 ###
resetRule "SV-86611r2_rule"
nonzero "$rule" "grep -i '^\s*clean_requirements_on_remove' /etc/yum.conf | grep -v '^#' | egrep -i '1|true|yes'" "Verified the operating system removes all software components after updated versions have been installed, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary." "Verified the operating system does NOT remove all software components after updated versions have been installed, therefore the reference STIG IS a finding. Engineer did NOT apply a change. Setting was incorrect by default and/or no change was necessary."
### V-71989 | RHEL-07-020210 ###
# May need to make this manual, if HBSS or HIPS is active this is NA.
resetRule "SV-86613r3_rule"
if [[ -n "$(rpm -qa | grep MFEhiplsm)" ]]; then
#McAfee HIPS installed
if [[ -n "$(ps -ef | grep -i 'hipclient')" ]]; then
#it's an active process
na "$rule" "echo 'McAFEE HIPS is installed and active. This check is not applicable
'; ps -ef | grep -i 'hipclient'" "McAFEE HIPS is installed and active. This check is not applicable"
else
#installed but inactive
nonzero "$rule" "getenforce | grep -i enforcing" "Verified the operating system has enabled SELinux, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary." "Verified the operating system does NOT have SELinux enabled, therefore the reference STIG IS a finding. Engineer did NOT apply a change. Setting was incorrect by default and/or no change was necessary."
fi
else
#not installed
nonzero "$rule" "getenforce | grep -i enforcing" "Verified the operating system has enabled SELinux, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary." "Verified the operating system does NOT have SELinux enabled, therefore the reference STIG IS a finding. Engineer did NOT apply a change. Setting was incorrect by default and/or no change was necessary."
fi
### V-71991 | RHEL-07-020220 ###
# May need to make this manual, if HBSS or HIPS is active this is NA.
resetRule "SV-86615r5_rule"
if [[ -n "$(rpm -qa | grep MFEhiplsm)" ]]; then
#McAfee HIPS installed
if [[ -n "$(ps -ef | grep -i 'hipclient')" ]]; then
#it's an active process
na "$rule" "echo 'McAFEE HIPS is installed and active. This check is not applicable
'; ps -ef | grep -i 'hipclient'" "McAFEE HIPS is installed and active"
else
#installed but inactive
if [[ -n "$(sestatus | grep -i 'SELinux status:' | grep -i 'enabled')" ]]; then
nonzero "$rule" "sestatus | grep -Ei 'Loaded Policy Name:|Policy from config file:' | grep -i 'targeted'" "Verified the operating system has enabled the SELinux targeted policy, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary." "Verified the operating system has NOT enabled the SELinux targeted policy, therefore the reference STIG IS a finding. Engineer did NOT apply a change. Setting was incorrect by default and/or no change was necessary."
else
fail "$rule" "sestatus | grep -i '^\s*SELinux status:\s*enabled'" "SELinux is not enabled"
fi
fi
else
#not installed
if [[ -n "$(sestatus | grep -i 'SELinux status:' | grep -i 'enabled')" ]]; then
nonzero "$rule" "sestatus | grep -Ei 'Loaded Policy Name:|Policy from config file:' | grep -i 'targeted'" "Verified the operating system has enabled the SELinux targeted policy, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary." "Verified the operating system has NOT enabled the SELinux targeted policy, therefore the reference STIG IS a finding. Engineer did NOT apply a change. Setting was incorrect by default and/or no change was necessary."
else
fail "$rule" "sestatus | grep -i '^\s*SELinux status:\s*enabled'" "SELinux is not enabled"
fi
fi
### V-71993 | RHEL-07-020230 ###
#NOTE, this will not give results. Find a way to escalate
# so that this is not blocked.
resetRule "SV-86617r5_rule"
nonzero "$rule" "systemctl status ctrl-alt-del.target | grep dead" "Verified the x86 Ctrl-Alt-Delete key sequence is disabled, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary." "Verified the x86 Ctrl-Alt-Delete key sequence is NOT disabled, therefore the reference STIG IS a finding. Engineer did NOT apply a change. Setting was incorrect by default and/or no change was necessary."
### V-71995 | RHEL-07-020240 ###
resetRule "SV-86619r2_rule"
zero "$rule" "grep -i umask /etc/login.defs | grep -v ^# | grep -iv \"umask\s*077\"" "Verified the operating system defines default permissions for all authenticated users in such a way that the user can only read and modify their own files, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary." "Verified the operating system does NOT define default permissions for all authenticated users in such a way that the user can only read and modify their own files, therefore the reference STIG IS a finding. Engineer did NOT apply a change. Setting was incorrect by default and/or no change was necessary."
### V-71997 | RHEL-07-020250 ###
resetRule "SV-86621r5_rule"
case "$RHELverNumb" in
'7.9'|'7.8'|'7.7')
pass "$rule" "RHEL Version $RHELverNumb is not EoL" "Verified the operating system is a supported release, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary."
;;
'7.6')
if [[ "$(date +'%Y%m%d')" -gt "20201031" ]]; then
fail "$rule" "RHEL Version $RHELverNumb is EoL"
else
pass "$rule" "RHEL Version $RHELverNumb is not EoL" "Verified the operating system is a supported release, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary."
fi
;;
'7.5')
if [[ "$(date +'%Y%m%d')" -gt "2020430" ]]; then
fail "$rule" "RHEL Version $RHELverNumb is EoL"
else
pass "$rule" "RHEL Version $RHELverNumb is not EoL" "Verified the operating system is a supported release, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary."
fi
;;
'7.4')
if [[ "$(date +'%Y%m%d')" -gt "20190831" ]]; then
fail "$rule" "RHEL Version $RHELverNumb is EoL"
else
pass "$rule" "RHEL Version $RHELverNumb is not EoL" "Verified the operating system is a supported release, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary."
fi
;;
*)
fail "$rule" "RHEL Version $RHELverNumb is EoL"
;;
esac
### V-71999 | RHEL-07-020260 ###
# Manual inspection - will need to lookup if returned results are at supported versions.
resetRule "SV-86623r4_rule"
nr "$rule" "echo '#Manual Inspection Required
'; yum history list;" "Verify the latest patches were applied within the last 4 weeks. Standard Verbiage: Verified vendor packaged system security patches and updates are installed and up to date, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary."
### V-72001 | RHEL-07-020270 ###
# Manual inspection - will need to lookup listed accounts against local ISSO List
resetRule "SV-86625r2_rule"
nr "$rule" "echo '#Manual Inspection Required
'; cat /etc/passwd;" "Verify the accounts on the system match the provided documentation or are accounts that support an authorized system function. Standard Verbiage: Verified the system does not have unnecessary accounts, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary."
### V-72003 | RHEL-07-020300 ###
resetRule "SV-86627r2_rule"
zero "$rule" "pwck -rq | grep -i 'no group'" "Verified all Group Identifiers (GIDs) referenced in the /etc/passwd file are defined in the /etc/group file, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary." "Verified all Group Identifiers (GIDs) referenced in the /etc/passwd file are NOT defined in the /etc/group file, therefore the reference STIG IS a finding. Engineer did NOT apply a change. Setting was incorrect by default and/or no change was necessary."
### V-72005 | RHEL-07-020310 ###
resetRule "SV-86629r2_rule"
zero "$rule" "awk -F: '(\$3 == 0) {print}' /etc/passwd | grep -v '^root'" "Verified the root account isthe only account having unrestricted access to the system, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary." "Verified the root account is NOT the only account having unrestricted access to the system, therefore the reference STIG IS a finding. Engineer did NOT apply a change. Setting was incorrect by default and/or no change was necessary."
### V-72007 | RHEL-07-020320 ###
resetRule "SV-86631r3_rule"
zero "$rule" "find / -fstype xfs -nouser" "Verified all files and directories have a valid owner, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary." "Verified all files and directories do NOT have a valid owner, therefore the reference STIG IS a finding. Engineer did NOT apply a change. Setting was incorrect by default and/or no change was necessary."
### V-72009 | RHEL-07-020330 ###
resetRule "SV-86633r3_rule"
zero "$rule" "find / -fstype xfs -nogroup" "Verified all files and directories have a valid group owner, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary." "Verified all files and directories do NOT have a valid group owner, therefore the reference STIG IS a finding. Engineer did NOT apply a change. Setting was incorrect by default and/or no change was necessary."
### V-72011 | RHEL-07-020600 ###
# PEER REVIEW NEEDED
# This mini script does the following
# 1 - initalize counter set to the number of interactive users
# ASSUMPTION: Interactive users are those whose shell is not set to nologin, false, sync, shutdown or halt
# 2 - creates a for loop, based on the number of interactive users detected
# 3 - the user's home directory is checked to ensure it exists
# 3a - if it does not exist, the loop is broken and a fail result is generated
# 3b - if it exists, decrease the counter by 1, and continue
# 4 - check to see if the counter has gotten to 0
# 4a - if counter has reached 0, the loop is broken and a pass result is generated
# 4b - if count has not reached 0, start next iteration
resetRule "SV-86635r2_rule"
echo "Check $rule"
count="$(cut -d: -f 1,6,7 /etc/passwd | grep -vic 'nologin\|false\|sync\|shutdown\|halt\|splunk')"
for i in $(cut -d: -f 1,6,7 /etc/passwd | grep -vi 'nologin\|false\|sync\|shutdown\|halt\|splunk' | awk -F: '{print $2}'); do
if [[ ! -e "$i" ]]; then
fail "$rule" "echo \"\$(echo \$i) does not exist \""
break
else
count=$(($count-1))
fi
if [[ ("$count" == "0") ]]; then
pass "$rule" "cut -d: -f 1,6,7 /etc/passwd | grep -vi 'nologin\|false\|sync\|shutdown\|halt' | awk -F: '{print \$2}'" "Verified all local interactive users have a home directory assigned in the /etc/passwd file, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary."
break
else
continue
fi
done
### V-72013 | RHEL-07-020610 ###
resetRule "SV-86637r2_rule"
nonzero "$rule" "grep -i '^\s*create_home' /etc/login.defs | grep -v '^#' | grep -i yes" "Verified all local interactive user accounts, upon creation, are assigned a home directory, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary." "Verified all local interactive user accounts, upon creation, are NOT assigned a home directory, therefore the reference STIG IS a finding."
### V-72015 | RHEL-07-020620 ###
# Note - 020620 and 020640 appear (to me) to be checking the same thing; but with a different
# first step in the check (020620 starts with pwck -r, but then goes and validates /etc/passwd as in 20640).
# I've resused the same script for both.
resetRule "SV-86639r2_rule"
echo "Check $rule"
count="$(cut -d: -f 1,6,7 /etc/passwd | grep -vic 'nologin\|false\|sync\|shutdown\|halt\|splunk')"
for i in $(cut -d: -f 1,6,7 /etc/passwd | grep -vi 'nologin\|false\|sync\|shutdown\|halt\|splunk' | awk -F: '{print $2}'); do
if [[ ! -e "$i" ]]; then
fail "$rule" "echo '\$i \" does not exist\" '"
break
else
count=$(($count-1))
fi
if [[ ("$count" == "0") ]]; then
pass "$rule" "cut -d: -f 1,6,7 /etc/passwd | grep -vi 'nologin\|false\|sync\|shutdown\|halt\|splunk' | awk -F: '{print \$2}'" "Verified all local interactive user home directories defined in the /etc/passwd file exist, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary."
break
else
continue
fi
done
### V-72017 | RHEL-07-020630 ###
resetRule "SV-86641r3_rule"
echo "Check $rule"
count="$(cut -d: -f 1,6,7 /etc/passwd | grep -vic 'nologin\|false\|sync\|shutdown\|halt\|splunk')"
for i in $(cut -d: -f 1,6,7 /etc/passwd | grep -vi 'nologin\|false\|sync\|shutdown\|halt\|splunk' | awk -F: '{print $2}'); do
if [[ -n "$(stat -c '%n %a' $i | awk '$2 > 750 {print}')" ]]; then
fail "$rule" "stat -c '%n %a' $i "
break
else
count=$(($count-1))
fi
if [[ ("$count" == "0") ]]; then
pass "$rule" "cut -d: -f 1,6,7 /etc/passwd | grep -vi 'nologin\|false\|sync\|shutdown\|halt\|splunk' | awk -F: '{print \$2}'" "Verified all local interactive user home directories have mode 0750 or less permissive, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary."
break
else
continue
fi
done
### V-72019 | RHEL-07-020640 ###
resetRule "SV-86643r5_rule"
echo "Check $rule"
count="$(cut -d: -f 1,6,7 /etc/passwd | grep -vic 'nologin\|false\|sync\|shutdown\|halt\|splunk')"
for i in $(cut -d: -f 1,6,7 /etc/passwd | grep -vi 'nologin\|false\|sync\|shutdown\|halt\|splunk' | awk -F: '{print $1 ":" $2}'); do
OWNER=$(echo $i | awk -F: '{print $1}')
HOMEDIR=$(echo $i | awk -F: '{print $2}')
if [[ "$OWNER" != $(stat -c %U "$HOMEDIR") ]]; then
fail "$rule" $i
break
else
count=$(($count-1))
fi
if [[ ("$count" == "0") ]]; then
pass "$rule" "Each interactive user owns their own home directory" "Verified all local interactive user home directories are owned by their respective users, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary."
break
else
continue
fi
done
### V-72021 | RHEL-07-020650 ###
resetRule "SV-86645r5_rule"
echo "Check $rule"
count="$(cut -d: -f 1,6,7 /etc/passwd | grep -vic 'nologin\|false\|sync\|shutdown\|halt\|splunk')"
for i in $(cut -d: -f 1,6,7 /etc/passwd | grep -vi 'nologin\|false\|sync\|shutdown\|halt\|splunk' | awk -F: '{print $1 ":" $2}'); do
OWNER=$(echo $i | awk -F: '{print $1}')
HOMEDIR=$(echo $i | awk -F: '{print $2}')
if [[ $(id -g "$OWNER") != $(stat -c %g "$HOMEDIR") ]]; then
fail "$rule" $i
break
else
count=$(($count-1))
fi
if [[ ("$count" == "0") ]]; then
pass "$rule" "Each interactive user home dir is gowned by its respective user" "Verified all local interactive user home directories are group-owned by the home directory owners primary group, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary."
break
else
continue
fi
done
### V-72023 | RHEL-07-020660###
resetRule "SV-86647r2_rule"
echo "Check $rule"
declare -A output
count="$(cut -d: -f 1,3,6,7 /etc/passwd | grep -vi 'nologin\|false\|sync\|shutdown\|halt\|splunk' | awk -F: '$2 >=1000 {print $3}' | wc -l )"
for i in $(cut -d: -f 1,3,6,7 /etc/passwd | grep -vi 'nologin\|false\|sync\|shutdown\|halt\|splunk' | awk -F: '$2 >=1000 {print $1 ":" $3}'); do
OWNER=$(echo $i | awk -F: '{print $1}')
HOMEDIR=$(echo $i | awk -F: '{print $2}')
count2="$(find "$HOMEDIR" -print | xargs stat -c '%U' | wc -l)"
for c in $(find "$HOMEDIR" -print | xargs stat -c '%U%n'); do
if [[ "$OWNER" != "$(echo $c | awk -F"/" '{print $1}')" ]]; then
output="$output $(echo $c | sed 's/\//:\//')"
fail "$rule" "$(echo ${output[@]})" "Any files listed are not owned by the owner of the listed home directory. To be complaint the ownership will need to be changed on those files. Verified the Red Hat Enterprise Linux operating system is NOT configured so that all files and directories contained in local interactive user home directories are owned by the owner of the home directory, therefore the reference STIG IS a finding. Engineer did NOT apply a change. Setting was incorrect by default and/or no change was made."
#break
else
count2=$(($count2-1))
fi
if [[ ("$count2" == "0") ]]; then
count=$(($count-1))
break
else
continue
fi
done
if [[ ("$count" == "0") ]]; then
pass "$rule" "All files and directories within the local, interactive users' home directories are owned by that user." "Verified all files and directories contained in local interactive user home directories are owned by the owner of the home directory, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary."
break
else
continue
fi
done
unset output
### V-72025 | RHEL-07-020670 ###
resetRule "SV-86649r2_rule"
echo "Check $rule"
declare -A output
count="$(cut -d: -f 1,3,6,7 /etc/passwd | grep -vi 'nologin\|false\|sync\|shutdown\|halt\|splunk' | awk -F: '$2 >=1000 {print $3}' | wc -l )"
for i in $(cut -d: -f 1,3,6,7 /etc/passwd | grep -vi 'nologin\|false\|sync\|shutdown\|halt\|splunk' | awk -F: '$2 >=1000 {print $1 ":" $3}'); do
OWNER=$(echo $i | awk -F: '{print $1}')
GROUP=$(groups $OWNER | awk -F: '{print $2}' | awk '{$1=$1};1')
HOMEDIR=$(echo $i | awk -F: '{print $2}')
count2="$(find "$HOMEDIR" -print | xargs stat -c '%G' | wc -l)"
for c in $(find "$HOMEDIR" -print | xargs stat -c '%G%n'); do
if [[ "$GROUP" != "$(echo $c | awk -F"/" '{print $1}')" ]]; then
output="$output $(echo $c | sed 's/\//:\//')"
fail "$rule" "$(echo ${output[@]})" "Any files listed are not group owned by the primary group of the listed home directory user. To be complaint the ownership will need to be changed on those files. Verified the Red Hat Enterprise Linux operating system is NOT configured so that all files and directories contained in local interactive user home directories are owned by the owner of the home directory, therefore the reference STIG IS a finding. Engineer did NOT apply a change. Setting was incorrect by default and/or no change was made."
#break
else
count2=$(($count2-1))
fi
if [[ ("$count2" == "0") ]]; then
count=$(($count-1))
break
else
continue
fi
done
if [[ ("$count" == "0") ]]; then
pass "$rule" "All files and directories within the local, interactive users' home directories are group owned by that user's group." "Verified all files and directories contained in local interactive user home directories are group-owned by a group of which the home directory owner is a member, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary."
break
else
continue
fi
done
unset output
### V-72027 | RHEL-07-020680 ###
resetRule "SV-86651r2_rule"
echo "Check $rule"
count="$(cut -d: -f 1,3,6,7 /etc/passwd | grep -vi 'nologin\|false\|sync\|shutdown\|halt\|splunk' | awk -F: '$2 >=1000 {print $3}' | wc -l )"
for i in $(cut -d: -f 1,3,6,7 /etc/passwd | grep -vi 'nologin\|false\|sync\|shutdown\|halt\|splunk' | awk -F: '$2 >=1000 {print $1 ":" $3}'); do
HOMEDIR=$(echo $i | awk -F: '{print $2}')
if [[ -n "$(find "$HOMEDIR" -type f | xargs stat -c '%a:%n' | grep -v '\.' )" ]]; then
count2="$(find "$HOMEDIR" -type f | xargs stat -c '%a:%n' | grep -v '\.' | wc -l)"
for c in $(find "$HOMEDIR" -type f | xargs stat -c '%a:%n' | grep -v '\.' ); do
if [[ "$c" > 750 ]]; then
fail "$rule" "$(find "$HOMEDIR" -type f | xargs stat -c '%a:%n' | grep -v '\.')"
break
else
count2=$(($count2-1))
fi
if [[ ("$count2" == "0") ]]; then
count=$(($count-1))
break
else
continue
fi
done
else
count=$(($count-1))
fi
if [[ ("$count" == "0") ]]; then
pass "$rule" "All files and directories within the local, interactive users' home directories mode 0750 or less." "Verified all files and directories contained in local interactive user home directories have mode 0750 or less permissive, therefore the reference STIG is not a finding. Engineer did NOT apply a change. Setting was correct by default and/or no change was necessary."
break
else
continue
fi
done
### V-72029 | RHEL-07-020690 ###
resetRule "SV-86653r3_rule"
echo "Check $rule"
count="$(cut -d: -f 1,3,6,7 /etc/passwd | grep -vi 'nologin\|false\|sync\|shutdown\|halt\|splunk' | awk -F: '$2 >=1000 {print $3}' | wc -l )"
for i in $(cut -d: -f 1,3,6,7 /etc/passwd | grep -vi 'nologin\|false\|sync\|shutdown\|halt\|splunk' | awk -F: '$2 >=1000 {print $1 ":" $3}'); do
OWNER=$(echo $i | awk -F: '{print $1}')
HOMEDIR=$(echo $i | awk -F: '{print $2}')
if [[ -n "$(find "$HOMEDIR" -type f | xargs stat -c '%n' )" ]]; then
count2="$(find "$HOMEDIR" -type f | xargs stat -c '%n' | wc -l)"
for c in $(find "$HOMEDIR" -type f | xargs stat -c '%U' ); do
if [[ "$c" != "$OWNER" ]] && [[ "$c" != "root" ]] ; then
fail "$rule" "$(find "$HOMEDIR" -type f | xargs stat -c '%n:%U')"
break
else
count2=$(($count2-1))
fi
if [[ ("$count2" == "0") ]]; then
count=$(($count-1))
break
else
continue
fi
done
else
count=$(($count-1))
fi