├── .gitattributes ├── .travis.yml ├── CODE_OF_CONDUCT.md ├── LICENSE ├── README.md ├── docs ├── logo.png ├── screenshot.png └── whishlist.md ├── ostemper.sh └── tests └── ostemper-shellchecks.sh /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: bash 2 | sudo: required 3 | 4 | os: 5 | - osx 6 | 7 | install: 8 | # OS X: install the dash and checkbashisms script 9 | - brew update 10 | - brew install dash checkbashisms shellcheck 11 | # Install bashate 12 | #- curl https://bootstrap.pypa.io/get-pip.py | sudo python 13 | #- export PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin" 14 | #- export PATH="/var/root/Library/Python/2.7/bin:$PATH" 15 | #- sudo -H pip install --user bashate 16 | 17 | script: 18 | - tests/ostemper-shellchecks.sh -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. 6 | 7 | ## Our Standards 8 | 9 | Examples of behavior that contributes to creating a positive environment include: 10 | 11 | * Using welcoming and inclusive language 12 | * Being respectful of differing viewpoints and experiences 13 | * Gracefully accepting constructive criticism 14 | * Focusing on what is best for the community 15 | * Showing empathy towards other community members 16 | 17 | Examples of unacceptable behavior by participants include: 18 | 19 | * The use of sexualized language or imagery and unwelcome sexual attention or advances 20 | * Trolling, insulting/derogatory comments, and personal or political attacks 21 | * Public or private harassment 22 | * Publishing others' private information, such as a physical or electronic address, without explicit permission 23 | * Other conduct which could reasonably be considered inappropriate in a professional setting 24 | 25 | ## Our Responsibilities 26 | 27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. 28 | 29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. 30 | 31 | ## Scope 32 | 33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. 34 | 35 | ## Enforcement 36 | 37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team through issues requests. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. 38 | 39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. 40 | 41 | ## Attribution 42 | 43 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] 44 | 45 | [homepage]: http://contributor-covenant.org 46 | [version]: http://contributor-covenant.org/version/1/4/ 47 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![OS Temper logo](docs/logo.png) 2 | 3 | [![Build Status](https://travis-ci.org/koconder/ostemper.svg?branch=master)](https://travis-ci.org/koconder/ostemper) [![Donate BTC](https://img.shields.io/badge/donate-BTC-orange.svg)](https://github.com/koconder/ostemper#contributing-and-donations) [![Donate ETH](https://img.shields.io/badge/donate-ETH-orange.svg)](https://etherdonation.com/d?to=0xe6fbd8de8157934767867022b7a8e8691d8df3dc) 4 | 5 | **OS Temper** 6 | 7 | *Automatic Hardening and Tweaks for OS X* 8 | 9 | This script is an "all-in-one" solution for a large number of security fixes, recommended tweaks and first time setup for Mac OS X operating system. This has only been tested for OSX version 10.13.x 10 | 11 | ## Screenshot 12 | ![OS Temper Screenshot](docs/screenshot.png) 13 | 14 | ## Running OS Temper 15 | ### Requirements 16 | **Platform** `mac_os_x` 17 | 18 | **OS Versions Supported** `10.13.x` 19 | 20 | ### Quick Method 21 | For quick setup and running based on the default configuration as per the current release in Github. If you would like to modify please feel free to fork and make any changes as needed. Open Terminal app and run: 22 | 23 | curl -fsSL https://raw.githubusercontent.com/koconder/ostemper/master/ostemper.sh | sudo bash 24 | 25 | 26 | ### Other Methods 27 | If you have pulled the script down using Git you can run the script directly. 28 | 29 | **Auto-Harden** 30 | 31 | sudo ./ostemper.sh 32 | 33 | ## Features and Functionality 34 | ### Security 35 | - Disabling a number of potentially insecure services 36 | - Enabling firewalls and other essential security fixes 37 | - Disabling crash reports and analytics collection where possible 38 | - Enabling automatic updates 39 | - Other privacy tweaks 40 | 41 | ### Development 42 | - Installing Xcode and Git 43 | - Installing Homebrew 44 | - Installing a number of commonly used fonts 45 | - Common Bash and Terminal tweaks 46 | 47 | ### Updates and Installs 48 | - Running all required system updates 49 | - Updating SSH configuration 50 | - Common apps installed 51 | 52 | ### Tweaks 53 | - Finder tweaks 54 | 55 | ## To-Do 56 | A number of to-do's in progress: 57 | 58 | - User creation for first-time setup 59 | - Homebrew intergration 60 | - Common app installation 61 | - App and system updates 62 | - Rules and configuration for commonly used apps 63 | - Cleaning scripts to remove log's and trace files 64 | - Bash profile and terminal tweaks 65 | - Developer friendly setup for LAMP/LEMP, PHP, Python, Ruby, NodeJS 66 | - VPN client installation 67 | - Hardening of Chrome and Firefox 68 | 69 | ## References and Sources 70 | OS Temper is built upon the works and ideas from other scripts and community discussions, you can find a list of the sources below. 71 | 72 | *Automated Installs:* 73 | - [github.com/Edditoria/dotfiles](https://github.com/Edditoria/dotfiles) 74 | - [github.com/caskroom/homebrew-cask](https://github.com/caskroom/homebrew-cask) 75 | - [github.com/pablopunk/mac-fresh-install 76 | ](https://github.com/pablopunk/mac-fresh-install) 77 | 78 | *System and Security Tweaks:* 79 | - [github.com/nicolinuxfr/macOS-post-installation](https://github.com/nicolinuxfr/macOS-post-installation) 80 | - [github.com/andrewparadi/.files](https://github.com/andrewparadi/.files) 81 | - [github.com/karek314/macOS-home-call-drop](https://github.com/karek314/macOS-home-call-drop) 82 | - [cipherli.st](https://cipherli.st/) 83 | - [gov.uk](https://www.gov.uk/government/uploads/system/uploads/attachment_data/file/470580/osx-provisioning-script.sh.txt) 84 | 85 | *Developer Friendly Tweaks:* 86 | - [github.com/kiriaze/mac-dev-env](https://github.com/kiriaze/mac-dev-env) 87 | - [github.com/filipmaelbrancke/mac-install](https://github.com/filipmaelbrancke/mac-install) 88 | - [github.com/jeremybradbury/mac-php-dev-env](https://github.com/jeremybradbury/mac-php-dev-env) 89 | 90 | *OS Temper terminal logic and functionality*: 91 | - [github.com/Winetricks/winetricks](https://github.com/Winetricks/winetricks) 92 | 93 | ## Contributing and Donations 94 | 95 | If you find something interesting or would like to contribute, please open issue and start disccussion. Feel free to fork and pull request. If this repo has helped you out feel free to donate via BTC/ETH or to the EFF 96 | - BTC: 14v9knBDAmJAMxWovuLfy7YkLDyfq8phNb 97 | - ETH: 0xe6fbd8de8157934767867022b7a8e8691d8df3dc 98 | - EFF: (https://supporters.eff.org/donate/button) 99 | 100 | ## License and Authors 101 | Author: Vincent Koc (vincent@loophole.eu) 102 | Copyright: 2018, Vincent K. 103 | 104 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0 105 | 106 | Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 107 | 108 | OSTemper logo based upon Fingerprint by LAFS from the Noun Project under Creative Commons licence 3.0: https://creativecommons.org/licenses/by/3.0/ 109 | -------------------------------------------------------------------------------- /docs/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vincentkoc/ostemper/0103a7b6cc21e397cd90625fc65c7e0c02067e26/docs/logo.png -------------------------------------------------------------------------------- /docs/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vincentkoc/ostemper/0103a7b6cc21e397cd90625fc65c7e0c02067e26/docs/screenshot.png -------------------------------------------------------------------------------- /docs/whishlist.md: -------------------------------------------------------------------------------- 1 | ### Wishlist and Ideas 2 | Some ideas for further extending OS Temper 3 | 4 | - (https://github.com/feross/SpoofMAC) 5 | - (https://github.com/drduh/macOS-Security-and-Privacy-Guide) 6 | - (https://osquery.readthedocs.io/en/stable/) & (https://kolide.com/) -------------------------------------------------------------------------------- /ostemper.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) 2018 Vincent Koc 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | # Boilerplate header 18 | # Colors from https://stackoverflow.com/questions/5947742/how-to-change-the-output-color-of-echo-in-linux 19 | echo -e 20 | echo -e "\033[0;33m############################################################" 21 | echo -e " OS Temper :: Automatic OS Hardening and Tweaks" 22 | echo -e "############################################################\033[0m" 23 | echo -e 24 | 25 | 26 | # Disable if not running as sudo 27 | if [[ $UID -ne 0 ]]; then 28 | echo -e "[\033[31m!\033[m] This script needs to be run as root (with sudo).." 29 | exit 1 30 | fi 31 | 32 | 33 | # Validate login 34 | sudo -v 35 | echo -e "[\033[32m+\033[m] Login validated as sudo/root" 36 | 37 | # Validate preference files 38 | echo -e "[\033[33m?\033[m] Resetting file permissions for users pref files before starting" 39 | chmod 755 ~/Library/Preferences/ >/dev/null 40 | 41 | # System and user information for logging 42 | echo -e 43 | echo -e 44 | echo -e ":::" 45 | echo -e "::: Current machine and user information" 46 | echo -e ":::" 47 | echo -e "\t|- [\033[33m?\033[m] Current User: $(id -u -n)" 48 | echo -e "\t|- [\033[33m?\033[m] Current Hostname: $(hostname)" 49 | echo -e "\t\- [\033[33m?\033[m] Kernel and Timestamp: $(uname -v)" 50 | 51 | # Starting system tweaks 52 | echo -e 53 | echo -e 54 | echo -e ":::" 55 | echo -e "::: Starting System and Developer Tweaks" 56 | echo -e ":::" 57 | 58 | echo -e "\t|- [\033[32m+\033[m] System tweaks / Disabled boot up 'ding' sound" 59 | sudo nvram SystemAudioVolume=" " >/dev/null 60 | 61 | # Set the timezone; see `sudo systemsetup -listtimezones` for other values 62 | #sudo systemsetup -settimezone "Australia/Sydney" > /dev/null 63 | 64 | echo -e "\t|- [\033[32m+\033[m] System tweaks / Finder expanding save panel by default" 65 | defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true 66 | defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true 67 | 68 | echo -e "\t|- [\033[32m+\033[m] System tweaks / Use current folder for search default" 69 | defaults write com.apple.finder FXDefaultSearchScope -string "SCcf" 70 | 71 | echo -e "\t|- [\033[32m+\033[m] System tweaks / Show status bar in Finder and Indicators in dock" 72 | defaults write com.apple.finder ShowStatusBar -bool true 73 | defaults write com.apple.dock show-process-indicators -bool true 74 | 75 | echo -e "\t|- [\033[32m+\033[m] System tweaks / Disable smart quotes when typing" 76 | defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false 77 | 78 | echo -e "\t|- [\033[32m+\033[m] System tweaks / Disable smart dashes when typing" 79 | defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false 80 | 81 | echo -e "\t|- [\033[32m+\033[m] System tweaks / Disable automatic period substitution when typing" 82 | defaults write NSGlobalDomain NSAutomaticPeriodSubstitutionEnabled -bool false 83 | 84 | echo -e "\t|- [\033[32m+\033[m] System tweaks / Disable automatic capitalisation when typing" 85 | defaults write NSGlobalDomain NSAutomaticCapitalizationEnabled -bool false 86 | 87 | echo -e "\t|- [\033[32m+\033[m] System tweaks / Disable auto-correct" 88 | defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false 89 | 90 | echo -e "\t|- [\033[32m+\033[m] System tweaks / Automatically hide and show the dock" 91 | defaults write com.apple.dock autohide -bool true 92 | 93 | echo -e "\t|- [\033[32m+\033[m] System tweaks / Disable screenshot shadows" 94 | defaults write com.apple.screencapture disable-shadow -bool true 95 | defaults write com.apple.screencapture name "Screenshot" 96 | 97 | echo -e "\t|- [\033[32m+\033[m] System tweaks / Disable DS_Store files on non physical volumes " 98 | defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true 99 | defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true 100 | 101 | echo -e "\t|- [\033[32m+\033[m] System tweaks / Improving Bluetooth audio quality" 102 | #defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" -int 40 103 | defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Max (editable)" 80 104 | defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" 40 105 | defaults write com.apple.BluetoothAudioAgent "Apple Initial Bitpool (editable)" 80 106 | defaults write com.apple.BluetoothAudioAgent "Apple Initial Bitpool Min (editable)" 80 107 | defaults write com.apple.BluetoothAudioAgent "Negotiated Bitpool" 80 108 | defaults write com.apple.BluetoothAudioAgent "Negotiated Bitpool Max" 80 109 | defaults write com.apple.BluetoothAudioAgent "Negotiated Bitpool Min" 80 110 | 111 | echo -e "\t|- [\033[32m+\033[m] System tweaks / Stop 'Photos' app from opening automatically" 112 | defaults -currentHost write com.apple.ImageCapture disableHotPlug -bool true 113 | 114 | echo -e "\t|- [\033[32m+\033[m] System tweaks / Enable text selection in 'Quick Look'" 115 | defaults write com.apple.finder QLEnableTextSelection -bool true 116 | 117 | echo -e "\t|- [\033[32m+\033[m] System tweaks / Disable natural scrolling for trackpad and mouse" 118 | defaults write NSGlobalDomain com.apple.swipescrolldirection -bool false 119 | 120 | echo -e "\t|- [\033[32m+\033[m] System tweaks / Enabling snap-to-grid for icons in Finder" 121 | /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist >/dev/null 2>/dev/null 122 | /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist >/dev/null 2>/dev/null 123 | /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist >/dev/null 2>/dev/null 124 | 125 | echo -e "\t|- [\033[32m+\033[m] System tweaks / Close 'Printer' app when printing jobs finish" 126 | defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true 127 | 128 | echo -e "\t|- [\033[32m+\033[m] System tweaks / Show language menu in the top right corner of the boot screen" 129 | sudo defaults write /Library/Preferences/com.apple.loginwindow showInputMenu -bool true 130 | 131 | echo -e "\t|- [\033[32m+\033[m] System tweaks / Hide time machine popups" 132 | defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true 133 | 134 | echo -e "\t\- [\033[32m+\033[m] System tweaks / Enable iOS charing chime when plugged into magsafe" 135 | defaults write com.apple.PowerChime ChimeOnAllHardware -bool true && \ 136 | open /System/Library/CoreServices/PowerChime.app 137 | 138 | #echo -e "[\033[32m+\033[m] System tweaks / Reduce transparency in Finder" 139 | #defaults write com.apple.universalaccess reduceTransparency -bool true 140 | 141 | # Starting system tweaks 142 | echo -e 143 | echo -e 144 | echo -e ":::" 145 | echo -e "::: Starting Developer Tweaks" 146 | echo -e ":::" 147 | 148 | echo -e "\t|- [\033[32m+\033[m] Developer tweaks / Show all file extensions" 149 | defaults write NSGlobalDomain AppleShowAllExtensions -bool true 150 | 151 | echo -e "\t|- [\033[32m+\033[m] Developer tweaks / Fix terminal follow focus mouse" 152 | defaults write com.apple.terminal FocusFollowsMouse -string YES 153 | defaults write org.x.X11 wm_ffm -bool true 154 | 155 | echo -e "\t|- [\033[32m+\033[m] Developer tweaks / Default plain-text for 'Richtext' app" 156 | defaults write com.apple.TextEdit RichText -int 0 157 | 158 | echo -e "\t\- [\033[32m+\033[m] Developer tweaks / Enable safari developer and web inspector" 159 | defaults write com.apple.safari IncludeDevelopMenu -int 1 160 | defaults write com.apple.Safari WebKitDeveloperExtrasEnabledPreferenceKey -bool true 161 | defaults write com.apple.Safari "com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled" -bool true 162 | defaults write NSGlobalDomain WebKitDeveloperExtras -bool true 163 | defaults write com.apple.safari ShowOverlayStatusBar -int 1 164 | defaults write com.apple.safari ShowFullURLInSmartSearchField -int 1 165 | 166 | 167 | # Starting intial security tweaks 168 | echo -e 169 | echo -e 170 | echo -e ":::" 171 | echo -e "::: Starting Security Tweaks - Inital" 172 | echo -e ":::" 173 | 174 | echo -e "\t|- [\033[32m+\033[m] Security tweaks / Time machine dose not require AC power (magsafe)" 175 | defaults write /Library/Preferences/com.apple.TimeMachine RequiresACPower -bool false 176 | 177 | 178 | echo -e "\t|- [\033[32m+\033[m] Security tweaks / Enabling scheduled updates" 179 | softwareupdate --schedule on >/dev/null 180 | defaults write /Library/Preferences/com.apple.SoftwareUpdate.plist AutomaticCheckEnabled -bool true 181 | defaults write /Library/Preferences/com.apple.SoftwareUpdate.plist AutomaticDownload -bool true 182 | defaults write /Library/Preferences/com.apple.commerce.plist AutoUpdateRestartRequired -bool true 183 | defaults write /Library/Preferences/com.apple.commerce.plist AutoUpdate -bool true 184 | 185 | echo -e "\t|- [\033[32m+\033[m] Security tweaks / Check for App Updates daily, not just once a week" 186 | defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1 187 | 188 | echo -e "\t|- [\033[32m+\033[m] Security tweaks / Disable IPV6 on Wi-fi and Ethernet adapters" 189 | #TODO: Scan all adapters and replicate 190 | networksetup -setv6off Wi-Fi >/dev/null 191 | networksetup -setv6off Ethernet >/dev/null 192 | 193 | echo -e "\t|- [\033[32m+\033[m] Security tweaks / Disable infared" 194 | defaults write /Library/Preferences/com.apple.driver.AppleIRController DeviceEnabled -int 0 195 | 196 | echo -e "\t|- [\033[32m+\033[m] Security tweaks / Disable guest login access" 197 | defaults write /Library/Preferences/com.apple.AppleFileServer guestAccess -bool NO 198 | defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server AllowGuestAccess -bool NO 199 | 200 | echo -e "\t|- [\033[32m+\033[m] Security tweaks / Disable SSH access" 201 | launchctl unload -w /System/Library/LaunchDaemons/ssh.plist >/dev/null 2>/dev/null 202 | 203 | echo -e "\t|- [\033[32m+\033[m] Security tweaks / Enable gatekeeper" 204 | spctl --master-enable >/dev/null 205 | 206 | echo -e "\t\- [\033[32m+\033[m] Security tweaks / Enable filevault" 207 | #TODO: Check fdesetup 208 | echo -e "\t\- [\033[33m?\033[m] ...You may be asked for login again, please keep recovery key safe" 209 | echo -e 210 | fdesetup enable 211 | echo -e 212 | 213 | # Starting intial security tweaks 214 | echo -e 215 | echo -e 216 | echo -e ":::" 217 | echo -e "::: Starting Security Tweaks - Privacy" 218 | echo -e ":::" 219 | 220 | echo -e "\t|- [\033[32m+\033[m] Security tweaks / Send 'Do Not Track' header in Safari" 221 | defaults write com.apple.safari SendDoNotTrackHTTPHeader -int 1 222 | 223 | echo -e "\t|- [\033[32m+\033[m] Security tweaks / Disable potential DNS leaks" 224 | defaults write /Library/Preferences/com.apple.mDNSResponder.plist NoMulticastAdvertisements -bool YES 225 | 226 | echo -e "\t|- [\033[32m+\033[m] Security tweaks / Disable Apple remote events" 227 | systemsetup -setremoteappleevents off >/dev/null 2>/dev/null 228 | 229 | echo -e "\t|- [\033[32m+\033[m] Security tweaks / Disable Apple remote agent and remove access" 230 | /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -deactivate -configure -access -off >/dev/null 2>/dev/null 231 | 232 | echo -e "\t|- [\033[32m+\033[m] Security tweaks / Disable crash reporting" 233 | defaults write com.apple.CrashReporter DialogType none 234 | 235 | echo -e "\t|- [\033[32m+\033[m] Security tweaks / New documents disable auto-save to iCloud" 236 | defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false 237 | 238 | echo -e "\t\- [\033[32m+\033[m] Security tweaks / Disable search data leaking in safari" 239 | defaults write com.apple.Safari UniversalSearchEnabled -bool false 240 | defaults write com.apple.Safari SuppressSearchSuggestions -bool true 241 | defaults write com.apple.Safari.plist WebsiteSpecificSearchEnabled -bool NO 242 | 243 | # Starting intial security tweaks 244 | echo -e 245 | echo -e 246 | echo -e ":::" 247 | echo -e "::: Starting Security Tweaks - Calling Home" 248 | echo -e ":::" 249 | 250 | # NEED TO ADD "System Integrity Protection" checks 251 | 252 | DAEMONS=() 253 | DAEMONS+=('com.apple.netbiosd') #Netbiosd is microsoft's networking service. used to share files between mac and windows 254 | #DAEMONS+=('com.apple.preferences.timezone.admintool') #Time setting daemon 255 | #DAEMONS+=('com.apple.preferences.timezone.auto') #Time setting daemon 256 | #DAEMONS+=('com.apple.remotepairtool') #Pairing devices remotely 257 | #DAEMONS+=('com.apple.rpmuxd') #daemon for remote debugging of mobile devices. 258 | #DAEMONS+=('com.apple.security.FDERecoveryAgent') #Full Disk Ecnryption - Related to File Vault https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man8/FDERecoveryAgent.8.html 259 | #DAEMONS+=('com.apple.icloud.findmydeviced') #Related to find my mac 260 | #DAEMONS+=('com.apple.findmymacmessenger') #Related to find my mac daemon, propably act on commands sent through FindMyDevice in iCloud 261 | DAEMONS+=('com.apple.familycontrols') #Parent control 262 | #DAEMONS+=('com.apple.findmymac') #Find my mac daemon 263 | #DAEMONS+=('com.apple.AirPlayXPCHelper') #Airplay daemon 264 | DAEMONS+=('com.apple.SubmitDiagInfo') #Feedback - most likely it submits your computer data when click 'About this mac' 265 | DAEMONS+=('com.apple.screensharing') #Screensharing daemon 266 | DAEMONS+=('com.apple.appleseed.fbahelperd') #Related to feedback 267 | #DAEMONS+=('com.apple.apsd') #Apple Push Notification Service (apsd) - it's calling home quite often + used by Facetime and Messages 268 | DAEMONS+=('com.apple.AOSNotificationOSX') #Notifications 269 | #DAEMONS+=('com.apple.FileSyncAgent.sshd') #Mostlikely sshd on this machine 270 | #DAEMONS+=('com.apple.ManagedClient.cloudconfigurationd') #Related to manage current macOS user iCloud 271 | #DAEMONS+=('com.apple.ManagedClient.enroll') #Related to manage current macOS user 272 | #DAEMONS+=('com.apple.ManagedClient') #Related to manage current macOS user 273 | #DAEMONS+=('com.apple.ManagedClient.startup') #Related to manage current macOS user 274 | #DAEMONS+=('com.apple.iCloudStats') #Related to iCloud 275 | #DAEMONS+=('com.apple.locationd') #Propably reading current location 276 | #DAEMONS+=('com.apple.mbicloudsetupd') #iCloud Settings 277 | #DAEMONS+=('com.apple.laterscheduler') #Schedule something? 278 | DAEMONS+=('com.apple.awacsd') #Apple Wide Area Connectivity Service daemon - Back to My Mac Feature 279 | #DAEMONS+=('com.apple.eapolcfg_auth') #perform privileged operations required by certain EAPOLClientConfiguration.h APIs 280 | DAEMONS+=('com.apple.awdd') #Sending out diagnostics & usage 281 | DAEMONS+=('com.apple.CrashReporterSupportHelper') #Crash reporter 282 | #DAEMONS+=('com.apple.trustd') #Propably related to certificates 283 | 284 | AGENTS=() 285 | #AGENTS+=('com.apple.photoanalysisd') #Apple AI to analyse photos stored in Photos.app, most likely to match faces and scenery but it happens to make requests to Apple during process, i have not checked what are those requestes i have just blocked it with Little Snitch 286 | #AGENTS+=('com.apple.telephonyutilities.callservicesd') #Handling phone and facetime calls 287 | #AGENTS+=('com.apple.AirPlayUIAgent') #Related Airport 288 | #AGENTS+=('com.apple.AirPortBaseStationAgent') #Related Airport 289 | #AGENTS+=('com.apple.CalendarAgent') #Calendar events related to iCloud 290 | #AGENTS+=('com.apple.iCloudUserNotifications') #iCloud notifications, like reminders 291 | AGENTS+=('com.apple.familycircled') #Family notifications, like reminders 292 | AGENTS+=('com.apple.familycontrols.useragent') #Family notifications, like reminders 293 | AGENTS+=('com.apple.familynotificationd') #Family notifications, like reminders 294 | AGENTS+=('com.apple.gamed') #GameCenter 295 | #AGENTS+=('com.apple.icloud.findmydeviced.findmydevice-user-agent') #Find my device ? 296 | #AGENTS+=('com.apple.icloud.fmfd') #Find my device ? 297 | #AGENTS+=('com.apple.imagent') #Facetime & Messages 298 | AGENTS+=('com.apple.cloudfamilyrestrictionsd-mac') #iCloud Family restrictions 299 | ###AGENTS+=('com.apple.cloudpaird') #Related to iCloud 300 | AGENTS+=('com.apple.cloudphotosd') #Propably syncing your photos to icloud 301 | AGENTS+=('com.apple.DictationIM') #Dictation 302 | AGENTS+=('com.apple.assistant_service') #Siri 303 | #AGENTS+=('com.apple.CallHistorySyncHelper') #Related to call history syncing (iCloud) 304 | #AGENTS+=('com.apple.CallHistoryPluginHelper') #Related to call history (iCloud) 305 | #AGENTS+=('com.apple.AOSPushRelay') # Related to iCloud https://github.com/fix-macosx/yosemite-phone-home/blob/master/icloud-user-r0/System/Library/PrivateFrameworks/AOSKit.framework/Versions/A/Helpers/AOSPushRelay.app/Contents/MacOS/AOSPushRelay/20141019T072634Z-auser-%5B172.16.174.146%5D:49560-%5B17.110.240.83%5D:443.log 306 | #AGENTS+=('com.apple.IMLoggingAgent') #IMFoundation.framework - Not sure about this one, maybe used to log in to computer on start 307 | #AGENTS+=('com.apple.geodMachServiceBridge') #Located in GeoServices.framework, related to locations maybe used for maps, maybe as well for things like find my mac, or just syping 308 | #AGENTS+=('com.apple.syncdefaultsd') ##Propably related to syncing keychain 309 | #AGENTS+=('com.apple.security.cloudkeychainproxy3') #Propably related to syncing keychain to icloud 310 | #AGENTS+=('com.apple.security.idskeychainsyncingproxy') #Most likely also related to keychain - IDSKeychainSyncingProxy.bundle 311 | #AGENTS+=('com.apple.security.keychain-circle-notification') #Related to keychain 312 | #AGENTS+=('com.apple.sharingd') #Airdrop, Remote Disks, Shared Directories, Handoff 313 | AGENTS+=('com.apple.appleseed.seedusaged') #Feedback assistant 314 | #AGENTS+=('com.apple.cloudd') #Related to sync data to iCloud, most likely used by iMessage,Mail,iCloud drive, etc... 315 | #AGENTS+=('com.apple.assistant') #Keychain 316 | AGENTS+=('com.apple.parentalcontrols.check') #Related to parental control 317 | AGENTS+=('com.apple.parsecd') #Used by spotlight and/or siri, propably some suggestions - CoreParsec.framework 318 | #AGENTS+=('com.apple.identityservicesd') #Used to auth some apps, as well used by iCloud 319 | #AGENTS+=('com.apple.bird') #Part of iCloud 320 | AGENTS+=('com.apple.rtcreportingd') #Related to Home Sharing, most likely it checks if device is auth for home sharing + Facetime 321 | AGENTS+=('com.apple.SafariCloudHistoryPushAgent') #Good one, sending out your browsing history... :) 322 | AGENTS+=('com.apple.safaridavclient') #Sending bookmarks to iCloud, even if you disable it may send your bookmarks to Apple 323 | AGENTS+=('com.apple.SafariNotificationAgent') #Notifications in Safari 324 | 325 | for agent in "${AGENTS[@]}" 326 | do 327 | sudo launchctl unload -w /System/Library/LaunchAgents/${agent}.plist >/dev/null 2>/dev/null 328 | #launchctl unload -w /System/Library/LaunchAgents/${agent}.plist >/dev/null 2>/dev/null 329 | echo -e "\t\- [\033[32m+\033[m] Disabled Agent: (${agent})" 330 | done 331 | 332 | for daemon in "${DAEMONS[@]}" 333 | do 334 | sudo launchctl unload -w /System/Library/LaunchDaemons/${daemon}.plist >/dev/null 2>/dev/null 335 | #launchctl unload -w /System/Library/LaunchDaemons/${daemon}.plist >/dev/null 2>/dev/null 336 | echo -e "\t\- [\033[32m+\033[m] Disabled Daemon: (${daemon})" 337 | done 338 | 339 | 340 | -------------------------------------------------------------------------------- /tests/ostemper-shellchecks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Wrapper around checkbashisms/shellcheck/whatever other shell checkers I can find 3 | # 4 | # Source: https://github.com/Winetricks/winetricks/blob/master/tests/shell-checks 5 | # 6 | # Copyright (C) 2016 Austin English 7 | # 8 | # This software comes with ABSOLUTELY NO WARRANTY. 9 | # 10 | # This is free software, placed under the terms of the GNU Lesser 11 | # Public License version 2.1 (or later), as published by the Free 12 | # Software Foundation. Please see the file COPYING for details. 13 | 14 | set -e 15 | set -x 16 | 17 | w_die() { 18 | echo "$* failed" 19 | exit 1 20 | } 21 | 22 | w_try() { 23 | "$@" 24 | status=$? 25 | if test $status -ne 0; then 26 | w_die "Note: command $* returned status $status. Aborting." 27 | fi 28 | } 29 | 30 | #command bashate --help > /dev/null || w_die "bashate must be installed!" 31 | command checkbashisms --help > /dev/null || w_die "checkbashisms must be installed!" 32 | command shellcheck --version > /dev/null || w_die "shellcheck must be installed!" 33 | 34 | # Different versions can give different results: 35 | 36 | #echo "======================== Begin bashate version info ===========================" 37 | ## bashate doesn't have a --version option (as of bashate-0.3.1) 38 | #bashate --version 39 | #echo "======================== End bashate version info ===========================" 40 | 41 | echo "======================== Begin checkbashisms version info ===========================" 42 | checkbashisms --version 43 | echo "======================== End checkbashisms version info ===========================" 44 | 45 | echo "======================== Begin shellcheck version info ===========================" 46 | shellcheck --version 47 | echo "======================== End shellcheck version info ===========================" 48 | 49 | # Use git ls-files if available, this prevents 'finding' scripts that aren't checked into git. 50 | # E.g., if patching foo fails, then foo.orig would also be 'found'. 51 | # The find fallback is for non git users, e.g., distros packaging winetricks or end users 52 | # running shell-checks from a tarball download. 53 | if [ -d .git ] ; then 54 | files_to_check="$(git ls-files | xargs file | grep -e 'POSIX shell script' | cut -d : -f1)" 55 | else 56 | files_to_check="$(find . -type f -exec file {} \; | grep -e 'POSIX shell script' | cut -d : -f1)" 57 | fi 58 | 59 | for shellscript in $files_to_check; do 60 | echo "Checking ${shellscript} for bashisms:" 61 | w_try checkbashisms --posix "${shellscript}" 62 | 63 | echo "Checking ${shellscript} with shellcheck:" 64 | w_try shellcheck -s sh "${shellscript}" 65 | 66 | #echo "Checking ${shellscript} with bashate:" 67 | # Can't ignore individual things for now, filed bug: 68 | # https://bugs.launchpad.net/bash8/+bug/1698088 69 | # E006=line length check 70 | # E010=do/while same line (in some perl in winetricks) 71 | #w_try bashate -i E006,E010 "${shellscript}" 72 | done --------------------------------------------------------------------------------