Advertisement
Guest User

Untitled

a guest
Jul 21st, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.47 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. SCRIPTVER="3.1"
  4. export TZ="UTC"
  5.  
  6. osx_realpath() {
  7. [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
  8. }
  9.  
  10. echo -e "This application will enable various security settings on your Mac. A reboot will be necessary at the end. To begin, please enter your password when prompted."
  11. _pw="$(osascript -e 'Tell application "System Events" to display dialog "Your laptop password:" default answer "" with hidden answer' -e 'text returned of result' 2>/dev/null)"
  12.  
  13. echo
  14. echo "Running as the following user:"
  15. echo $_pw | sudo -Sp '' id -p
  16.  
  17. if [ $? -ne 0 ]
  18. then
  19. echo
  20. echo "********************************************************"
  21. echo "* *"
  22. echo "* ERROR: Please try again with the correct password. *"
  23. echo "* *"
  24. echo "********************************************************"
  25. exit 1
  26. fi
  27.  
  28. echo
  29. echo "Enabling automatic updates..."
  30. sudo defaults write /Library/Preferences/com.apple.SoftwareUpdate AutomaticCheckEnabled -bool true &> /dev/null
  31. sudo defaults write /Library/Preferences/com.apple.SoftwareUpdate AutomaticDownload -bool true &> /dev/null
  32. sudo defaults write /Library/Preferences/com.apple.SoftwareUpdate ConfigDataInstall -bool true &> /dev/null
  33. sudo defaults write /Library/Preferences/com.apple.SoftwareUpdate CriticalUpdateInstall -bool true &> /dev/null
  34. sudo defaults write /Library/Preferences/com.apple.commerce AutoUpdate -bool true &> /dev/null
  35. sudo defaults write /Library/Preferences/com.apple.commerce AutoUpdateRestartRequired -bool true &> /dev/null
  36.  
  37. echo "Enabling Gatekeeper..."
  38. sudo spctl --master-enable &> /dev/null
  39.  
  40. echo "Configuring firewall..."
  41. sudo defaults write /Library/Preferences/com.apple.alf globalstate -int 1
  42.  
  43. echo "Configuring screen saver..."
  44. defaults write com.apple.screensaver askForPassword -int 1 &> /dev/null
  45. defaults write com.apple.screensaver askForPasswordDelay -int 3 &> /dev/null
  46. defaults write com.apple.screensaver idleTime 600 &> /dev/null
  47. sudo pmset -b displaysleep 15 &> /dev/null
  48. sudo pmset -c displaysleep 15 &> /dev/null
  49.  
  50. echo "Disabling Safari automatic file opening..."
  51. defaults write com.apple.Safari AutoOpenSafeDownloads -boolean no &> /dev/null
  52.  
  53. echo "Disabling wake for access..."
  54. sudo pmset -c womp 0 &> /dev/null
  55.  
  56. echo "Enabling secure trash..."
  57. defaults write com.apple.finder EmptyTrashSecurely True &> /dev/null
  58.  
  59. echo "Enabling show all file extensions in Finder..."
  60. defaults write NSGlobalDomain AppleShowAllExtensions True &> /dev/null
  61.  
  62. echo "Disabling core dumps..."
  63. sudo launchctl limit core 0 &> /dev/null
  64.  
  65. echo "Enabling FileVault disk encryption..."
  66. sudo fdesetup enable -defer /FileVaultRecoverKeyInfo.plist -showrecoverykey
  67.  
  68. echo "Adding sudo security setting..."
  69. sudo grep -q 'tty_tickets' /etc/sudoers || sudo bash -c 'echo -e "\n## Auth0 settings\nDefaults tty_tickets" >> /etc/sudoers'
  70.  
  71. echo
  72. echo "*************************************************************"
  73. echo "* *"
  74. echo "* Done! Please reboot so that these settings take effect. *"
  75. echo "* *"
  76. echo "* Tip: Use shift-control-power to lock your screen. *"
  77. echo "* Press and hold each key in sequence, not all *"
  78. echo "* at once. *"
  79. echo "* *"
  80. echo "*************************************************************"
  81. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement