Your Private Network code · Part 5 — Family and Friends

Chapter 13 Access Rules in Plain English

4 blocks

The Building Blocks

#

Add to Admin console → Access controls (the tailnet policy file)

One section of the file.

"groups": {
  "group:adults": ["you@example.com", "partner@example.com"],
  "group:kids":   ["sam@example.com"]
}

#

Add to Admin console → Access controls (the tailnet policy file)

One section of the file.

"tagOwners": {
  "tag:home":  ["autogroup:admin"],
  "tag:media": ["autogroup:admin"],
  "tag:dns":   ["autogroup:admin"]
}

#

Add to Admin console → Access controls (the tailnet policy file)

One section of the file.

"hosts": {
  "printer":  "192.168.1.40",
  "home-lan": "192.168.1.0/24"
}

A Ready-Made Home Policy

#

File Admin console → Access controls (the tailnet policy file)

The whole file. Replace the email addresses, tags and addresses with your own.

{
  "groups": {
    "group:adults": ["you@example.com", "partner@example.com"],
    "group:kids":   ["sam@example.com"]
  },

  "tagOwners": {
    "tag:home":  ["autogroup:admin"],
    "tag:media": ["autogroup:admin"],
    "tag:dns":   ["autogroup:admin"]
  },

  "hosts": {
    "printer":  "192.168.1.40",
    "home-lan": "192.168.1.0/24"
  },

  "grants": [
    // Adults can reach everything, including the whole home network
    {"src": ["group:adults"], "dst": ["*"], "ip": ["*"]},

    // Everyone can reach their own devices
    {"src": ["autogroup:member"], "dst": ["autogroup:self"], "ip": ["*"]},

    // Everyone can use the Pi-hole for DNS
    {"src": ["autogroup:member"], "dst": ["tag:dns"],
     "ip": ["tcp:53", "udp:53"]},

    // Everyone can watch the media server
    {"src": ["autogroup:member"], "dst": ["tag:media"],
     "ip": ["tcp:8096"]},

    // Everyone can use the printer at home
    {"src": ["autogroup:member"], "dst": ["printer"], "ip": ["*"]},

    // Everyone can use an exit node
    {"src": ["autogroup:member"], "dst": ["autogroup:internet"],
     "ip": ["*"]}
  ],

  "tests": [
    {"src": "sam@example.com", "accept": ["printer:631"],
     "deny": ["192.168.1.1:443"]}
  ]
}

Reproduced exactly from Your Private Network, Chapter 13. The book explains what each line does and what to do when it doesn't work. About the book

Something here not working as the book describes? Tell the author.