-
Notifications
You must be signed in to change notification settings - Fork 62
/
supportconfig
executable file
·4489 lines (4265 loc) · 148 KB
/
supportconfig
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
SVER='3.1.11-29.1'
SDATE='2022 02 02'
##############################################################################
# supportconfig - Gathers system troubleshooting information for SUSE Support
# Copyright (C) 2001-2022 SUSE LLC
#
# Creates a tar ball to attach to the support case or send to support.
# Collects comprehensive system information for troubleshooting and reducing
# resolution time.
#
# Disclaimer:
# Detailed system information and logs are collected and organized in a
# manner that helps reduce service request resolution times. Private system
# information can be disclosed when using this tool. If this is a concern,
# please prune private data from the log files. Several startup options
# are available to exclude more sensitive information. Use supportconfig -h
# to see these options.
##############################################################################
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
# Authors/Contributors:
# Jason Record <jason.record@suse.com>
#
##############################################################################
##############################################################################
# SUSE Function Definitions
##############################################################################
title() {
echo "============================================================================="
echo " Support Utilities - Supportconfig"
echo " Script Version: $SVER"
echo " Library Version: $RCVER"
echo " Script Date: $SDATE"
echo
echo " Detailed system information and logs are collected and organized in a"
echo " manner that helps reduce service request resolution times. Private system"
echo " information can be disclosed when using this tool. If this is a concern,"
echo " please prune private data from the log files. Several startup options"
echo " are available to exclude more sensitive information. Supportconfig data is"
echo " used only for diagnostic purposes and is considered confidential information."
echo " See http://www.suse.com/company/policies/privacy/"
echo "============================================================================="
echo
}
show_help() {
log2sys "Show Help Screen"
echo " Usage: $CURRENT_SCRIPT [OPTION [OPTION ...]]"
echo
echo " -h This screen"
echo " -A Activates all supportconfig functions with additional logging and full"
echo " rpm verification."
echo " -B <string> Custom tar ball file name element"
echo " -C Creates a new default $SC_CONF"
echo " -D Use defaults; ignore $SC_CONF"
echo " -E <string> Contact email address"
echo " -F Display available supportconfig feature keywords (case-sensitive) used"
echo " with -i and -x"
echo " -G <gpg_uid> The GPG recipient's user ID used to encrypt the supportconfig tarball"
echo " -H <number> Limit number of included HA Policy engine files"
echo " -I <number> Default log file line count"
echo " -J Collect memory information from sysfs"
echo " -L Create a full file listing from '/'"
echo " -M <string> Contact terminal ID"
echo " -N <string> Contact name"
echo " -O <string> Contact company name"
echo " -P <string> Contact phone number"
echo " -Q Run in silent mode"
echo " -R <path> Log output directory"
echo " -S <number> Limit number of included SAR files"
echo " -T <seconds> Binary execution timeout"
echo " -U <URI string> Sets upload target URL and initiates an upload, supported"
echo " services include: ftp, ftps/ftpes, https, scp"
echo " -X <number> Max system logs line count"
echo " -a Upload the tar ball to the specified alternate target VAR_OPTION_UPLOAD_TARGET_ALT"
echo " -b Screen buffer mode"
echo " -c Disables curl checks to SUSE update servers"
echo " -d Exclude detailed disk info and scans"
echo " -f From directory. Don't collect report files, just use the directory or files in that"
echo " directory."
echo " -g Use gzip instead of the default xz compression"
echo " -i <keyword list>"
echo " Include keywords. A comma separated list of feature keywords that specify"
echo " which features to include. Use -F to see a list of valid keywords."
echo " -k disable all commands that do automatic kernel module loading."
echo " -l Gathers additional rotated logs"
echo " -m Only gather a minimum amount of info: basic env, basic health, hardware,"
echo " rpm, messages, y2logs"
echo " -o Toggle listed features on or off"
echo " -p Disable all plugins"
echo " -q Add a uuid to the tar ball filename to ensure uniqueness"
echo " -r <srnum>"
echo " Includes the service request number when uploading the tar ball"
echo " -s Include full SLP service lists"
echo " -t <directory>"
echo " Target directory. Just save log files to <directory>, do not create a tarball."
echo " -u Upload the tar ball to the specified VAR_OPTION_UPLOAD_TARGET."
echo " -v Performs an rpm -V for each installed rpm NOTE: This takes a long time"
echo " to complete"
echo " -w Enable verbose wait trace logging. Shows the start and stop times of each"
echo " command supportconfig is running."
echo " -x <keyword list>"
echo " Exclude keywords. A comma separated list of feature keywords that specify"
echo " which features to exclude. Use -F to see a list of valid keywords."
echo " -y Gathers full YaST log files."
echo " -z Use bzip2 instead of the default xz compression"
echo
echo " Use Ctrl-\ to try and skip a function that is hanging."
echo
echo "-----------------------------------------------------------------------------"
echo " NOTE:"
echo " This tool will create a tar ball in the /var/log directory. Please attach"
echo " the log file tar ball to your open Service Request at the following URL:"
echo " https://scc.suse.com/support/requests"
echo
echo " If you cannot attach the tar ball to the SR, then email it to the engineer."
echo
echo " Please submit bug fixes or comments via:"
echo " https://en.opensuse.org/openSUSE:Submitting_bug_reports"
echo
title
}
basic_environment() {
# This is a minimum required function, do not exclude
printlog "Basic Environment..."
test $MIN_OPTION_ENV -eq 0 && { echolog EXCLUDED; return 1; }
addHeaderFile $BASIC_ENVF
get_customer_info $BASIC_ENVF
log_cmd $BASIC_ENVF 'date'
log_cmd $BASIC_ENVF 'uname -a'
RELEASE=$(ls -1 /etc/*release*)
detectProducts $BASIC_ENVF
detectVirtualization $BASIC_ENVF
conf_files $BASIC_ENVF $RELEASE
if ! ((NSA_CHECK)); then
if [ $SLES_VER -lt 110 ]; then
if rpm_verify $BASIC_ENVF SPident; then
log_cmd $BASIC_ENVF 'SPident -vv'
fi
fi
cat $LOG/$RPM_DIST_FILE >> $LOG/$BASIC_ENVF
case $SLES_VER in
15*|999)
if rpm_verify $BASIC_ENVF firewalld
then
log_write $BASIC_ENVF "#==[ Firewall Services ]============================#"
log_write $BASIC_ENVF "# Service state"
wait_trace_on "systemctl status firewalld.service"
log_write $BASIC_ENVF "$(systemctl status firewalld.service)"
wait_trace_off
IPBIN="/usr/sbin/iptables"
if [[ -x $IPBIN ]]; then
TOTAL_FIREWALL_RULES=0
for TABLE in filter nat mangle raw security
do
if grep iptable_$TABLE /proc/modules &>/dev/null
then
wait_trace_on "$IPBIN -t $TABLE -nL | sed -e '/^$/d' -e '/^Chain/d' -e '/^target/d' | wc -l"
FIREWALL_RULES=$($IPBIN -t $TABLE -nL | sed -e '/^$/d' -e '/^Chain/d' -e '/^target/d' | wc -l)
TOTAL_FIREWALL_RULES=$(( TOTAL_FIREWALL_RULES + FIREWALL_RULES ))
wait_trace_off
fi
done
log_write $BASIC_ENVF
log_write $BASIC_ENVF "$TOTAL_FIREWALL_RULES Active Firewall Rules"
log_write $BASIC_ENVF
fi
fi
;;
11*|12*)
if rpm_verify $BASIC_ENVF SuSEfirewall2
then
log_write $BASIC_ENVF "#==[ Firewall Services ]============================#"
log_write $BASIC_ENVF "# Service state"
if (( SLES_VER >= 120 )); then
wait_trace_on "systemctl status SuSEfirewall2.service"
log_write $BASIC_ENVF "$(systemctl status SuSEfirewall2.service)"
wait_trace_off
wait_trace_on "systemctl status SuSEfirewall2_init.service"
log_write $BASIC_ENVF "$(systemctl status SuSEfirewall2_init.service)"
wait_trace_off
else
for i in $(rpm -ql SuSEfirewall2 | grep init.d)
do
FSRV=$(basename $i)
wait_trace_on "chkconfig $FSRV --list"
log_write $BASIC_ENVF "$(chkconfig $FSRV --list)"
wait_trace_off
done
fi
IPBIN="/usr/sbin/iptables"
if [[ -x $IPBIN ]]; then
TOTAL_FIREWALL_RULES=0
for TABLE in filter nat mangle raw
do
if grep iptable_$TABLE /proc/modules &>/dev/null
then
wait_trace_on "$IPBIN -t $TABLE -nL | sed -e '/^$/d' -e '/^Chain/d' -e '/^target/d' | wc -l"
FIREWALL_RULES=$($IPBIN -t $TABLE -nL | sed -e '/^$/d' -e '/^Chain/d' -e '/^target/d' | wc -l)
TOTAL_FIREWALL_RULES=$(( TOTAL_FIREWALL_RULES + FIREWALL_RULES ))
wait_trace_off
fi
done
log_write $BASIC_ENVF
log_write $BASIC_ENVF "$TOTAL_FIREWALL_RULES Active Firewall Rules"
log_write $BASIC_ENVF
fi
fi
;;
esac
fi
echolog Done
}
basic_healthcheck() {
# This is a minimum required function, do not exclude
printlog "Basic Server Health Check..."
test $MIN_OPTION_HC -eq 0 && { echolog EXCLUDED; return 1; }
OF=basic-health-check.txt
addHeaderFile $OF
log_cmd $OF 'uptime'
log_cmd $OF 'grep -H . /sys/devices/system/cpu/vulnerabilities/*'
log_cmd $OF 'vmstat 1 4'
test -x /usr/bin/mpstat && log_cmd $OF 'mpstat -P ALL 1 3'
log_cmd $OF 'free -k'
timed_log_cmd $OF 'df -h' || IO_DELAYS=1
(( $IO_DELAYS )) || log_cmd $OF 'df -i'
TAINT_SRC='/proc/sys/kernel/tainted'
conf_files $OF $TAINT_SRC
TAINT=$(cat $TAINT_SRC)
TAINTED=0
if (( ${#TAINT} > 1 )); then
TAINTED=1
elif (( ${TAINT} > 0 )); then
TAINTED=1
fi
if (( TAINTED )); then
# TAINT=$(( 1 + 2 + 4 + 8 + 16 + 32 + 64 + 128 + 256 ))
# Refer to /usr/src/linux/include/linux/kernel.h and /usr/src/linux/kernel/panic.c (print_tainted function)
TAINT_STRING=""
# common to all versions SLES15 and higher
test $((TAINT & 1)) -ne 0 && TAINT_STRING="${TAINT_STRING}P" || TAINT_STRING="${TAINT_STRING} "
test $((TAINT & 2)) -ne 0 && TAINT_STRING="${TAINT_STRING}F" || TAINT_STRING="${TAINT_STRING} "
test $((TAINT & 4)) -ne 0 && TAINT_STRING="${TAINT_STRING}S" || TAINT_STRING="${TAINT_STRING} "
test $((TAINT & 8)) -ne 0 && TAINT_STRING="${TAINT_STRING}R" || TAINT_STRING="${TAINT_STRING} "
test $((TAINT & 16)) -ne 0 && TAINT_STRING="${TAINT_STRING}M" || TAINT_STRING="${TAINT_STRING} "
test $((TAINT & 32)) -ne 0 && TAINT_STRING="${TAINT_STRING}B" || TAINT_STRING="${TAINT_STRING} "
test $((TAINT & 64)) -ne 0 && TAINT_STRING="${TAINT_STRING}U" || TAINT_STRING="${TAINT_STRING} "
test $((TAINT & 128)) -ne 0 && TAINT_STRING="${TAINT_STRING}D" || TAINT_STRING="${TAINT_STRING} "
test $((TAINT & 256)) -ne 0 && TAINT_STRING="${TAINT_STRING}A" || TAINT_STRING="${TAINT_STRING} "
test $((TAINT & 512)) -ne 0 && TAINT_STRING="${TAINT_STRING}W" || TAINT_STRING="${TAINT_STRING} "
test $((TAINT & 1024)) -ne 0 && TAINT_STRING="${TAINT_STRING}C" || TAINT_STRING="${TAINT_STRING} "
test $((TAINT & 2048)) -ne 0 && TAINT_STRING="${TAINT_STRING}I" || TAINT_STRING="${TAINT_STRING} "
test $((TAINT & 4096)) -ne 0 && TAINT_STRING="${TAINT_STRING}O" || TAINT_STRING="${TAINT_STRING} "
test $((TAINT & 8192)) -ne 0 && TAINT_STRING="${TAINT_STRING}E" || TAINT_STRING="${TAINT_STRING} "
test $((TAINT & 16384)) -ne 0 && TAINT_STRING="${TAINT_STRING}L" || TAINT_STRING="${TAINT_STRING} "
test $((TAINT & 32768)) -ne 0 && TAINT_STRING="${TAINT_STRING}K" || TAINT_STRING="${TAINT_STRING} "
case $SLES_VER in
150|151)
test $((TAINT & 65536)) -ne 0 && TAINT_STRING="${TAINT_STRING}H" || TAINT_STRING="${TAINT_STRING} "
test $((TAINT & 1073741824)) -ne 0 && TAINT_STRING="${TAINT_STRING}N" || TAINT_STRING="${TAINT_STRING} "
test $((TAINT & 2147483648)) -ne 0 && TAINT_STRING="${TAINT_STRING}X" || TAINT_STRING="${TAINT_STRING} "
;;
15*|999)
test $((TAINT & 65536)) -ne 0 && TAINT_STRING="${TAINT_STRING}X" || TAINT_STRING="${TAINT_STRING} "
test $((TAINT & 131072)) -ne 0 && TAINT_STRING="${TAINT_STRING}T" || TAINT_STRING="${TAINT_STRING} "
test $((TAINT & 262144)) -ne 0 && TAINT_STRING="${TAINT_STRING}H" || TAINT_STRING="${TAINT_STRING} "
test $((TAINT & 2147483648)) -ne 0 && TAINT_STRING="${TAINT_STRING}N" || TAINT_STRING="${TAINT_STRING} "
;;
esac
log_write $OF "Kernel Status -- Tainted: $TAINT_STRING"
# common to all versions SLES15 and higher
test $((TAINT & 1)) -ne 0 && log_write $OF " TAINT: (P) Proprietary module has been loaded"
test $((TAINT & 2)) -ne 0 && log_write $OF " TAINT: (F) Module was forcibly loaded"
test $((TAINT & 4)) -ne 0 && log_write $OF " TAINT: (S) SMP with CPUs not designed for SMP"
test $((TAINT & 8)) -ne 0 && log_write $OF " TAINT: (R) Module was forcibly unloaded"
test $((TAINT & 16)) -ne 0 && log_write $OF " TAINT: (M) Machine check exception"
test $((TAINT & 32)) -ne 0 && log_write $OF " TAINT: (B) System has hit bad_page"
test $((TAINT & 64)) -ne 0 && log_write $OF " TAINT: (U) Userspace-defined problems"
test $((TAINT & 128)) -ne 0 && log_write $OF " TAINT: (D) Kernel has oopsed before"
test $((TAINT & 256)) -ne 0 && log_write $OF " TAINT: (A) ACPI table overridden"
test $((TAINT & 512)) -ne 0 && log_write $OF " TAINT: (W) Taint on warning"
test $((TAINT & 1024)) -ne 0 && log_write $OF " TAINT: (C) Modules from drivers/staging are loaded"
test $((TAINT & 2048)) -ne 0 && log_write $OF " TAINT: (I) Working around severe firmware bug"
test $((TAINT & 4096)) -ne 0 && log_write $OF " TAINT: (O) Out-of-tree module has been loaded"
test $((TAINT & 8192)) -ne 0 && log_write $OF " TAINT: (E) Unsigned module has been loaded"
test $((TAINT & 16384)) -ne 0 && log_write $OF " TAINT: (L) A soft lockup has previously occurred"
test $((TAINT & 32768)) -ne 0 && log_write $OF " TAINT: (K) Kernel has been live patched"
case $SLES_VER in
150|151)
test $((TAINT & 65536)) -ne 0 && log_write $OF " TAINT: (H) System restored from unsafe hibernate snapshot image"
test $((TAINT & 1073741824)) -ne 0 && log_write $OF " TAINT: (N) Unsupported modules loaded"
test $((TAINT & 2147483648)) -ne 0 && log_write $OF " TAINT: (X) Modules with external support loaded"
;;
15*|999)
test $((TAINT & 65536)) -ne 0 && log_write $OF " TAINT: (X) Modules with external support loaded"
test $((TAINT & 131072)) -ne 0 && log_write $OF " TAINT: (T) Kernel built with randstruct plugin"
test $((TAINT & 262144)) -ne 0 && log_write $OF " TAINT: (H) System restored from unsafe hibernate snapshot image"
test $((TAINT & 2147483648)) -ne 0 && log_write $OF " TAINT: (N) Unsupported modules loaded"
;;
esac
log_write $OF
LIST_MODULES_ANY=0
for MODULE in $(cat /proc/modules | awk '{print $1}')
do
LIST_MODULE=0
modinfo -l $MODULE &>/dev/null
MOD_ERR=$?
if (( MOD_ERR )); then
log_write $OF "$(printf "%-25s %-25s %-25s" module=$MODULE ERROR "Module info unavailable")"
else
wait_trace_on "modinfo -l $MODULE"
LIC=$(modinfo -l $MODULE | head -1)
SUP=$(modinfo -F supported $MODULE | head -1)
[[ -z $LIC ]] && LIC=None
[[ -z $SUP ]] && SUP=no
GPLTEST=$(echo $LIC | grep GPL)
[[ -z $GPLTEST ]] && ((LIST_MODULE++))
[[ "$SUP" != "yes" ]] && ((LIST_MODULE++))
(( LIST_MODULE > 0 )) && log_write $OF "$(printf "%-25s %-25s %-25s" "module=$MODULE" "license=$LIC" "supported=$SUP")"
LIST_MODULES_ANY=$((LIST_MODULES_ANY + LIST_MODULE))
wait_trace_off
fi
done
if [[ $LIST_MODULES_ANY -eq 0 ]]; then
log_write $OF "Module List Unknown"
log_write $OF
fi
log_cmd $OF "dmesg -T | grep taint"
else
log_write $OF "Kernel Status -- Not Tainted"
fi
log_write $OF
PSPTMP=$(mktemp $LOG/psout.XXXXXXXX)
AARPTMP=$(mktemp $LOG/security-aareject.XXXXXXXX)
PSTMP=$(basename $PSPTMP)
AARTMP=$(basename $AARPTMP)
log_cmd $PSTMP 'ps axwwo user,pid,ppid,%cpu,%mem,vsz,rss,stat,time,cmd'
log_write $OF "#==[ Checking Health of Processes ]=================#"
log_write $OF "# egrep \" D| Z\" $PSPTMP"
log_write $OF "$(grep -v ^# "$PSPTMP" | egrep " D| Z")"
TOPTMP=$(mktemp $LOG/top.XXXXXXXX)
log_write $OF
log_write $OF "#==[ Summary ]======================================#"
log_write $OF "# Top 10 CPU Processes"
ps axwwo %cpu,pid,user,cmd | sort -k 1 -r -n | head -11 | sed -e '/^%/d' > $TOPTMP
log_write $OF "%CPU PID USER CMD"
log_write $OF "$(< $TOPTMP)"
log_write $OF
log_write $OF "#==[ Summary ]======================================#"
log_write $OF "# Top 10 Memory Processes"
ps axwwo %mem,pid,user,cmd | sort -k 1 -r -n | head -11 | sed -e '/^%/d' > $TOPTMP
log_write $OF "%MEM PID USER CMD"
log_write $OF "$(< $TOPTMP)"
log_write $OF
rm -f $TOPTMP
if rpm -q subdomain-parser &>/dev/null; then
# apparmor for SLES9
log_write $AARTMP "#==[ Summary ]======================================#"
log_write $AARTMP "# AppArmor REJECT Messages"
log_write $AARTMP "$(chkconfig boot.subdomain)"
AAREJECT=$(grep 'SubDomain: REJECTING' /var/log/messages | wc -l)
test -z "$AAREJECT" && AAREJECT=0
if lsmod | grep subdomain &>/dev/null; then
AALOADED="Loaded"
else
AALOADED="Not Loaded"
fi
log_write $AARTMP
log_write $AARTMP "${AAREJECT} Reject Messages, AppArmor Module: $AALOADED"
log_write $AARTMP
elif rpm -q apparmor-parser &>/dev/null; then
# apparmor for SLE10/11
log_write $AARTMP "#==[ Summary ]======================================#"
log_write $AARTMP "# AppArmor REJECT Messages"
if (( SLES_VER >= 120 )); then
log_write $AARTMP "$(systemctl status apparmor.service)"
else
log_write $AARTMP "$(chkconfig -l boot.apparmor)"
log_write $AARTMP "$(/etc/init.d/boot.apparmor status)"
fi
APP_AUDIT_LOG="/var/log/audit/audit.log"
test -f $APP_AUDIT_LOG && AAREJECT=$(egrep 'REJECTING|DENIED' $APP_AUDIT_LOG | wc -l) || AAREJECT=0
test -z "$AAREJECT" && AAREJECT=0
if [[ -x /usr/sbin/apparmor_status ]]; then
/usr/sbin/apparmor_status --enabled &>/dev/null
AASTAT=$?
case $AASTAT in
0) AALOADED="Loaded" ;;
1) AALOADED="Disabled" ;;
*) AALOADED="Loaded/Errors" ;;
esac
else
AALOADED="Unknown"
fi
log_write $AARTMP
log_write $AARTMP "${AAREJECT} Reject Messages, AppArmor Module: $AALOADED"
log_write $AARTMP
fi
test -f $AARPTMP && cat $AARPTMP >> $LOG/$OF
MCE_LOG='/var/log/mcelog'
FILES=$MCE_LOG
if [[ -s $MCE_LOG ]]; then
log_cmd $OF "ls -l --time-style=long-iso $MCE_LOG"
test $ADD_OPTION_LOGS -gt 0 && log_files $OF 0 $FILES || log_files $OF $VAR_OPTION_LINE_COUNT $FILES
fi
cat $PSPTMP >> $LOG/$OF
rm $PSPTMP
echolog Done
}
rpm_info() {
# This is a minimum required function, do not exclude
printlog "RPM Database..."
test $MIN_OPTION_RPM -eq 0 && { echolog EXCLUDED; return 1; }
addHeaderFile $RPMFILE
if ((NSA_CHECK)); then
log_write $RPMFILE "#==[ NSA Check ]====================================#"
log_write $RPMFILE '# rpm -qa --queryformat "%-35{NAME} %-35{DISTRIBUTION} %{VERSION}-%{RELEASE}\n"'
rpm -qa --queryformat "%-35{NAME} %-35{DISTRIBUTION} %{VERSION}-%{RELEASE}\n" >> $LOGFILE 2>&1
else
# rpm list of all files
LOGFILE=$LOG/$RPM_DIST_FILE
log_cmd $RPM_DIST_FILE 'rpm -qa --queryformat "%{DISTRIBUTION}\n" | sort | uniq'
rpm -qa 2>/dev/null | sort > $LOG/$RPM_QA_FILE
cat $LOG/$RPM_DIST_FILE >> $LOG/$RPMFILE
log_cmd $RPMFILE "ls -l --time-style=long-iso /usr/local/bin /usr/local/sbin"
log_write $RPMFILE "#==[ Command ]======================================#"
log_write $RPMFILE '# rpm -qa --queryformat "%-35{NAME} %-35{DISTRIBUTION} %{VERSION}-%{RELEASE}\n" | sort -k 1,2 -t " " -i'
printf "%-35s %-35s %s\n" NAME DISTRIBUTION VERSION >> $LOGFILE
rpm -qa --queryformat "%-35{NAME} %-35{DISTRIBUTION} %{VERSION}-%{RELEASE}\n" | sort -k 1,2 -t " " -i >> $LOGFILE 2>&1
log_write $RPMFILE
log_cmd $RPMFILE "rpm -qa --last"
log_write $RPMFILE "#==[ Command ]======================================#"
log_write $RPMFILE '# rpm -qa --queryformat "%{SIGPGP:pgpsig} %-35{VENDOR} %{NAME}-%{VERSION}-%{RELEASE}\n" | sort -k 11 -t " " -i'
printf "%-63s %-35s %s\n" SIGNATURE VENDOR PACKAGE >> $LOGFILE
rpm -qa --queryformat "%{SIGPGP:pgpsig} %-35{VENDOR} %{NAME}-%{VERSION}-%{RELEASE}\n" | sort -k 11 -t " " -i >> $LOGFILE 2>&1
log_write $RPMFILE
# Jul 12, 2018 ; Added by Ahmad AL Zayed to get a list of RPM DB Backups
RETURN=$(grep RPMDB_BACKUP_DIR /etc/sysconfig/backup 2>/dev/null | grep -v "^#" | cut -d= -f2 | tr -d "\"")
[[ -d $RETURN ]] && { log_cmd $RPMFILE "ls -ltr $RETURN" ;}
fi
echolog Done
}
# Run basic_healthcheck first TAINT & TAINT_STRING must be defined first
module_info() {
printlog "System Modules..."
test $OPTION_MOD -eq 0 && { echolog Excluded; return 1; }
OF=modules.txt
LOGFILE=$LOG/$OF
addHeaderFile $OF
log_cmd $OF 'lsmod | sort'
for MODULE in $(cat /proc/modules | awk '{print $1}')
do
log_cmd $OF "modinfo $MODULE"
MODPARM="/sys/module/$MODULE/parameters/"
if [ -d $MODPARM ]; then
log_write $OF "# Known Module Parameter Values"
for i in $(ls -1 $MODPARM)
do
MODVALUE=$(cat ${MODPARM}$i 2>/dev/null)
[ $? -ne 0 ] && MODVALUE="?"
log_write $OF "${MODPARM}$i=$MODVALUE"
done
log_write $OF
fi
MODOPT=$(grep -R "options ${MODULE} " /etc/modprobe\.?* | grep -v ":# option")
[ -n "$MODOPT" ] && { log_write $OF "# Module Configuration"; log_write $OF "$MODOPT"; log_write $OF; }
done
conf_files $OF /lib/modules/$(uname -r)/modules.dep
if (( SLES_VER >= 120 )); then
conf_files $OF /etc/modprobe.d/*
else
[[ -s /etc/modprobe.conf ]] && LIST=$(grep ^include /etc/modprobe.conf | awk '{print $2}') || LIST=''
FILES=""
for FILE in $LIST
do
if [ -d $FILE ]; then
FILES="$FILES $(find $FILE -type f)"
else
FILES="$FILES $FILE"
fi
done
conf_files $OF /etc/modprobe.conf $FILES
fi
echolog Done
}
messages_file() {
# This is a minimum required function, do not exclude
printlog "System Logs..."
test $MIN_OPTION_SYSLOGS -eq 0 && { echolog EXCLUDED; return 1; }
OF=messages.txt
addHeaderFile $OF
if [[ $ADD_OPTION_LOGS -gt 0 ]]; then
FILES="$(ls -1 /var/log/messages-[[:digit:]]* 2>/dev/null)"
[[ -n "$FILES" ]] && log_entry $OF note "Additional Rotated Logs Included in the Tar Ball"
log_files $OF 0 /var/log/messages
for CMPLOG in $FILES
do
FILE=$(basename $CMPLOG)
FILEROOT=${LOG}/$(cut -d\. -f1 <<< ${FILE})
cp $CMPLOG ${LOG}
FILE_TYPE=$(file --brief --mime-type $CMPLOG 2>/dev/null)
case $FILE_TYPE in
"text/plain")
;;
"application/x-xz")
wait_trace_on "xz -d ${LOG}/$FILE"
xz -d ${LOG}/$FILE
;;
"application/x-bzip2")
wait_trace_on "bzip2 -d ${LOG}/$FILE"
bzip2 -d ${LOG}/$FILE
;;
"application/x-gzip")
wait_trace_on "gzip -d ${LOG}/$FILE"
gzip -d ${LOG}/$FILE
;;
*)
continue
;;
esac
mv ${FILEROOT} ${FILEROOT}.txt
wait_trace_off
done
else
LOGFILE="/var/log/messages"
if [[ -e $LOGFILE ]]; then
if [[ $VAR_OPTION_MSG_MAXSIZE -eq 0 ]]; then
log_files $OF 0 $LOGFILE # override and get the entire file
else
MSGSIZE=$(stat -c%s $LOGFILE)
if [[ $MSGSIZE -gt $VAR_OPTION_MSG_MAXSIZE ]]; then
log_files $OF $VAR_OPTION_MSG_LINE_COUNT $LOGFILE # the file exceeded the max size allowed, get specified lines of the file
else
log_files $OF 0 $LOGFILE # get the whole file
fi
fi
else
log_cmd $OF "journalctl --no-pager --lines $VAR_OPTION_MSG_LINE_COUNT"
fi
fi
echolog Done
}
localwarn_file() {
printlog "Local/Warn Logs..."
test $MIN_OPTION_SYSLOGS -eq 0 && { echolog EXCLUDED; return 1; }
OF=messages_localwarn.txt
addHeaderFile $OF
if [[ $ADD_OPTION_LOGS -gt 0 ]]; then
FILES="$(ls -1 /var/log/warn-[[:digit:]]* 2>/dev/null) $(ls -1 /var/log/localmessages-[[:digit:]]* 2>/dev/null)"
[[ -n "$FILES" ]] && log_entry $OF note "Additional Rotated Logs Included in the Tar Ball"
log_files $OF 0 /var/log/warn /var/log/localmessages
for CMPLOG in $FILES
do
FILE=$(basename $CMPLOG)
FILEROOT=${LOG}/$(cut -d\. -f1 <<< ${FILE})
cp $CMPLOG ${LOG}
FILE_TYPE=$(file --brief --mime-type $CMPLOG 2>/dev/null)
case $FILE_TYPE in
"text/plain")
;;
"application/x-xz")
wait_trace_on "xz -d ${LOG}/$FILE"
xz -d ${LOG}/$FILE
;;
"application/x-bzip2")
wait_trace_on "bzip2 -d ${LOG}/$FILE"
bzip2 -d ${LOG}/$FILE
;;
"application/x-gzip")
wait_trace_on "gzip -d ${LOG}/$FILE"
gzip -d ${LOG}/$FILE
;;
*)
continue
;;
esac
mv ${FILEROOT} ${FILEROOT}.txt
wait_trace_off
done
else
log_files $OF $VAR_OPTION_LINE_COUNT /var/log/warn
LOGFILE="/var/log/localmessages"
if [[ -e $LOGFILE ]]; then
if [[ $VAR_OPTION_MSG_MAXSIZE -eq 0 ]]; then
log_files $OF 0 $LOGFILE # override and get the entire file
else
MSGSIZE=$(stat -c%s $LOGFILE)
if [[ $MSGSIZE -gt $VAR_OPTION_MSG_MAXSIZE ]]; then
log_files $OF $VAR_OPTION_MSG_LINE_COUNT $LOGFILE # the file exceeded the max size allowed, get specified lines of the file
else
log_files $OF 0 $LOGFILE # get the whole file
fi
fi
fi
fi
echolog Done
}
audit_info() {
printlog "Auditing..."
test $OPTION_AUDIT -eq 0 && { echolog Excluded; return 1; }
OF=security-audit.txt
if [ $SLES_VER -gt 90 ]; then
if rpm_verify $OF audit; then
addHeaderFile $OF
check_service $OF auditd
log_cmd $OF 'auditctl -s'
log_cmd $OF 'auditctl -l'
log_cmd $OF 'aureport'
if [ -d /etc/audit ]; then
FILES=$(find -L /etc/audit/ -type f)
if [ -d /etc/audispd ]; then
FILES="$FILES $(find -L /etc/audispd/ -type f)"
fi
else
FILES="/etc/auditd.conf /etc/audit.rules"
fi
conf_files $OF $FILES
FILES=$(find /var/log/audit/ -type f | egrep -v "/ltaudit/" | grep log$)
test $ADD_OPTION_LOGS -gt 0 && log_files $OF 0 $FILES || log_files $OF $VAR_OPTION_LINE_COUNT $FILES
echolog Done
else
echolog Skipped
fi
else
if rpm_verify $OF laus; then
addHeaderFile $OF
check_service $OF audit
FILES=$(find -L /etc/audit/ -type f)
conf_files $OF $FILES
log_cmd $OF 'aucat -v'
echolog Done
else
echolog Skipped
fi
fi
}
yast_files() {
# This is a minimum required function, do not exclude
printlog "YaST Files..."
test $MIN_OPTION_YAST -eq 0 && { echolog EXCLUDED; return 1; }
hppsp_info
# YaST files
OF=y2log.txt
addHeaderFile $OF
rpm_verify $OF yast2-packager
rpm_verify $OF yast2-packagemanager
if rpm -q perl-Bootloader &> /dev/null; then
rpm_verify $OF perl-Bootloader
fi
test -d /var/log/YaST2 && FILES=$(find /var/log/YaST2/ -type f | egrep -v "_dev_|\.tbz$|\.tgz$|\.gz$|\.bz2$|\.zip$") || unset FILES
conf_files $OF /etc/youservers /etc/sysconfig/onlineupdate /etc/wgetrc
log_files $OF 0 /var/log/pbl.log
(( ADD_OPTION_MAXYAST > 0 )) && log_files $OF 0 $FILES || log_files $OF $VAR_OPTION_LINE_COUNT $FILES
[[ -s /root/autoupg.xml ]] && FILES="/root/autoupg*xml" || FILES=''
conf_files $OF /root/autoinst.xml $FILES /var/adm/autoinstall/cache/installedSystem.xml
sed -i -e 's!<user_password>.*</user_password>!<user_password>*REMOVED BY SUPPORTCONFIG*</user_password>!g' $LOG/$OF
echolog Done
}
boot_info() {
printlog "Boot Files..."
test $OPTION_BOOT -eq 0 && { echolog Excluded; return 1; }
OF=boot.txt
addHeaderFile $OF
log_cmd $OF "uname -a"
KERNELS=$(cat $LOG/$RPMFILE | grep '^kernel-' | grep -v 'kernel-source' | awk '{print $1}')
for KERNEL in $KERNELS
do
rpm_verify $OF $KERNEL
done
if rpm -q grub &> /dev/null; then
rpm_verify $OF grub
conf_files $OF /etc/grub.conf /boot/grub/menu.lst /boot/grub/device.map
timed_log_cmd $OF 'hwinfo --framebuffer'
fi
if rpm -q grub2 &> /dev/null; then
rpm_verify $OF grub2
conf_files $OF /etc/default/grub /etc/default/grub_installdevice /boot/grub2/device.map
BKOP=$ADD_OPTION_LOGS
ADD_OPTION_LOGS=1 conf_files $OF /boot/grub2/grub.cfg
ADD_OPTION_LOGS=$BKOP
fi
if rpm -q lilo &> /dev/null; then
rpm_verify $OF lilo
conf_files $OF /etc/lilo.conf /etc/yaboot.conf
fi
if rpm -q elilo &> /dev/null; then
rpm_verify $OF elilo
ELILOFILE=$(rpm -ql elilo | grep elilo.efi)
ELILODIR=$(dirname $ELILOFILE)
log_cmd $OF "ls -l --time-style=long-iso $ELILODIR"
FILES="$(find /boot/ -type f 2>/dev/null | grep elilo.[conf,cfg]) $(find -L /etc/ -type f 2>/dev/null | grep elilo.[conf,cfg])"
conf_files $OF $FILES
log_cmd $OF "cksum $(ls -1 $ELILOFILE) $(find /boot/ -type f -name 'elilo.efi' 2>/dev/null)"
fi
if [[ -x /usr/sbin/bootlist ]]; then
log_cmd $OF 'bootlist -m normal -o'
log_cmd $OF 'bootlist -m normal -r'
fi
if rpm -q efibootmgr &> /dev/null; then
log_cmd $OF "efibootmgr -v"
fi
if rpm -q s390-tools &> /dev/null; then
conf_files $OF /etc/zipl.conf /boot/zipl/active_devices.txt /boot/zipl/config
fi
test -e /usr/sbin/mcelog && log_cmd $OF "/usr/sbin/mcelog --ignorenodev --filter --dmi"
test -s /var/log/mcelog && { log_cmd $OF "ls -l --time-style=long-iso /var/log/mcelog"; conf_files $OF /var/log/mcelog; }
log_cmd $OF 'last -xF | egrep "reboot|shutdown|runlevel|system"'
(( SLES_VER >= 120 )) && FILES='/var/log/boot.log' || FILES='/etc/inittab'
conf_files $OF /proc/cmdline /etc/sysconfig/kernel $FILES /etc/init.d/boot.local /etc/init.d/before.local /etc/init.d/after.local /etc/init.d/halt.local
log_cmd $OF 'ls -lR --time-style=long-iso /boot/'
if (( $SLES_VER > 90 )); then
for i in $(find /boot/ -maxdepth 1 -type f -name \*initrd\* 2>/dev/null)
do
if file $i | grep -i "gzip compressed" &>/dev/null; then
log_cmd $OF "zcat $i | cpio -itv 2>/dev/null"
elif file $i | grep -i "xz compressed" &>/dev/null; then
log_cmd $OF "xzcat $i | cpio -itv 2>/dev/null"
fi
done
fi
(( SLES_VER >= 120 )) && log_cmd $OF "lsinitrd -k $(uname -r)"
if (( SLES_VER >= 120 )); then
test $ADD_OPTION_LOGS -gt 0 && log_files $OF 0 $FILES || log_files $OF $VAR_OPTION_LINE_COUNT $FILES
log_cmd $OF 'journalctl --no-pager --disk-usage'
if (( $ADD_OPTION_LOGS > 0 )); then
log_cmd $OF 'journalctl --no-pager --list-boot'
LIST_BOOTS=$(journalctl --no-pager --list-boot | wc -l)
((LIST_BOOTS--))
if (( LIST_BOOTS > 0 )); then
BOOT_COUNT=1
if (( VAR_OPTION_JOURNALCTL_MAX_BOOTS > 0 )); then
JOURNALCTL_MAX_BOOTS=$VAR_OPTION_JOURNALCTL_MAX_BOOTS
else
#VAR_OPTION_JOURNALCTL_MAX_BOOTS of 0 means get all boots
JOURNALCTL_MAX_BOOTS=$LIST_BOOTS
fi
for THIS_BOOT in $(seq 0 $LIST_BOOTS)
do
log_cmd $OF "journalctl --no-pager --boot $THIS_BOOT"
((BOOT_COUNT < JOURNALCTL_MAX_BOOTS)) && ((BOOT_COUNT++)) || break
done
else
log_cmd $OF "journalctl --no-pager --boot 0"
fi
else
if (( VAR_OPTION_JOURNALCTL_LINE_COUNT > 0 )); then
log_cmd $OF "journalctl --no-pager --boot 0 | tail -n ${VAR_OPTION_JOURNALCTL_LINE_COUNT}"
else
log_cmd $OF "journalctl --no-pager --boot 0"
fi
fi
else
conf_files $OF /var/log/boot.msg /var/log/boot.omsg
fi
log_cmd $OF 'dmesg -T'
echolog Done
}
smt_info() {
printlog "SMT..."
test $OPTION_SMT -eq 0 && { echolog Excluded; return 1; }
OF=smt.txt
addHeaderFile $OF
if rpm_verify $OF smt; then
check_service $OF smt
CONF=/etc/smt.conf
conf_files $OF /etc/smt.conf
sed -i -e 's/^NUPass[[:space:]]*=.*/NUPass=*REMOVED BY SUPPORTCONFIG*/;s/^pass[[:space:]]*=.*/pass=*REMOVED BY SUPPORTCONFIG*/;s/^ProxyUser[[:space:]]*=.*/ProxyUser=*REMOVED BY SUPPORTCONFIG*/;s/^mailServerPassword[[:space:]]*=.*/mailServerPassword=*REMOVED BY SUPPORTCONFIG*/;s/^credentials[[:space:]]*=.*/credentials=*REMOVED BY SUPPORTCONFIG*/' $LOG/$OF
FILES=$(find -L /etc/smt.d/ -type f 2>/dev/null)
conf_files $OF $FILES
log_cmd $OF 'smt-catalogs'
log_cmd $OF 'smt-catalogs -o'
log_cmd $OF 'smt-list-registrations'
log_cmd $OF 'smt-list-products'
if [ -d /srv/www/htdocs/repo ]; then
log_cmd $OF 'find /srv/www/htdocs/repo -print0 | sort -z | xargs -0 ls -ld --time-style=long-iso'
fi
FILES=$(find /var/log/ -type f | grep smt- | grep log$)
test $ADD_OPTION_LOGS -gt 0 && log_files $OF 0 $FILES || log_files $OF $VAR_OPTION_LINE_COUNT $FILES
echolog Done
else
echolog Skipped
fi
}
update_info() {
printlog "Updates..."
test $OPTION_UP -eq 0 && { echolog Excluded; return 1; }
OF=updates.txt
SKIP=0
TIMEOUT=0
addHeaderFile $OF
if (( SLES_VER >= 110 )) && rpm_verify $OF zypper; then
log_cmd $OF 'date'
log_cmd $OF 'ls -lA --time-style=long-iso /etc/products.d/'
log_cmd $OF 'zypper locks'
log_cmd $OF 'zypper patterns --installed-only'
for CMDOPT in services 'repos -d' patch-check patches list-patches list-updates products '--xmlout products' 'packages --orphaned'
do
if [ $TIMEOUT -ge 10 ]; then
log_write $OF "#==[ Command ]======================================#"
log_write $OF "# Skipped \"zypper $CMDOPT\" due to previous timeout"
log_write $OF
else
timed_log_cmd $OF "zypper --non-interactive --no-gpg-checks $CMDOPT"
TIMEOUT=$?
fi
done
rpm_verify $OF lsb
conf_files $OF /etc/zypp/zypp.conf /etc/zypp/credentials.d/NCCcredentials
fi
if (( SLES_VER >= 120 ))
then
if rpm_verify $OF SUSEConnect
then
rpm_verify $OF ruby2.1-rubygem-suse-connect
log_cmd $OF "SUSEConnect --status"
FILES=$(find -L /etc/zypp/credentials.d/ -type f 2>/dev/null)
conf_files $OF /etc/SUSEConnect $FILES
fi
fi
if rpm -q libzypp &> /dev/null; then
QPBIN=$(rpm -ql libzypp | grep query-pool)
test -n "$QPBIN" && timed_log_cmd $OF "$QPBIN products" || ((SKIP++))
elif rpm -q libzypp-zmd-backend &> /dev/null; then
QPBIN=$(rpm -ql libzypp-zmd-backend | grep query-pool)
test -n "$QPBIN" && timed_log_cmd $OF "$QPBIN products" || ((SKIP++))
fi
if rpm -q zypper &> /dev/null; then
log_cmd $OF 'installation_sources -s'
fi
if rpm_verify $OF suseRegister; then
FILES='/etc/suseRegister.conf /etc/sysconfig/suse_register'
conf_files $OF $FILES
if [[ -d /var/lib/suseRegister/ ]]; then
FILES=$(find /var/lib/suseRegister/ -type f)
conf_files $OF $FILES
fi
fi
log_cmd $OF "env | grep -i proxy | grep -v CMDLINE"
conf_files $OF /etc/sysconfig/proxy
if [[ -s /root/.curlrc ]]; then
conf_files $OF /root/.curlrc
SC_PROXY_PASS=$(grep -i "^proxy-user" /root/.curlrc | sed -e 's/"//g' | awk '{print $3}' | cut -d\: -f2)
sed -i -e "s/:${SC_PROXY_PASS}$/:*REMOVED BY SUPPORTCONFIG*/g;s/:${SC_PROXY_PASS}\"$/:*REMOVED BY SUPPORTCONFIG*\"/g" $LOG/$OF
fi
if rpm -q curl &>/dev/null; then
# Test update server
UPDATE_TEST_URL=''
if [[ -s /etc/sysconfig/rhn/up2date ]]; then # get SUMA update URL
UPDATE_TEST_URL=$( cat /etc/sysconfig/rhn/up2date | grep -i "^serverURL=" | cut -d= -f2)
elif [[ -s /etc/SUSEConnect ]]; then # get SLE12 update URL
UPDATE_TEST_URL=$( cat /etc/SUSEConnect | grep -i "^url: " | awk '{print $2}')
elif [[ -s /etc/suseRegister.conf ]]; then # get SLE11 update URL
UPDATE_TEST_URL=$( cat /etc/suseRegister.conf | grep -i "^url=" | cut -d= -f2)
fi
if [[ -n $UPDATE_TEST_URL ]]; then # a local update server URL was found
if echo $UPDATE_TEST_URL | egrep -i "^http.*//" &>/dev/null; then
LOCAL_TEST_PROTOCOL=$(echo $UPDATE_TEST_URL | awk -F/ '{print $1}')
LOCAL_TEST_HOST=$(echo $UPDATE_TEST_URL | awk -F/ '{print $3}')
else
LOCAL_TEST_PROTOCOL=''
LOCAL_TEST_HOST=$(echo $UPDATE_TEST_URL | awk -F/ '{print $1}')
fi
if [[ -n LOCAL_TEST_PROTOCOL ]]; then
LOCAL_TEST_URL="${LOCAL_TEST_PROTOCOL}//${LOCAL_TEST_HOST}/"
else
LOCAL_TEST_URL="${UPDATE_TEST_HOST}"
fi
log_cmd $OF "curl --connect-timeout 10 --trace-ascii ${LOG}/updates-curl-trace_${LOCAL_TEST_HOST}.txt --digest --remote-time --fail ${LOCAL_TEST_URL}"
else # no local update server URL found
if (( ADD_OPTION_LOCAL_ONLY )); then
log_entry $OF note "curl -- aborted: ADD_OPTION_LOCAL_ONLY set, no local update URLs found"
else
for SUSE_TEST_URL in 'https://updates.suse.com/' 'https://scc.suse.com/'
do
SUSE_TEST_HOST=$(echo $SUSE_TEST_URL | awk -F/ '{print $3}')
log_cmd $OF "curl --connect-timeout 10 --trace-ascii ${LOG}/updates-curl-trace_${SUSE_TEST_HOST}.txt --digest --remote-time --fail $SUSE_TEST_URL"
done
fi
fi
else
log_entry $OF note "curl -- not installed, aborted"
fi
#zypper
FILES=$(find /var/log/ -type f -name \*zypp\*)
(( ADD_OPTION_LOGS > 0 )) && log_files $OF 0 $FILES || log_files $OF $VAR_OPTION_LINE_COUNT $FILES
#suseregister
log_files $OF 0 '/root/.suse_register.log'
FILES="/var/log/messages"
(( ADD_OPTION_LOGS > 0 )) && grep_log_files suse_register $OF 0 $FILES || grep_log_files suse_register $OF $VAR_OPTION_LINE_COUNT $FILES
if (( SLES_VER >= 120 ))
then
conf_files $OF '/proc/kgr_in_progress'
log_entry $OF note "Processes blocking kGraft patching"
FOUND=0
for i in $(find /proc -type f 2> /dev/null | grep -i kgr_in_progress)
do
VAL=$(cat $i 2>/dev/null)
if [[ -n "$VAL" ]]
then
PPATH=$(dirname $i)
if (( VAL > 0 ))
then
COMM=$(cat ${PPATH}/comm 2>/dev/null)
KPID=$(basename ${PPATH})
log_write $OF "$KPID: $COMM"
FOUND=1
fi
fi
done
(( FOUND )) && log_write $OF
fi
echolog Done
}
pam_info() {
printlog "PAM..."
OF=pam.txt
addHeaderFile $OF
if (( $FORCE_OPTION_PAM > 0 )); then
rpm_verify $OF pam
rpm_verify $OF pam-modules
conf_files $OF /etc/nsswitch.conf /etc/nologin
conf_files $OF /etc/passwd
log_cmd $OF 'getent passwd'
conf_files $OF /etc/group
log_cmd $OF 'getent group'
conf_files $OF /etc/sudoers
(( SLES_VER >= 120 )) && log_cmd $OF 'loginctl --no-pager list-sessions'
log_write $OF "#==[ Files in /etc/security ]=======================#"
test -d /etc/security && FILES="$(find -L /etc/security/ -type f -name \*conf)" || FILES=""
conf_files $OF $FILES
log_write $OF "#==[ Files in /etc/pam.d ]==========================#"
test -d /etc/pam.d && FILES="$(find -L /etc/pam.d/ -type f)" || FILES=""
conf_files $OF $FILES
echolog Done
else
log_entry $OF note "Restricted"
echo "PAM module is disabled in compliance with General Data Protection Regulation (GDPR)." >> $LOG/$OF
echo "To consent to supportconfig collecting this information, run:" >> $LOG/$OF
echo "# FORCE_OPTION_PAM=1 supportconfig" >> $LOG/$OF
echo >> $LOG/$OF
echo 'Additional info: https://www.suse.com/support/kb/doc/?id=000019695' >> $LOG/$OF
echo >> $LOG/$OF
echolog Restricted
fi
}