Overview
The Apple Hardening Policy applies security hardening on managed Macs, through the Swif agent. It has three settings, each based on a CIS macOS Benchmark recommendation:
Setting | What it does | CIS macOS Benchmark |
Remove World-Writable Permissions from Applications | Stops standard users and malware from changing apps installed in | 5.1.5 |
Set Install Log Retention | Keeps the install log for a set number of days, so you have a record of software installs and updates when investigating an incident | 3.3 |
Secure Home Folders | Stops other users on the Mac from seeing what's in each user's home folder | 5.1.1 |
All three are off by default.
Important: Removing the policy undoes only some changes. The Swif agent changes the Mac directly, not through a configuration profile. If you remove the policy, app permissions and the install log settings stay as the policy left them.
Secure Home Folders is different: its changes are put back about 10–12 minutes after the policy is removed.
Requirements
Item | Details |
Platform | macOS 12 or later |
Device ownership | Company-owned and BYOD. All settings apply the same way on BYOD Macs. |
Swif agent | Version 1.358.0 or later. Secure Home Folders needs 1.363.0 or later. |
To check the agent version on a Mac, run:
/usr/local/swifteam/swifteam -version
Settings reference
Setting | What it does | Default | Range |
Remove World-Writable Permissions from Applications | Removes write access for other users from apps in | Off | — |
Set Install Log Retention | Sets how long macOS keeps the install log, and removes Apple's size limit on it | Off | — |
Keep install.log for (days) | How many days to keep install log entries. Shown when Set Install Log Retention is on. | 365 | 1–3,650 |
Secure Home Folders | Stops other users from seeing what's in each user's home folder in | Off | — |
Home Folder Permissions |
|
| — |
Excluded Accounts | Accounts whose home folders the agent leaves as they are. Shown when Secure Home Folders is on. | Empty | Up to 100 |
Remove World-Writable Permissions from Applications
Some apps install with permissions that let any user on the Mac change them. A standard user, or malware running as that user, could then tamper with the app. When this setting is on:
The Swif agent finds apps in
/Applicationsthat any user can write to, and removes write access for other users only. The app's owner and group keep their access.Apps in subfolders are covered too, such as
/Applications/Utilities, vendor folders, and apps inside other apps.Apps outside
/Applications, such as~/Applications, aren't covered.Changes happen within about a minute. The agent checks again every hour, so apps installed or updated later are covered too.
Apps that update themselves. An app a user copied into /Applications can still be updated by that user. But an app that relied on any user being able to write to it, to update itself, may now ask for an administrator.
Removing the policy doesn't restore the old permissions.
Set Install Log Retention
The install log, /var/log/install.log, records software installs and updates. When this setting is on, the Swif agent:
sets how many days macOS keeps install log entries, using Keep install.log for (days)
removes Apple's total size limit on the log, which otherwise deletes the oldest entries first
sets the log to rotate in UTC, which matches the macOS Security Compliance Project (mSCP) fix
CIS recommends keeping the install log for at least 365 days.
If a macOS update changes these settings back, the agent sets them again within about a minute. A major macOS upgrade can start a new install log, so entries from before the upgrade may not be kept.
Removing the policy doesn't restore Apple's settings.
Secure Home Folders
By default, other users on a Mac can see what's in each user's home folder. When this setting is on:
The Swif agent changes the permissions of each home folder in
/Users, so other users can't see what's in it. It changes only the home folder itself, never the files and folders inside it.It skips
Shared,Guest, and any Excluded Accounts.It makes
Deleted Users, where macOS keeps the home folders of deleted accounts, open to root only.Changes apply within about a minute. If someone changes the permissions by hand, the agent sets them back at its next hourly check.
This also helps meet the FDC-1 control in the Compliance Center.
Home Folder Permissions
Value | Shows as | Other users can… | Use when |
|
| Not see what's in a home folder, but still open its Public folder, put files in its Drop Box, and reach Public through File Sharing. They can also open a file whose name they know, if that file's own permissions allow it. | Users share files through Public or Drop Box |
|
| Not open anything in a home folder, including Public and Drop Box | You want the strictest setting |
Both meet CIS 5.1.1. macOS's built-in protection that stops home folders from being deleted is kept with either value.
Excluded Accounts
Use this for accounts whose home folders others need, such as a service account whose files another account uses. An entry matches an account's short name, or a folder name in /Users, and ignores case.
What can be affected
Before turning this on, check for anything that reads another user's home folder, such as:
file sharing, and the Public and Drop Box folders (with
700)developer tools that share files between accounts
backup agents that run as a different user
Turning it off
Turning off Secure Home Folders, removing the policy, or adding an account to Excluded Accounts puts back the permissions the agent changed. Each folder goes back to the permissions it had right before the agent's last change, unless someone changed them since. After the policy is removed, this takes about 10–12 minutes.
Other hardening settings
The CIS hardening settings that aren't in this policy are in these policies instead:
Setting | Policy |
Force Automatic Date and Time, and Time Server | |
Secure Keyboard Entry in Terminal | |
System Folder Permission Tracking, and Clock Drift Tracking (report only) | |
System Integrity Protection (SIP) status | The SIP-1 control in the Compliance Center |
What happens when a policy is removed
Changes go away | Changes are put back | Changes stay |
Force Automatic Date and Time, Secure Keyboard Entry | Secure Home Folders, after about 10–12 minutes | App permissions, install log retention, Time Server |
Before you start
Check the agent version on your Macs: 1.358.0 or later, or 1.363.0 or later for Secure Home Folders.
Find apps that update themselves. After world-writable permissions are removed, they may need an administrator to update.
Check what reads other users' home folders, before turning on Secure Home Folders. Add any accounts that need access to Excluded Accounts.
Choose a pilot group of Macs.
Create the policy
In Swif, go to Device Management > Policies, then select Create new policy > Configure a Policy.
Select Apple Hardening Policy.
Enter a clear name, such as
Mac Hardening – CIS.Turn on the settings you want, and set their options.
Save the policy.
Assign it to your pilot group first.
Example configurations
Example 1: CIS baseline for all company Macs
Setting | Value |
Remove World-Writable Permissions from Applications | On |
Set Install Log Retention | On |
Keep install.log for (days) | 365 |
Secure Home Folders | On |
Home Folder Permissions |
|
Meets CIS 3.3, 5.1.1, and 5.1.5. Users can still share files through Public and Drop Box.
Example 2: Longer log retention for regulated teams
Setting | Value |
Set Install Log Retention | On |
Keep install.log for (days) | 730 |
Keeps two years of install history for audits.
Example 3: Strict home folders with a service account
Setting | Value |
Secure Home Folders | On |
Home Folder Permissions |
|
Excluded Accounts |
|
Other users can't open anything in a home folder, except the buildagent service account's, which another account uses.
Verify the policy
Run these in Terminal on the Mac.
World-writable app permissions. This should return 0:
find /Applications -iname "*.app" -type d -perm -2 | wc -l
This is the same check mSCP uses for CIS 5.1.5.
Install log retention. The line should end with ttl= and your number of days, with no all_max:
grep '^\* file' /etc/asl/com.apple.install
To confirm macOS is using it, this should show TTL = and your number of days:
sudo aslmanager -dd 2>&1 | sed -n '/Processing module com.apple.install/,/Finished/p' | grep TTL
Home folders. Home folders should show drwx--x--x for 711, or drwx------ for 700:
ls -ld /Users/*/
Shared, Guest, and excluded accounts keep their own permissions.
Run the checks right away. The agent applies changes within about a minute. To make it check now:
sudo launchctl kickstart -k system/com.swifteam.swifteam
In Swif, open the device and confirm that the policy shows as applied.
Troubleshooting
A setting didn't apply
Check the agent version: 1.358.0 or later, or 1.363.0 or later for Secure Home Folders.
Check the agent log:
sudo grep '\[Hardening' /var/log/swifteam.log | tail
For Secure Home Folders:
sudo grep 'home folder' /var/log/swifteam.log | tail
An app asks for an administrator to install updates
This is expected after world-writable permissions are removed. The app could previously update itself because any user could write to it. Update the app through Swif, or have an administrator approve the update.
The find command still lists an app
Wait about a minute, or run the checks right away, as in Verify the policy.
Check that the app is in
/Applicationsor one of its subfolders. Apps elsewhere, such as~/Applications, aren't covered.
Install log entries from before an upgrade are missing
A major macOS upgrade can start a new install log. Entries from before the upgrade may not be kept.
A user can't open files someone shared in their home folder
Secure Home Folders is on. With 700, other users can't open anything in a home folder, including Public and Drop Box. Switch to 711, add the account to Excluded Accounts, or share files through /Users/Shared.
A service account or backup tool can't reach another account's files
Add the account whose home folder it needs to Excluded Accounts. The agent puts back that folder's permissions, unless someone changed them since.
A network home folder wasn't changed
This is expected. Secure Home Folders covers only home folders in /Users.
Settings didn't change back after I removed the policy
This is expected for app permissions and install log settings. Removing the policy doesn't restore them. Home folder permissions are put back about 10–12 minutes after the policy is removed, unless someone changed them since.