Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
brsnik authored May 13, 2022
1 parent cee679c commit 909c350
Showing 1 changed file with 38 additions and 2 deletions.
40 changes: 38 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,41 @@
# Dynamic DNS in Firewall

Allow traffic from a Dynamic DNS Domain with a Dynamic IP Address
Automatically set traffic rules from a Dynamic DNS Domain with Dynamic IP Addresses

> Currently only works with `UFW`, but could be easily adapted to `IPTABLES`. Feel free to contribute!
## How it works

Allows traffic from IPv4 and optionally IPv6 addesses for a given domain.

```
$ ufw status
22 ALLOW IN 1111:1:1::1 # SSH from Dynamic IP (one.dynamic.dns.domain.tld)
22 ALLOW IN 2.2.2.2 # SSH from Dynamic IP (two.dynamic.dns.domain.tld)
22 ALLOW IN 2222:2:2::2 # SSH from Dynamic IP (two.dynamic.dns.domain.tld)
```

Multiple addresses supported per domain!

As well as domains supported! Add as many Dynamic DNS domains as you want!

Firewall rules for addresses no longer in the DNS records are removed.

## Required packages
- ufw
- dig
- grep
- awk

## "Install"/Schedule Cron

1. Download the latest release
2. Copy to your desired location—for this example we will use `/var/cron`
3. Run it to make sure it works without any errors `bash /var/cron/dynamic-dns-in-ufw.sh`
4. Then enter crontab `$ sudo vim /etc/crontab`
5. To the end of the line add one of the following:
- To run every hour add `0 * * * * root /var/cron/dynamic-dns-in-ufw.sh`
- Or for every half hour add `*/30 * * * * root /var/cron/dynamic-dns-in-ufw.sh`
6. Save and exit vim `:wq`


Currently only works with UFW, but could be easily adapted to IPTABLES. Feel free to contribute!

0 comments on commit 909c350

Please sign in to comment.