blackice

Introduction

blackice is an application firewall for macOS, run from the command line. It sees every new outbound connection, from any app, and treats it by mode:

  • accept-all lets everything through and logs it.
  • ask holds a connection that no rule covers until you or an agent answers. No answer in time means it is dropped.
  • block-all lets through only what your rules allow.

blackice 1.0.7 has run on one Mac, with macOS 27.0.1; macOS 14 and 15 are not tested yet. A blackice.toml that works in 1.0 keeps working in every 1.x.

Install has the steps.

Ask mode

appextensiondaemonhook: fxconnect example.com:443no rule matches: pauseevent over XPCrun hook with the eventagent decideslast line: approve 1hanswer + tokenresume: allowconnection proceedsor, with no answer in N secondsdropped
Figure 1Ask mode. A connection no rule covers waits while the hook asks an agent, which ends its reply with approve 1h or deny. With no answer before the timeout, the connection is dropped.

Rules, the built-in list of macOS services and current approvals are checked first, so only new destinations wait. You answer with blackice approve or blackice deny, or from the menu bar, with Touch ID. An agent answers through a hook: the daemon runs it and reads its last line, approve 1h or deny. An approval covers one app and one host, and expires. A deny is remembered for 10 minutes.

The parts

appsbrowsers, agentsBlackice.appmenu bar, in /Applicationsnetwork extensionrules, approvals, paused flowsblackice CLIstart, mode, approve, pendingflowsblackice daemonLaunchAgent, runs hooksblackice.tomlmode, hooks, ruleshook: fxthe agent decideseventsanswerlast lineXPC, Touch ID
Figure 2The parts. The extension is the only part that allows or drops a connection. The daemon runs the hooks and passes their answers on. A person answers through the CLI or the menu bar, with Touch ID.
  • Blackice.app, in /Applications, holds the network extension and the blackice command, which is also the menu bar app.
  • The extension sees each new connection, and allows, holds or drops it.
  • The daemon runs the hooks, as a LaunchAgent for your user. It takes them from the configuration saved with Touch ID, never from a file, and answers with the event's one-time token, which the hook never sees.

Limits

  • Any program running as you can steer a hook: rewrite the event file while the agent reads it, or the rules and sign-in in the agent's home, and so get its own connection approved. An approval still covers only the event's app and host, for at most 24 hours.
  • Host and app names come from whoever opens the connection, and they reach the agent's prompt. The only answers taken are deny and approve with a duration, for the event's app and host.
  • A program running as you can stop the daemon. Connections then wait and are dropped at their timeout.
  • A tool that connects to an address, such as curl, fails on its first try when the answer takes longer than the server waits, and gets through on the retry. Apps that connect by name wait for the answer.
  • A run hook's program is not checked. A program hook starts only when its signature matches, and with SIP off macOS does not check that before it runs.

edit this page