Skip to content

Instantly share code, notes, and snippets.

@axsddlr
Last active May 5, 2018 07:26
Show Gist options
  • Save axsddlr/7ab73d2b14e760f4842d248d1d4fe7e5 to your computer and use it in GitHub Desktop.
Save axsddlr/7ab73d2b14e760f4842d248d1d4fe7e5 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Flush out the list before we begin
ipfw -q -f flush
# Set rules command prefix
cmd="ipfw -q add"
vpn="tun0"
# allow all local traffic on the loopback interface
$cmd 00001 allow all from any to any via lo0
# allow any connection to/from VPN interface
$cmd 00010 allow all from any to any via $vpn
# allow connection to/from LAN by Transmission
$cmd 00101 allow all from me to 192.168.1.1/24 uid deluge
$cmd 00102 allow all from 192.168.1.1/24 to me uid deluge
# deny any Transmission connection outside LAN that does not use VPN
$cmd 00103 deny all from any to any uid deluge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment