-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsecurity.sh
executable file
·69 lines (49 loc) · 2.81 KB
/
security.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
# Allow TouchID for Sudo
sudo tee /etc/pam.d/sudo << EndOfMessage
auth sufficient pam_tid.so
$(cat /etc/pam.d/sudo)
EndOfMessage
# Disables signing in as Guest from the login screen
sudo defaults write /Library/Preferences/com.apple.loginwindow GuestEnabled -bool NO
# Disables Guest access to file shares over AF
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server AllowGuestAccess -bool NO
# Disables Guest access to file shares over SMB
sudo defaults write /Library/Preferences/com.apple.AppleFileServer guestAccess -bool NO
# Disable remote login (incoming SSH and SFTP connections)
echo "Type 'yes' to the following prompt:"
sudo systemsetup -setremotelogin off
# Disable insecure TFTP service
sudo launchctl disable 'system/com.apple.tftpd'
# Disable Bonjour multicast advertising
sudo defaults write /Library/Preferences/com.apple.mDNSResponder.plist NoMulticastAdvertisements -bool true
# Disable insecure telnet protocol
sudo launchctl disable system/com.apple.telnetd
# Disable sharing of local printers with other computers
cupsctl --no-share-printers
# Disable printing from any address including the Internet
cupsctl --no-remote-any
# Disable remote printer administration
cupsctl --no-remote-admin
# Enable application firewall
/usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate on
sudo defaults write /Library/Preferences/com.apple.alf globalstate -bool true
defaults write com.apple.security.firewall EnableFirewall -bool true
# Turn on firewall logging
/usr/libexec/ApplicationFirewall/socketfilterfw --setloggingmode on
sudo defaults write /Library/Preferences/com.apple.alf loggingenabled -bool true
# Turn on stealth mode
/usr/libexec/ApplicationFirewall/socketfilterfw --setstealthmode on
sudo defaults write /Library/Preferences/com.apple.alf stealthenabled -bool true
defaults write com.apple.security.firewall EnableStealthMode -bool true
# Prevent automatically allowing incoming connections to signed apps
sudo defaults write /Library/Preferences/com.apple.alf allowsignedenabled -bool false
# Prevent automatically allowing incoming connections to downloaded signed apps
sudo defaults write /Library/Preferences/com.apple.alf allowdownloadsignedenabled -bool false
# Disable Internet based spell correction
defaults write NSGlobalDomain WebAutomaticSpellingCorrectionEnabled -bool false
# Deactivate the Remote Management Service
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -deactivate -stop
# Enable FileVault encryption.
sudo fdesetup enable
sudo -u $(whoami) defaults write "$HOME/Library/Preferences/ByHost/com.apple.coreservices.useractivityd.plist" ActivityAdvertisingAllowed -bool no
sudo -u $(whoami) defaults write "$HOME/Library/Preferences/ByHost/com.apple.coreservices.useractivityd.plist" ActivityReceivingAllowed -bool no