Skip to content

Commit

Permalink
Add agent launchd instructions for OSX
Browse files Browse the repository at this point in the history
Signed-off-by: Dimitrios Karagiannis <[email protected]>
  • Loading branch information
alkar committed Sep 1, 2020
1 parent d001806 commit adaa62c
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Table of Contents
* [Install](#install)
* [Try](#try)
* [Running as systemd service](#running-as-systemd-service)
* [Running as launchd service (OSX)](#running-as-launchd-service-osx)
* [Run](#run)
* [Config](#config)
* [Dev aws config - Example](#dev-aws-config---example)
Expand Down Expand Up @@ -99,6 +100,34 @@ To look at it's logs:
journalctl -u wiresteward.service
```

### Running as launchd service (OSX)

An example working service for launchd is described in
[uk.co.uw.wiresteward.plist](./contrib/uk.co.uw.wiresteward.plist).

You need to copy the file under `/Library/LaunchDaemons/` and then set the
ownership to root:
```
chown root:admin /Library/LaunchDaemons/uk.co.uw.wiresteward.plist
```

Finally, you need to load the service:
```
sudo launchctl load /Library/LaunchDaemons/uk.co.uw.wiresteward.plist
```

This will allow the service to run as root, which is required to operate on the
network devices and routing table.

Logs are stored in `/var/log/wirestward.log` as defined in the service file. To
view the logs you can simply:
```
tail -f /var/log/wiresteward.log
```

You might want to setup log rotation as well if you find that the log file
grows too large.

### Run

The agent runs a local server on port 7773 and expects the user to visit
Expand Down
22 changes: 22 additions & 0 deletions contrib/uk.co.uw.wiresteward.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?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>Label</key>
<string>uk.co.uw.wiresteward</string>
<key>KeepAlive</key>
<true/>
<key>RunAtLoad</key>
<true/>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/wiresteward</string>
<string>-agent</string>
</array>

<key>StandardErrorPath</key>
<string>/var/log/wiresteward.err.log</string>
<key>StandardOutPath</key>
<string>/var/log/wiresteward.log</string>
</dict>
</plist>

0 comments on commit adaa62c

Please sign in to comment.