Convert Figma logo to code with AI

alichtman logostronghold

Easily configure macOS security settings from the terminal.

1,087
261
1,087
10

Top Related Projects

Guide to securing and improving privacy on macOS

Verify the configuration of your OS X machine.

macOS Security Compliance Project

13,197

Lynis - Security auditing tool for Linux, macOS, and UNIX-based systems. Assists with compliance testing (HIPAA/ISO27001/PCI DSS) and system hardening. Agentless, and installation optional.

Quick Overview

Stronghold is a security-focused command-line tool designed to harden macOS systems. It automates the process of configuring various security settings, firewall rules, and system preferences to enhance the overall security posture of a Mac computer.

Pros

  • Automates complex security configurations, saving time and reducing human error
  • Provides a comprehensive set of security hardening options tailored for macOS
  • Offers both interactive and non-interactive modes for flexibility in deployment
  • Regularly updated to address new security concerns and macOS features

Cons

  • Limited to macOS systems, not applicable for other operating systems
  • Some advanced users might prefer more granular control over individual settings
  • Potential for unintended consequences if not carefully reviewed before application
  • May conflict with certain software or user preferences if applied without consideration

Getting Started

To get started with Stronghold:

  1. Install Stronghold using Homebrew:

    brew install stronghold
    
  2. Run Stronghold in interactive mode:

    stronghold
    
  3. Follow the on-screen prompts to select and apply desired security configurations.

  4. For non-interactive mode (useful for scripting), use:

    stronghold --no-prompt
    

Note: It's recommended to review the changes and create a system backup before applying Stronghold's configurations.

Competitor Comparisons

Guide to securing and improving privacy on macOS

Pros of macOS-Security-and-Privacy-Guide

  • More comprehensive coverage of macOS security topics
  • Regularly updated with contributions from the community
  • Includes advanced topics like firmware passwords and FileVault

Cons of macOS-Security-and-Privacy-Guide

  • Requires manual implementation of security measures
  • May be overwhelming for beginners due to its extensive content
  • Lacks automation for applying security settings

Code Comparison

macOS-Security-and-Privacy-Guide:

# Example: Disable Captive Portal
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.captive.control Active -bool false

Stronghold:

# Example: Disable Captive Portal
if prompt_yes_no("Disable Captive Portal?"):
    sudo_write_key("/Library/Preferences/SystemConfiguration/com.apple.captive.control", "Active", "-bool false")

The macOS-Security-and-Privacy-Guide provides manual commands, while Stronghold offers an interactive Python script to apply security settings.

Stronghold focuses on automating security configurations for macOS, making it more user-friendly for those who prefer a guided approach. However, it may not cover as many advanced topics as the macOS-Security-and-Privacy-Guide.

Both repositories aim to enhance macOS security, but they cater to different user preferences and expertise levels.

Verify the configuration of your OS X machine.

Pros of osx-config-check

  • More comprehensive checks for system configuration and security settings
  • Provides detailed explanations for each check and its importance
  • Offers remediation steps for failed checks

Cons of osx-config-check

  • Less user-friendly interface compared to Stronghold
  • Requires more manual intervention to implement fixes
  • Not actively maintained (last update in 2018)

Code Comparison

osx-config-check:

def check_firewall_enabled():
    """Check if the firewall is enabled."""
    command = ['defaults', 'read', '/Library/Preferences/com.apple.alf', 'globalstate']
    output = subprocess.check_output(command).strip()
    return int(output) != 0

Stronghold:

def firewall_enable():
    """Enable firewall."""
    if not prompt_yes_no("Do you want to enable your firewall?"):
        return
    sp.run(['sudo', '/usr/libexec/ApplicationFirewall/socketfilterfw', '--setglobalstate', 'on'], stdout=sp.PIPE, stderr=sp.PIPE)
    print_success("Enabled firewall.")

Both projects aim to enhance macOS security, but they take different approaches. osx-config-check focuses on comprehensive checks and detailed reporting, while Stronghold provides a more user-friendly interface with automated fixes. The code comparison shows that osx-config-check checks the firewall status, while Stronghold actively enables it with user consent.

macOS Security Compliance Project

Pros of macos_security

  • Comprehensive and detailed security guidelines based on NIST standards
  • Regularly updated to align with the latest macOS versions and security best practices
  • Provides in-depth explanations and rationale for each security recommendation

Cons of macos_security

  • Requires manual implementation of security measures
  • Less user-friendly for non-technical users
  • Lacks automation tools for applying security configurations

Code Comparison

macos_security (shell script excerpt):

# Enable FileVault
sudo fdesetup enable

# Enable Gatekeeper
sudo spctl --master-enable

Stronghold (Python script excerpt):

def enable_filevault():
    os.system("sudo fdesetup enable")

def enable_gatekeeper():
    os.system("sudo spctl --master-enable")

Both repositories aim to enhance macOS security, but they differ in their approach. macos_security provides a comprehensive guide with detailed explanations, while Stronghold offers an automated tool for applying security configurations. The code comparison shows that both projects use similar system commands to enable security features, but Stronghold wraps them in Python functions for easier integration and automation.

13,197

Lynis - Security auditing tool for Linux, macOS, and UNIX-based systems. Assists with compliance testing (HIPAA/ISO27001/PCI DSS) and system hardening. Agentless, and installation optional.

Pros of Lynis

  • More comprehensive security auditing tool, covering a wider range of systems and configurations
  • Actively maintained with regular updates and a large community
  • Supports multiple operating systems, including Linux, macOS, and Unix-like systems

Cons of Lynis

  • Requires more technical expertise to interpret and act on results
  • Can be overwhelming for beginners due to its extensive feature set
  • May require root access for full functionality, which can be a security concern

Code Comparison

Stronghold (Python):

def prompt_yes_no(question):
    valid = {"yes": True, "y": True, "ye": True, "no": False, "n": False}
    while True:
        choice = input(question + " (y/n): ").lower()
        if choice in valid:
            return valid[choice]
        else:
            print("Please respond with 'yes' or 'no' (or 'y' or 'n').")

Lynis (Bash):

# Function to ask a yes/no question
ask_question()
{
    QUESTION=$1
    DEFAULT=$2
    if [ "${DEFAULT}" = "Y" ]; then
        OPTIONS="[Y/n]"
        DEFAULT="Y"
    else
        OPTIONS="[y/N]"
        DEFAULT="N"
    fi
}

Both projects aim to enhance system security, but Lynis offers a more comprehensive approach suitable for advanced users and enterprise environments, while Stronghold focuses on macOS hardening with a more user-friendly interface.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

stronghold logo

Downloads

stronghold is the easiest way to securely configure your Mac.

GIF demo

Designed for macOS Sierra and High Sierra. Not yet tested on macOS Mojave, but I'm working on updating it!

Usage

Usage: stronghold.py [OPTIONS]

  Securely configure your Mac.
  Developed by Aaron Lichtman -> (Github: alichtman)


Options:
  -lockdown  Set secure configuration without user interaction.
  -v         Display version and author information and exit.
  -help, -h  Show this message and exit.

Installation Options

  1. Install with pip

    • $ pip install stronghold
    • $ stronghold
  2. Download the stronghold binary from Releases tab.

Configuration Options

  1. Firewall

    • Turn on Firewall?
      • This helps protect your Mac from being attacked over the internet.
    • Turn on logging?
      • If there IS an infection, logs are useful for determining the source.
    • Turn on stealth mode?
      • Your Mac will not respond to ICMP ping requests or connection attempts from closed TCP and UDP networks.
  2. General System Protection

    • Enable Gatekeeper?
      • Defend against malware by enforcing code signing and verifying downloaded applications before allowing them to run.
    • Prevent automatic software whitelisting?
      • Both built-in and downloaded software will require user approval for whitelisting.
    • Disable Captive Portal Assistant and force login through browser on untrusted networks?
      • Captive Portal Assistant could be triggered and direct you to a malicious site WITHOUT any user interaction.
  3. User Metadata Storage

    • Clear language modeling metadata?
      • This includes user spelling, typing and suggestion data.
    • Disable language modeling data collection?
    • Clear QuickLook metadata?
    • Clear Downloads metadata?
    • Disable metadata collection from Downloads?
    • Clear SiriAnalytics database?
  4. User Safety

    • Lock Mac as soon as screen saver starts?
    • Display all file extensions?
      • This prevents malware from disguising itself as another file type.
    • Disable saving documents to the cloud by default?
      • This prevents sensitive documents from being unintentionally stored on the cloud.
    • Show hidden files in Finder?
      • This lets you see all files on the system without having to use the terminal.
    • Disable printer sharing?
      • Offers redundancy in case the Firewall was not configured.

How to Contribute

  1. Clone repo and create a new branch: $ git checkout https://github.com/alichtman/stronghold -b name_for_new_branch.
  2. Make changes and test
  3. Submit Pull Request with comprehensive description of changes

Acknowledgements

Donations

This is free, open-source software. If you'd like to support the development of future projects, or say thanks for this one, you can donate BTC at 1FnJ8hRRNUtUavngswUD21dsFNezYLX5y9.