Giter Club home page Giter Club logo

osxlockdown's Introduction

Project deprecated

This project is no longer being maintained. Please consider using https://github.com/kristovatlas/osx-config-check

osxlockdown

osxlockdown was built to audit, and remediate, security configuration settings on OS X 10.11 (El Capitan).

This checks, and if requested will flip, various configuration settings. Many are simply stripping out features to reduce the attack surface. You may not like this. This is a compilation of numerous resources listed in the Resources section which could be converted to bash scripts. This is different than those resources in that instead of requiring the user to read a 100+ page doc, click through numerous GUIs, and try to decide if some esoteric output is good or bad, this tool combines all the steps into a single command. This tool is focused on enterprise deployments of OSX with regard to what it does, but made to be usable for stand-alone home users as well.

Warning: Many of the rules disable functionality in the name of security. This may make you sad.

Warning: System commands and dark arts are involved, so ensure you have your system backed up first. No problems have been reported so far though.

Getting osxlockdown

You can build osxlockdown with Go, by cloning this repo and running go build osxlockdown

You can download releases at https://github.com/SummitRoute/osxlockdown/releases

Usage

Run sudo ./osxlockdown to check security settings. Run sudo ./osxlockdown --remediate to fix them.

The commands.yaml file may be edited to disable certain rules by setting enabled to false.

Available command-line options:

  • --remediate: Apply fixes to the problems found. By default the tool only audits for problems.
  • --hide_summary: Hides the summary output the end.
  • --hide_passes: Only show issues that failed the audit.
  • --commands_file <filename>: Change the location of the commands file instead of the default commands.yaml in the current directory.

Sample output

$ sudo ./osxlockdown
[PASSED] Verify all application software is current
[PASSED] Enable Auto Update
[PASSED] Disable Bluetooth
[PASSED] Disable infrared receiver
[PASSED] Disable AirDrop
[PASSED] Set time and date automatically
[PASSED] Set an inactivity interval of 10 minutes or less for the screen saver
[PASSED] Enable secure screen saver corners
[PASSED] Require a password to wake the computer from sleep or screen saver
[PASSED] Ensure screen locks immediately when requested
[PASSED] Disable Remote Apple Events
[PASSED] Disable Remote Login
[PASSED] Disable Internet Sharing
[PASSED] Disable Screen Sharing
[PASSED] Disable Printer Sharing
[PASSED] Disable Wake on Network Access
[PASSED] Disable File Sharing
[PASSED] Disable Remote Management
[PASSED] Enable FileVault
[PASSED] Destroy File Vault Key when going to standby
[PASSED] Enable hibernation mode (no memory power on sleep)
[PASSED] Enable Gatekeeper
[PASSED] Enable Firewall
[PASSED] Enable Firewall Stealth Mode
[PASSED] Disable signed apps from being auto-permitted to listen through firewall
[PASSED] Disable iCloud drive
[PASSED] Require an administrator password to access system-wide preferences
[PASSED] Disable IPv6
[PASSED] Disable Previews
[PASSED] Secure Safari by crippling it
-------------------------------------------------------------------------------
osxlockdown 0.9
Date: 2016-01-02T13:01:11-08:00
SerialNumber: C02XXXXXXXXX
HardwareUUID: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
Final Score 100%: Pass rate: 30/30

Resources

This project pulled from numerous resources including:

Limitations

  • File Vault (full disk encryption) is tested for, but can not be remediated because user involvement is required to write down the recovery key.
  • Rules related to creating audit logs have not been created.

FAQ

  • Why isn't this just a bash script, or python code? Why would anyone write a Go wrapper around bash scripts within a yaml file? Why isn't this an ansible|puppet script?
    • This seemed like the cleanest solution for my needs.
  • I locked myself out. What now?
    • An earlier release of osxlockdown set a flag to lock users out if they entered an incorrect password more than 5 times on login. This is not good for single-user systems and I have since removed the password related policy rule. To remove all password related policies you can run pwpolicy clearaccountpolicies. To gain access again, follow the instructions here: https://support.apple.com/en-us/HT203114

FAQ for specific features

  • Why are you disabling X?
    • osxlockdown minimizes the features of the OS as much as possible, with the expectation that this will reduce it's attack's surface. If it's not needed, throw it out. Some people will not like some of the features I disable.
  • Why aren't you checking for X?
    • I might not know about it, so check the issues if it's been mentioned. However, it might also be too application specific, or might be a non-default setting. Some attempts have been made to check for things that a user likely would never enable anyway, but if they did would make the system insecure. However, it is impossible to check all such possibilities, and this is in general not my goal. Also, some security auditing requires manual review, such as what apps should have firewall exceptions, or permissions on files and folders. For such auditing, no rules have been created.
  • Why are you disabling IPv6?
    • The NSA, DISA, and Apple themselves all recommend disabling IPv6 for maximum security. In Apple's security guide, they state "If your organization’s network cannot use or does not require IPv6, turn it off." Apple and the NSA's guidance are for 10.6 (from 2009) so perhaps this was fear at the time that it was too new. However, again, my goal is to reduce the attack surface, and IPv4 works everywhere whereas IPv6 may not. Also, some firewalls and user/developer assumptions were only made for IPv4.
  • Why are you crippling Safari?
    • I personally run Chrome and I cripple it in the same way I am crippling Safari here. I do believe Chrome is more secure though. One reason is they build most of the main components Safari is made from anyway, so they have more expertise with it. Another reason is they have discovered more security problems than Safari's team has, for example, they detected Diginotar had been compromised and had issued a certificate to MiTM users.

osxlockdown's People

Contributors

0xdabbad00 avatar astrostl avatar filipecatraia avatar matteocng avatar mngmntt avatar phlogi avatar vivami avatar yugoslavskiy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

osxlockdown's Issues

uninstall/adjust time before lockdown

Hello,

Thanks for your work on this great tool. I like all the options it selects, however, I really want to lengthen the time for locking out my account. I am starting to tire of having to login with my password so frequently after being away from my computer for short amounts of time. I have turned off all options that appear to be related to screen saver, or locking the screen immediately, but I am just not experienced enough to figure out where to look to adjust this, or if I can adjust this option.

Also, I am wondering if there is a way to uninstall this program to turn all the options it changed back to normal?

Thank you for your time.

Logging verbiage, and loggingenabled is on by default, so...

Hello, the state of a vanilla 10.11.5 image is that, in /Library/Preferences/com.apple.alf (which I think the description should say is for the firewall and not y'know asl and all logging on the system) loggingenabled is already is integer 1... not sure why you're checking for it besides general hygiene checkup I guess?

Disable access to /Library/Internet Plug-Ins/

To prevent Java, Silverlight or other shit from being injected into Safari/Firefox/Chrome/whatever browser, it would be nice to simply wipe and lock read/write access the /Library/Internet Plug-Ins/ directory

Check Sparkle updater

Sparkle is used by many third-party apps. It should never use HTTP. Check for that. Should be possible using:

for i in /Applications/*/Contents/Info.plist; do defaults read "$i" SUFeedURL 2>/dev/null; done

Why is Safari considered to be insecure?

"osxlockdown was built to audit, and remediate, security configuration settings on OS X"

As per commands.json, "I 'secure' safari by removing javascript and PDF support. Advanced users won't use Safari anyway and novices will be persuaded to use Chrome or Firefox"

What is insecure about Safari? I'd note that, unlike third-party browsers, updates to it are applied along with general system updates, which are automatically enabled by osxlockdown itself. If I'm using Firefox or Chrome, the app needs to run to update, meaning there's a necessary out-of-date window.

Your project, your rules. I do consider myself an "advanced" user, though, and I use Safari :P

Questioning password strength checks

As per #6 , is tr even necessary?

Mostly, though, writing to express doubt about the checks. As per the pwpolicy man page, "maxFailedLoginAttempts" intructs that "user's account is disabled if the failed login count exceeds this number." Is this safe on single-user systems? Not inspired to test.

Further, things like numbers, caps, and symbols don't do much to move the needle on entropy, but sure make things harder to remember and type. https://xkcd.com/936/ is a famous pop example of this, and https://en.wikipedia.org/wiki/Diceware is a nice implementation.

Verify all application error

Hello,

I run OLD and it reports
[FAILED] Verify all application software is current

but if I run softwareupdate --list
it reports "No new software available."

The grep reports this
LastSuccessfulDate = "2016-01-27 10:50:35 +0000";

I am using El Capitan OS X French, all updates applied.

Thank you.

Use YAML instead of JSON

In order to allow people to copy/paste commands, we need a format that doesn't require quotes to be escaped. TOML should allow that.

Set time and date automatically

Hey,

I'm not sure how this is helpful. It's just another data point for Apple, since your computer will be periodically talking to them. It sounds the opposite of reducing attack surface. What am I missing here?

(Love osxlockdown, though. Thanks a bunch!)

Implement remediation on individual checks

What about an implementation to flick the switch for individual checks instead of all at once? Something like:

./osxlockdown --remediate 12

To switch the 12th check?

[FAILED] Disable File Sharing with WINS server defined

The check for File Sharing fails if a WINS server is defined by a DHCP server. Disabling network interfaces then running osxlockdown returns a success.

grep -i array /Library/Preferences/SystemConfiguration/com.apple.smb.server.plist
    <array>
    </array>

A copy of the com.apple.smb.server.plist is below:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>DOSCodePage</key>
    <string>437</string>
    <key>LocalKerberosRealm</key>
    <string>snipped</string>
    <key>NetBIOSName</key>
    <string>MACBOOKPRO</string>
    <key>ServerDescription</key>
    <string>MacBook Pro</string>
    <key>WINSServerAddressList</key>
    <array>
        <string>10.20.0.1</string>
    </array>
</dict>
</plist>


osquery pack

Hey there, I made a pack to use osquery when performing the checks instead of all of the defaults reads. Wondering if it would be something you're interested in hosting, I could give it another once-over and send a PR.
(Nice work on Downclimb, btw.)

[FAILED] Require an administrator password to access system-wide preferences

As per the latest JSON, remediation is done via

"fix_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",

this command appears to be bogus with a standard user or sudo, yielding

YES (0)
Unrecognized Command

and failing subsequent checks.

Check for screen sharing possibly broken

When I enable screen sharing in my system preferences, I still get this:

$ launchctl load /System/Library/LaunchDaemons/com.apple.screensharing.plist
/System/Library/LaunchDaemons/com.apple.screensharing.plist: Service is disabled

System details: OS X El Capitan 10.11.5

"Disable signed apps from being auto-permitted to listen through firewall" -- broken

On my machine, some (all?) settings written with or without sudo to /Library/Preferences/com.apple.* are overwritten when I logout and log back in.

Consequently this fix doesn't stick for me:
defaults write /Library/Preferences/com.apple.alf allowsignedenabled -bool false

The solution is to write it only for the current user:
defaults write ~/Library/Preferences/com.apple.alf allowsignedenabled -bool false

Disable Internet Sharing -- check command might be broken but fix works

I verified on my El Capitan machine that the following fix in the YAML works:
defaults write /Library/Preferences/SystemConfiguration/com.apple.nat NAT -dict-add Enabled -bool false

However, the check command seems broken. I allowed internet sharing on one of my networking interfaces, and the /Library/Preferences/SystemConfiguration/com.apple.nat file doesn't exist. (Maybe it would if I re-logged or rebooted.)

I recommend just performing the defaults read portion of the check.

Disable iCloud Drive

iCloud Drive is disabled on my Mac, but your program says what it's enabled
2016-01-01 20 31 56
Or how I should disable it?

FEATURE: separate config file for enable/disable of individual checks

For those of us that like to keep in sync with the mothership, setting enabled to true or false within the commands.json (soon to be commands.toml?) file will require a local merge every time a pull is executed. If this were done in a separate file, one could keep that independent and pull at will.

can't update some 3rd-party apps

I can't update applications like malwarebytes or other 3rd party apps that have internal updates. Which setting needs to be reversed to make that possible again?

FileVault / Hibernation Configuration

Hi,

As your script seems to be more "aggressive" than conservative (not saying this as a negative, quite the opposite), would you consider verifying hibernation modes and FileVault key destruction on sleep with pmset and configuring the following?

Hibernatemode to 25
Destroyfvkeysonstandby to 1

Thanks!

Uninstall

Is there a Undo / Uninstall Option?

Thanks

DisableAirDrop does not exist

On 10.11.5 DisableAirDrop fails:

$ sudo defaults read com.apple.NetworkBrowser DisableAirDrop | grep 1
Password:
2016-05-18 09:28:12.188 defaults[4266:54118] 
The domain/default pair of (com.apple.NetworkBrowser, DisableAirDrop) does not exist

Any thoughts?

Check for CVE-2016-0777 (SSH "No Roaming")

Apple still has not updated SSH, so check the version and additionally check for "No Roaming". On failure add the following to the /etc/ssh/ssh_config under the Host * section:

# Fixing CVE-2016-0777
UseRoaming no

"Disable Screen Sharing" -- broken

The check command for this produces a false negative. I tested this by enabling screen sharing in System Preferences and running the following:

$ launchctl load /System/Library/LaunchDaemons/com.apple.screensharing.plist
/System/Library/LaunchDaemons/com.apple.screensharing.plist: Service is disabled

unloading this with launchctl appears to successfully stop the service, but only works for me when run with sudo privs.

Disable AirDrop always Failed

Hello,

Though in the Finder, AD appears or not in the GO menu. (Quit Finder and Relaunch each time)
The read command returns 1 or 0 if I try to change it manually.

No matter what I do, it is always FAILED.

Thanks

Detect common Computer Name and change it if necessary

Hello,

Apple commonly use your computer model and session name (like "Macbook's of Thea" or "iMac's of Oliver") to propagate itself in the network and this is bad for privacy.

To remediate this, you could make a regexp to detect this common name and replace it with randomized alphanumeric characters from /dev/random.

enable/disable special logging types

just for discussion.. does it make sense to enable/disable such unknown logs?

In this case your download log?
sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'select LSQuarantineDataURLString from LSQuarantineEvent'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.