forked from kristovatlas/osx-config-check
-
Notifications
You must be signed in to change notification settings - Fork 0
/
osx-config.hjson
2759 lines (2745 loc) · 115 KB
/
osx-config.hjson
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
/*
Hjson is the Human JSON format.
Learn about the specification at: http://hjson.org/
This must be converted to JSON (e.g. using the `hjson_to_json.py` tool included).
*/
/* syntax:
[
{
`description` is a human-readable string describing the configuration being checked; it should be a present-tense statement about a positive security configuration. (REQUIRED FIELD)
`confidence` indicates subjective estimation of negative side-effects. valid values: "required", "recommended", "experimental". (REQUIRED FIELD)
`reference` provides a link to where a user can find more information about this configuration, or a citation of where this configuration was taken from. (OPTIONAL FIELD)
`tests`: // is an ordered array of test objects. (REQUIRED FIELD, should not be empty)
[
{
`type` is "exact match" or "regex match". (REQUIRED FIELD)
`command` is the command you want to verify the output of (REQUIRED FIELD)
`command_pass` is the value that `command`'s output should match. If it matches, all tests pass and subsequent tests for this config are not evaluated. (OPTIONAL FIELD)
`command_fail` is the value that `command`'s output should NOT match. If it matches, all tests fail and subsequent tests for this config are not evaluated. (OPTIONAL FIELD)
`case_sensitive` is "true" or "false" depending on whether the `command_pass` and/or `command_fail` values are case-sensitive. (REQUIRED FIELD)
}
]
`fix`: // is a JSON object that specifies how to remediate a broken configuration (REQUIRED FIELD, should not be empty)
{
`command` is the command that you use to attempt automatic remediation without sudo privileges. (OPTIONAL FIELD)
`sudo_command` is the command using sudo privileges that attempts automatic remediation if `command` fails. (OPTIONAL FIELD)
`manual` is the field that provides manual instructions to be printed to the user at the end of script execution if all automatic fixes fail. (OPTIONAL FIELD)
}
}
]
*/
/* NOTES:
* back-slashes '\' must be escaped with a double black-slash, i.e. '\\'
*/
[
/* --- BEGIN HOMEBREW SETTINGS --- */
{
//Install Homebrew as a useful tool for semi-securely install or updating other tools
description: "Homebrew is installed."
confidence: "required"
tests:
[
{
type: "exact match"
command:
echo $(homebrew_is_installed)
command_pass: "1"
command_fail: "0"
case_sensitive: "false"
}
]
fix:
{
//This homebrew script requries sudo privs and so the user of this tool should be alerted as to why she is being prompted for a password
sudo_command: "/usr/bin/ruby ./scripts/homebrew_install_ed33f044812cc9c509a4d8e6997c44441b06dd4e1fc87f131ee9f319d77fcd50.rb"
manual:
'''
Homebrew is a useful tool for installing and updating programs from the command line.
There are various things that can go wrong when attempting to install Homebrew.
Please review their installation guide here:
https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/Installation.md
'''
}
}
{
//Tools installed by Homebrew should be preferred according to the PATH
//environment variable.
"description": "Binaries installed to /usr/local/bin are preferred over those in /usr/bin (Note: If this check does not pass, other tests will fail)"
confidence: "required"
tests:
[
{
type: "exact match"
command: "bash ./scripts/check_usr_local_bin_pos.sh"
command_pass: 1
command_fail: 0
case_sensitive: false
}
]
fix:
{
//Only "fix" this PATH preference if we haven't already applied the
//fix to the ~/.profile file. Otherwise, the user will need to
//restart Terminal in order for this take effect.
command:
python ./scripts/set_path_precedence.py "/usr/local/bin" "/usr/bin"
manual:
'''
1. Bring the Terminal application to the foreground if it is not already. You should see the word "Terminal" in the top left corner of your screen.
2. Select Terminal->Quit
3. Re-open the Terminal application and run the tool again; this check should now pass.
'''
}
}
/* ---- END HOMEBREW SETTINGS ---- */
{
//JRE is a scourge
description: "Java Runtime Environment is up to date."
confidence: recommended
tests:
[
{
//Pass test if `java` is not installed
type: "exact match"
command: java_is_installed
command_pass: 0
case_sensitive: false
}
{
//Past test if the latest version available via `brew cask install java` is installed
type: "exact match"
command: java -version 2>&1 >/dev/null | grep 'java version'
command_pass:
java version "1.8.0_102"
case_sensitive: false
}
]
fix:
{
manual:
'''
1. Your installation of Java is not up to date. You can either update it or remove it.
2. To update Java, see: https://www.java.com/en/download/faq/java_mac.xml
3. To remove Java, see: https://www.java.com/en/download/help/mac_uninstall_java.xml
'''
}
}
/* --- BEGIN SYSTEM SETTINGS --- */
{
//Check if the System Preferences app is closed -- otherwise, it may override changes this app makes.
description: "The System Preferences application is currently closed."
confidence: "required"
reference: "https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man1/defaults.1.html"
tests:
[
{
type: "exact match"
command: "ps ax | grep -c '/Applications/System Preferences.app/Contents/MacOS/System Preferences'"
command_pass: "2" //a value of "3" means it's running -- the other 2 are `/bin/sh` and the `grep` command.
case_sensitive: "false"
}
]
fix:
{
command:
killall "System Preferences" ; sleep 1
}
},
{
description: "Current user is a non-admin account."
confidence: "required"
tests:
[
{
type: "exact match"
command: "id -Gn | grep -c -w admin"
command_pass: "0"
case_sensitive: "false"
}
]
fix:
{
manual:
'''
1. For most of your work, you should be logged into a non-administrator account. If you've already set this up and you're just logged into your admin account in order to run this tool as prescribed, you can ignore this failed test.
2. To create a new, non-admin user for most of your work: Open System Preferences.
3. Select "Users & Groups".
4. If necessary, click the lock icon in the lower left corner and provide your administrator credentials.
5. Click the "+" to create a new user. Make sure the "Allow user to administer this computer" checkbox is un-checked for that user.
6. You may also want to add your non-administrator user to a list of users who can use the "sudo" command within the Terminal application to briefly gain administrator-like credentials for special circumstances. See: http://osxdaily.com/2014/02/06/add-user-sudoers-file-mac/
'''
}
},
{
//System Preferences->Security & Privacy->Firewall->Turn On Firewall
//Note: This seems to get overwritten logging out/in. See following, user-specific version.
description: "The OSX application firewall is enabled (system-wide)."
confidence: "required"
reference: "https://github.com/drduh/OS-X-Security-and-Privacy-Guide"
tests:
[
{
//Exempt users who are using Little Snitch
type: "exact match"
command: little_snitch_is_installed
command_pass: 1
case_sensitive: false
}
{
type: "exact match"
command: "defaults -currentHost read /Library/Preferences/com.apple.alf globalstate"
command_pass: "1"
command_fail: "0"
case_sensitive: "false"
}
]
fix:
{
command: "defaults -currentHost write /Library/Preferences/com.apple.alf globalstate -bool true"
sudo_command: "sudo defaults -currentHost write /Library/Preferences/com.apple.alf globalstate -bool true"
}
},
{
//System Preferences->Security & Privacy->Firewall->Turn On Firewall
description: "The OSX application firewall is enabled (current user only)."
confidence: "required"
reference: "https://github.com/drduh/OS-X-Security-and-Privacy-Guide"
tests:
[
{
//Exempt users who are using Little Snitch
type: "exact match"
command: little_snitch_is_installed
command_pass: 1
case_sensitive: false
}
{
type: "exact match"
command: "defaults -currentHost read ~/Library/Preferences/com.apple.alf globalstate"
command_pass: "1"
command_fail: "0"
case_sensitive: "false"
}
]
fix:
{
command: "defaults -currentHost write ~/Library/Preferences/com.apple.alf globalstate -bool true"
sudo_command: "sudo defaults -currentHost write ~/Library/Preferences/com.apple.alf globalstate -bool true"
}
},
{
description: "A password is required to wake the computer from sleep or screen saver (system-wide)."
confidence: "required"
reference: "https://github.com/SummitRoute/osxlockdown/blob/58697f5162fe9e43df7dc9b6b94ffa34b0e11d4f/commands.yaml"
tests:
[
{
type: "exact match"
command: "defaults read /Library/Preferences/com.apple.screensaver askForPassword"
command_pass: "1"
command_fail: "0"
case_sensitive: "false"
},
{
type: "exact match"
command: "sudo defaults read /Library/Preferences/com.apple.screensaver askForPassword"
command_pass: "1"
command_fail: "0"
case_sensitive: "false"
}
]
fix:
{
command: "defaults write /Library/Preferences/com.apple.screensaver askForPassword -bool true"
sudo_command: "sudo defaults write /Library/Preferences/com.apple.screensaver askForPassword -bool true"
}
},
{
description: "A password is required to wake the computer from sleep or screen saver (current user only)."
confidence: "required"
reference: "https://github.com/SummitRoute/osxlockdown/blob/58697f5162fe9e43df7dc9b6b94ffa34b0e11d4f/commands.yaml"
tests:
[
{
type: "exact match"
command: "defaults read ~/Library/Preferences/com.apple.screensaver askForPassword"
command_pass: "1"
case_sensitive: "false"
}
]
fix:
{
command: "defaults write ~/Library/Preferences/com.apple.screensaver askForPassword -bool true"
}
},
{
//System Preferences->Security & Privacy->General->Require password [time interval]
description: "There is no delay between starting the screen saver and locking the machine (system-wide)."
confidence: "required"
reference: "https://github.com/SummitRoute/osxlockdown/blob/58697f5162fe9e43df7dc9b6b94ffa34b0e11d4f/commands.yaml"
tests:
[
{
type: "exact match"
command: "defaults -currentHost read /Library/Preferences/com.apple.screensaver askForPasswordDelay"
command_pass: "0"
command_fail: "1"
case_sensitive: "false"
},
{
type: "exact match"
command: "sudo defaults -currentHost read /Library/Preferences/com.apple.screensaver askForPasswordDelay"
command_pass: "0"
command_fail: "1"
case_sensitive: "false"
}
]
fix:
{
command: "defaults -currentHost write /Library/Preferences/com.apple.screensaver askForPasswordDelay -bool false"
sudo_command: "sudo defaults -currentHost write /Library/Preferences/com.apple.screensaver askForPasswordDelay -bool false"
}
undo: "defaults -currentHost write /Library/Preferences/com.apple.screensaver askForPasswordDelay -bool true"
},
{
//System Preferences->Security & Privacy->General->Require password [time interval]
description: "There is no delay between starting the screen saver and locking the machine (current user only)."
confidence: "required"
reference: "https://github.com/SummitRoute/osxlockdown/blob/58697f5162fe9e43df7dc9b6b94ffa34b0e11d4f/commands.yaml"
tests:
[
{
type: "exact match"
command: "defaults -currentHost read ~/Library/Preferences/com.apple.screensaver askForPasswordDelay"
command_pass: "0"
command_fail: "1"
case_sensitive: "false"
}
]
fix:
{
command: "defaults -currentHost write ~/Library/Preferences/com.apple.screensaver askForPasswordDelay -bool false"
}
undo: "defaults -currentHost write ~/Library/Preferences/com.apple.screensaver askForPasswordDelay -bool true"
},
{
description: "Logging is enabled for the operating system."
confidence: "required"
reference: "https://github.com/drduh/OS-X-Security-and-Privacy-Guide"
tests:
[
{
type: "exact match"
command: "defaults -currentHost read /Library/Preferences/com.apple.alf loggingenabled"
command_pass: "1"
command_fail: "0"
case_sensitive: "false"
}
]
fix:
{
command: "defaults -currentHost write /Library/Preferences/com.apple.alf loggingenabled -bool true"
sudo_command: "sudo defaults -currentHost write /Library/Preferences/com.apple.alf loggingenabled -bool true"
}
},
{
description: "Homebrew analytics are disabled."
confidence: "required"
reference: "https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/Analytics.md"
tests:
[
{
type: "exact match"
//test based on: https://github.com/Homebrew/brew/blob/master/Library/Homebrew/utils/analytics.sh
command: "[[ -n $HOMEBREW_NO_ANALYTICS ]] && echo 1 || echo 0"
command_pass: "1"
command_fail: "0"
case_sensitive: "false"
}
]
fix:
{
command: "grep -q 'export HOMEBREW_NO_ANALYTICS=1' ~/.profile || echo 'export HOMEBREW_NO_ANALYTICS=1' >> ~/.profile ; source ~/.profile"
manual:
'''
1. Bring the Terminal application to the foreground if it is not already. You should see the word "Terminal" in the top left corner of your screen.
2. Select Terminal->Quit
3. Re-open the Terminal application and run the tool again; this check should now pass.
'''
}
},
{
//System Preferences->Security & Privacy->Firewall->Firewall Options...->Enable Stealth Mode
//Note: This seems to get overwritten logging out/in. See following, user-specific version.
description: "Stealth mode is enabled for OSX: Computer does not respond to ICMP ping requests or connection attempts from a closed TCP/UDP port. (system-wide)"
confidence: "recommended"
reference: "https://github.com/drduh/OS-X-Security-and-Privacy-Guide"
tests:
[
{
type: "exact match"
command: "defaults -currentHost read /Library/Preferences/com.apple.alf stealthenabled"
command_pass: "1"
command_fail: "0"
case_sensitive: "false"
}
]
fix:
{
command: "defaults write /Library/Preferences/com.apple.alf stealthenabled -bool true"
sudo_command: "sudo defaults write /Library/Preferences/com.apple.alf stealthenabled -bool true"
}
undo: "sudo defaults write /Library/Preferences/com.apple.alf stealthenabled -bool false"
},
{
//System Preferences->Security & Privacy->Firewall->Firewall Options...->Enable Stealth Mode
description: "Stealth mode is enabled for OSX: Computer does not respond to ICMP ping requests or connection attempts from a closed TCP/UDP port. (current user only)"
confidence: "recommended"
reference: "https://github.com/drduh/OS-X-Security-and-Privacy-Guide"
tests:
[
{
type: "exact match"
command: "defaults -currentHost read ~/Library/Preferences/com.apple.alf stealthenabled"
command_pass: "1"
command_fail: "0"
case_sensitive: "false"
}
]
fix:
{
command: "defaults write ~/Library/Preferences/com.apple.alf stealthenabled -bool true"
sudo_command: "sudo defaults write /Library/Preferences/com.apple.alf stealthenabled -bool true"
}
undo: "defaults write ~/Library/Preferences/com.apple.alf stealthenabled -bool false"
},
{
//System Preferences->Security & Privacy->Firewall->Firewall Options...->Automatically allow signed software to receive incoming connections
description: "Automatic whitelisting of Apple-signed applications through the firewall is disabled (system-wide)."
confidence: "required"
reference: "https://github.com/drduh/OS-X-Security-and-Privacy-Guide"
tests:
[
{
type: "exact match"
command: "defaults -currentHost read /Library/Preferences/com.apple.alf allowsignedenabled"
command_pass: "0"
command_fail: "1"
case_sensitive: "false"
}
]
fix:
{
command: "defaults -currentHost write /Library/Preferences/com.apple.alf allowsignedenabled -bool false"
sudo_command: "sudo defaults -currentHost write /Library/Preferences/com.apple.alf allowsignedenabled -bool false"
}
undo: "sudo defaults -currentHost write /Library/Preferences/com.apple.alf allowsignedenabled -bool true"
},
{
//System Preferences->Security & Privacy->Firewall->Firewall Options...->Automatically allow signed software to receive incoming connections
description: "Automatic whitelisting of Apple-signed applications through the firewall is disabled (current user only)."
confidence: "required"
reference: "https://github.com/drduh/OS-X-Security-and-Privacy-Guide"
tests:
[
{
type: "exact match"
command: "defaults -currentHost read ~/Library/Preferences/com.apple.alf allowsignedenabled"
command_pass: "0"
command_fail: "1"
case_sensitive: "false"
}
]
fix:
{
command: "defaults -currentHost write ~/Library/Preferences/com.apple.alf allowsignedenabled -bool false"
}
undo: "sudo defaults -currentHost write /Library/Preferences/com.apple.alf allowsignedenabled -bool true"
},
{
description: "Captive portal for connecting to new networks is disabled to prevent MITM attacks."
confidence: "required"
reference: "https://github.com/drduh/OS-X-Security-and-Privacy-Guide"
tests:
[
{
type: "exact match"
command: "defaults -currentHost read /Library/Preferences/SystemConfiguration/com.apple.captive.control Active"
command_pass: "0"
command_fail: "1"
case_sensitive: "false"
}
]
fix:
{
command: "defaults -currentHost write /Library/Preferences/SystemConfiguration/com.apple.captive.control Active -bool false"
sudo_command: "sudo defaults -currentHost write /Library/Preferences/SystemConfiguration/com.apple.captive.control Active -bool false"
}
undo: "sudo defaults -currentHost write /Library/Preferences/SystemConfiguration/com.apple.captive.control Active -bool true"
},
{
description: "OpenSSL is up to date."
confidence: "required"
reference: "https://github.com/drduh/OS-X-Security-and-Privacy-Guide"
tests:
[
{
type: "exact match"
command: "openssl version"
command_pass: "OpenSSL 1.0.2h 3 May 2016"
case_sensitive: "false"
}
]
fix:
{
command: "brew update ; brew install openssl ; brew upgrade openssl ; bash ./scripts/set_openssl_latest_path.sh"
manual:
'''
1. Bring the Terminal application to the foreground if it is not already. You should see the word "Terminal" in the top left corner of your screen.
2. Select Terminal->Quit
3. Re-open the Terminal application and run the tool again; this check should now pass.
'''
}
},
{
description: "Hidden files are displayed in Finder."
confidence: "recommended"
reference: "http://lifehacker.com/the-best-hidden-settings-you-can-unlock-with-os-xs-ter-1476627111"
tests:
[
{
type: "exact match"
command: "defaults -currentHost read /Library/Preferences/SystemConfiguration/com.apple.finder AppleShowAllFiles"
command_pass: "1"
command_fail: "0"
case_sensitive: "false"
}
]
fix:
{
command: "defaults -currentHost write /Library/Preferences/SystemConfiguration/com.apple.finder AppleShowAllFiles -bool true && killall Dock"
sudo_command: "sudo defaults -currentHost write /Library/Preferences/SystemConfiguration/com.apple.finder AppleShowAllFiles -bool true && killall Dock"
}
undo: "defaults -currentHost write /Library/Preferences/SystemConfiguration/com.apple.finder AppleShowAllFiles -bool false && killall Dock"
},
{
description: "All application software is currently up to date."
confidence: "required"
reference: "https://github.com/SummitRoute/osxlockdown/"
tests:
[
{
type: "exact match"
command:
LASTUPDATE=$(defaults read /Library/Preferences/com.apple.SoftwareUpdate | grep LastSuccessfulDate | sed -e 's@^.* "\([0-9\\-]*\) .*$@\1@'); if [ "$LASTUPDATE" = "$(date +%Y-%m-%d)" ];then echo 1 && exit; fi; echo 0 && exit
command_pass: "1"
command_fail: "0"
case_sensitive: "false"
}
]
fix:
{
command: "softwareupdate -i -a"
sudo_command: "sudo softwareupdate -i -a"
}
},
{
//System Preferences: App Store: Automatically check for updates
description: "Automatic check for software updates is enabled."
confidence: "required"
reference: "https://github.com/SummitRoute/osxlockdown/"
tests:
[
{
type: "exact match"
command: "sudo softwareupdate --schedule | grep -i 'Automatic check is on'"
command_pass: "Automatic check is on"
case_sensitive: "false"
}
]
fix:
{
command: "softwareupdate --schedule on"
sudo_command: "sudo softwareupdate --schedule on"
}
},
{
//System Preferences->Security & Privacy->General->Allow apps downloaded from
description: "GateKeeper protection against untrusted applications is enabled."
confidence: "required"
tests:
[
{
type: "exact match"
command: "spctl --status | grep -i 'assessments enabled'"
command_pass: "assessments enabled"
case_sensitive: "false"
}
]
fix:
{
command: "spctl --master-enable"
sudo_command: "sudo spctl --master-enable"
}
undo: "sudo spctl --master-disable"
},
{
//System Preferences->Bluetooth->Turn Bluetooth Off
description: "Bluetooth is disabled."
confidence: "experimental"
tests:
[
{
type: "exact match"
command: "defaults read /Library/Preferences/com.apple.Bluetooth ControllerPowerState"
command_pass: "0"
command_fail: "1"
case_sensitive: "false"
},
{
type: "exact match"
command: "sudo defaults read /Library/Preferences/com.apple.Bluetooth ControllerPowerState"
command_pass: "0"
command_fail: "1"
case_sensitive: "false"
}
]
fix:
{
command: "defaults write /Library/Preferences/com.apple.Bluetooth ControllerPowerState -bool false; killall -HUP blued"
sudo_command: "sudo defaults write /Library/Preferences/com.apple.Bluetooth ControllerPowerState -bool false; sudo killall -HUP blued"
}
undo: "defaults write /Library/Preferences/com.apple.Bluetooth ControllerPowerState -bool true; killall -HUP blued"
},
{
description: "The infrared receiver is disabled."
confidence: "required"
tests:
[
{
type: "exact match"
command: "defaults read /Library/Preferences/com.apple.driver.AppleIRController DeviceEnabled"
command_pass: "0"
command_fail: "1"
case_sensitive: "false"
},
{
type: "exact match"
command: "sudo defaults read /Library/Preferences/com.apple.driver.AppleIRController DeviceEnabled"
command_pass: "0"
command_fail: "1"
case_sensitive: "false"
}
]
fix:
{
command: "defaults write /Library/Preferences/com.apple.driver.AppleIRController DeviceEnabled -bool false"
sudo_command: "sudo defaults write /Library/Preferences/com.apple.driver.AppleIRController DeviceEnabled -bool false"
}
undo: "defaults write /Library/Preferences/com.apple.driver.AppleIRController DeviceEnabled -bool true"
},
{
description: "AirDrop file sharing is disabled."
confidence: "required"
tests:
[
{
type: "exact match"
command: "defaults read com.apple.NetworkBrowser DisableAirDrop"
command_pass: "1"
command_fail: "0"
case_sensitive: "false"
},
{
type: "exact match"
command: "sudo defaults read com.apple.NetworkBrowser DisableAirDrop"
command_pass: "1"
command_fail: "0"
case_sensitive: "false"
}
]
fix:
{
command: "defaults_write_ignore_missing com.apple.NetworkBrowser DisableAirDrop -bool true"
}
undo: "defaults write com.apple.NetworkBrowser DisableAirDrop -bool false"
},
/* Begin: System Preferences->Sharing */
{
//System Preferences->Sharing->File Sharing
description: "File sharing is disabled."
confidence: "recommended"
reference: "https://github.com/SummitRoute/osxlockdown/blob/58697f5162fe9e43df7dc9b6b94ffa34b0e11d4f/commands.yaml"
tests:
[
{
type: "exact match"
command:
if [ -n "$(launchctl list | egrep AppleFileServer)" ]; then exit 1; fi; if [ -n "$(grep -i array /Library/Preferences/SystemConfiguration/com.apple.smb.server.plist)" ]; then echo 1; exit; fi; echo 0; exit
command_pass: "0"
command_fail: "1"
case_sensitive: "false"
}
]
fix:
{
command: "launchctl unload -w /System/Library/LaunchDaemons/com.apple.AppleFileServer.plist; launchctl unload -w /System/Library/LaunchDaemons/com.apple.smbd.plist"
}
},
{
//System Preferences->Sharing->Printer Sharing
description: "Printer sharing is disabled."
confidence: "required"
reference: "https://github.com/SummitRoute/osxlockdown/blob/58697f5162fe9e43df7dc9b6b94ffa34b0e11d4f/commands.yaml"
tests:
[
{
type: "exact match"
command:
if [ -n "$(system_profiler SPPrintersDataType | grep Shared | grep Yes)" ]; then echo 1; exit; fi; if [ -n "$(system_profiler SPPrintersDataType | grep 'System Printer Sharing: Yes')" ]; then echo 1; exit; fi; echo 0; exit
command_pass: "0"
command_fail: "1"
case_sensitive: "false"
}
]
fix:
{
command: "cupsctl --no-share-printers"
}
},
{
//System Preferences->Sharing->Remote Login
description: "Remote login is disabled."
confidence: "required"
tests:
[
{
type: "exact match"
command: "systemsetup -getremotelogin"
command_pass: "Remote Login: Off"
case_sensitive: "false"
},
{
type: "exact match"
command: "sudo systemsetup -getremotelogin"
command_pass: "Remote Login: Off"
case_sensitive: "false"
}
]
fix:
{
command: "systemsetup -f -setremotelogin off"
sudo_command: "sudo systemsetup -f -setremotelogin off"
}
undo: "sudo systemsetup -f -setremotelogin on"
},
{
//System Preferences->Sharing->Remote Management
description: "Remote Management is disabled."
confidence: "required"
tests:
[
{
type: "exact match"
command:
if [ -n "$(ps -ef | egrep "/System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/MacOS/[A]RDAgent")" ]; then echo 1; exit; fi; echo 0; exit
command_pass: "0"
command_fail: "1"
case_sensitive: "false"
}
]
fix:
{
command: "/System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -deactivate -stop"
sudo_command: "sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -deactivate -stop"
}
},
{
//System Preferences->Sharing->Remote Apple Events
//See: https://support.apple.com/kb/PH18721?locale=en_US
description: "Remote Apple events are disabled."
confidence: "required"
reference: "https://github.com/SummitRoute/osxlockdown/blob/58697f5162fe9e43df7dc9b6b94ffa34b0e11d4f/commands.yaml"
tests:
[
{
type: "exact match"
command: "systemsetup -getremoteappleevents"
command_pass: "Remote Apple Events: Off"
case_sensitive: "false"
},
{
type: "exact match"
command: "sudo systemsetup -getremoteappleevents"
command_pass: "Remote Apple Events: Off"
case_sensitive: "false"
}
]
fix:
{
command: "systemsetup -setremoteappleevents off"
sudo_command: "systemsetup -setremoteappleevents off"
}
undo: "sudo systemsetup -setremoteappleevents on"
},
{
//System Preferences->Sharing->Internet Sharing
description: "Internet Sharing is disabled on all network interfaces."
confidence: "required"
reference: "https://github.com/SummitRoute/osxlockdown/blob/58697f5162fe9e43df7dc9b6b94ffa34b0e11d4f/commands.yaml"
tests:
[
{
type: "exact match"
command: "defaults read /Library/Preferences/SystemConfiguration/com.apple.nat NAT | grep -c 'Enabled = 1'"
command_pass: "0"
case_sensitive: "false"
}
]
fix:
{
command: "defaults write /Library/Preferences/SystemConfiguration/com.apple.nat NAT -dict-add Enabled -bool false"
sudo_command: "sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.nat NAT -dict-add Enabled -bool false"
}
},
/* End: System Preferences->Sharing */
{
//System Preferences->Energy Saver->Wake for network access
description: "Wake on Network Access feature is disabled."
confidence: "required"
tests:
[
{
type: "exact match"
command: "systemsetup getwakeonnetworkaccess"
command_pass: "Wake On Network Access: Off"
case_sensitive: "false"
},
{
type: "exact match"
command: "sudo systemsetup getwakeonnetworkaccess"
command_pass: "Wake On Network Access: Off"
case_sensitive: "false"
}
]
fix:
{
command: "systemsetup -setwakeonnetworkaccess off"
sudo_command: "sudo systemsetup -setwakeonnetworkaccess off"
}
undo: "sudo systemsetup -setwakeonnetworkaccess on"
},
{
//Disables NTPd. There are definitely some downsides to this; some security software requires synchronized clocks, so this increases the risk of getting out of sync. I think most of this software will fail-safe, though. Disabling this has various benefits. See discussion here: https://github.com/SummitRoute/osxlockdown/issues/18
description: "Automatic setting of time and date is disabled."
confidence: "recommended"
tests:
[
{
type: "exact match"
command: "systemsetup getusingnetworktime"
command_pass: "Network Time: Off"
command_fail: "Network Time: On"
case_sensitive: "false"
},
{
type: "exact match"
command: "sudo systemsetup getusingnetworktime"
command_pass: "Network Time: Off"
command_fail: "Network Time: On"
case_sensitive: "false"
}
]
fix:
{
command: "systemsetup setusingnetworktime off"
sudo_command: "sudo systemsetup setusingnetworktime off"
}
undo: "sudo systemsetup setusingnetworktime on"
},
{
//There are a number of attacks based on IPv6 use. For the sake of simplicity, it's best to disable it entirely unless it is required. See: https://www.ernw.de/download/ERNW_Hardening_IPv6_MacOS-X_v1_0.pdf
description: "IPv6 is disabled on all network interfaces."
confidence: "recommended"
reference: "https://github.com/SummitRoute/osxlockdown/blob/58697f5162fe9e43df7dc9b6b94ffa34b0e11d4f/commands.yaml"
tests:
[
{
type: "exact match"
command:
networksetup -listallnetworkservices | while read i; do SUPPORT=$(networksetup -getinfo "$i" | grep "IPv6: Automatic") && if [ -n "$SUPPORT" ]; then echo 1; fi; done; echo 0; exit
command_pass: "0"
//command_fail would be one or more instances of the character "1"
case_sensitive: "false"
}
]
fix:
{
command:
networksetup -listallnetworkservices | while read i; do SUPPORT=$(networksetup -getinfo "$i" | grep "IPv6: Automatic") && if [ -n "$SUPPORT" ]; then networksetup -setv6off "$i"; fi; done;
}
},
{
description: "An administrator password is required to change system-wide preferences."
confidence: "required"
reference: "https://github.com/SummitRoute/osxlockdown/blob/58697f5162fe9e43df7dc9b6b94ffa34b0e11d4f/commands.yaml"
tests:
[
{
type: "exact match"
command:
if [ -n "$(security authorizationdb read system.preferences 2> /dev/null | grep -A1 shared | grep -E '(true|false)' | grep 'false')" ]; then echo 0; else echo 1; fi
command_pass: "0"
command_fail: "1"
case_sensitive: "false"
}
]
fix:
{
//TODO: Add warning to user before fix command is run that she will be prompted for her admin credentials. this requires a new field
command:
security authorizationdb read system.preferences > /tmp/system.preferences.plist &&/usr/libexec/PlistBuddy -c "Set :shared false" /tmp/system.preferences.plist && security authorizationdb write system.preferences < /tmp/system.preferences.plist
}
},
{
description: "Documents are not stored to iCloud Drive by default. (May be mistaken if iCloud is disabled)"
confidence: "required"
reference: "http://mjtsai.com/blog/2014/10/26/yosemite-uploads-unsaved-documents-and-recent-addresses-to-icloud/"
tests:
[
{
type: "exact match"
command: "defaults read NSGlobalDomain NSDocumentSaveNewDocumentsToCloud"
command_pass: "0"
command_fail: "1"
case_sensitive: "false"
}
]
fix:
{
command: "defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false"
}
undo: "defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool true"
},
{
description: "The File Vault key is protected when going to standby mode."
//Once this set of configurations is proven stable, this can be upgraded from "experimental" to "recommended". We may want to warn the user first that waking will be slower and require authenticating twice.
confidence: "experimental"
reference: "https://github.com/drduh/OS-X-Security-and-Privacy-Guide"
tests:
[
{
type: "exact match"
command: "bash ./scripts/DestroyFVKeyOnStandby_check.sh"
command_pass: "1"
command_fail: "0"
case_sensitive: "false"
}
]
fix:
{
//Additional configurations are required to make this setting not fight with powernap/standby/autopoweroff. See: https://github.com/drduh/OS-X-Security-and-Privacy-Guide/issues/124
command: "pmset -a destroyfvkeyonstandby 1 ; pmset -a hibernatemode 25 ; pmset -a powernap 0 ; pmset -a standby 0 ; pmset -a standbydelay 0; pmset -a autopoweroff 0"
sudo_command: "sudo pmset -a destroyfvkeyonstandby 1 ; sudo pmset -a hibernatemode 25 ; sudo pmset -a powernap 0 ; sudo pmset -a standby 0 ; sudo pmset -a standbydelay 0; sudo pmset -a autopoweroff 0"
}
},
{
description: "The system will store a copy of memory to persistent storage, and will remove power to memory."
confidence: "recommended"
reference: "https://github.com/drduh/OS-X-Security-and-Privacy-Guide"
tests:
[
{
type: "regex match"
command: "pmset -g"
command_pass: ".*hibernatemode\\s+25.*"
case_sensitive: "false"
}
]
fix:
{
command: "pmset -a hibernatemode 25"
sudo_command: "sudo pmset -a hibernatemode 25"
}
},
{
description: "git is up to date or is not installed"
confidence: "required"
tests:
[
{
type: "regex match"
command: "git --version"
command_pass: ".*(command not found|2\\.9\\.3).*"
case_sensitive: "false"
}
]
fix:
{
//Only "fix" this PATH preference if we haven't already applied the
//fix to the ~/.profile file. Otherwise, the user will need to
//restart Terminal in order for this take effect.
command:
brew update ; brew install git ; brew upgrade git ; python ./scripts/set_path_precedence.py "/usr/local/bin" "/usr/bin"
manual:
'''
1. Bring the Terminal application to the foreground if it is not already. You should see the word "Terminal" in the top left corner of your screen.
2. Select Terminal->Quit
3. Re-open the Terminal application and run the tool again; this check should now pass.
'''
}
},
{
description: "Apple Push Notifications are disabled."
confidence: "recommended"