{"id":26167411,"url":"https://github.com/ipitio/closure","last_synced_at":"2026-04-14T06:02:48.034Z","repository":{"id":281831266,"uuid":"946578859","full_name":"ipitio/closure","owner":"ipitio","description":"Provision a WireGuard access point, with Pi-hole and Unbound in Docker","archived":false,"fork":false,"pushed_at":"2025-07-20T00:16:38.000Z","size":179,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-20T00:54:48.632Z","etag":null,"topics":["bash","debian","docker","hostapd","isc-dhcp-server","jellyfin","kodi","netplan","pi-hole","unbound","wireguard"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ipitio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-03-11T11:07:10.000Z","updated_at":"2025-07-20T00:14:31.000Z","dependencies_parsed_at":"2025-04-10T11:33:26.268Z","dependency_job_id":"b2d77dac-010e-45f9-a160-2b8b76e1e143","html_url":"https://github.com/ipitio/closure","commit_stats":null,"previous_names":["ipitio/closure"],"tags_count":47,"template":false,"template_full_name":null,"purl":"pkg:github/ipitio/closure","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipitio%2Fclosure","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipitio%2Fclosure/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipitio%2Fclosure/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipitio%2Fclosure/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ipitio","download_url":"https://codeload.github.com/ipitio/closure/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipitio%2Fclosure/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28021576,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-25T02:00:05.988Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash","debian","docker","hostapd","isc-dhcp-server","jellyfin","kodi","netplan","pi-hole","unbound","wireguard"],"created_at":"2025-03-11T17:35:57.051Z","updated_at":"2025-12-25T06:06:03.703Z","avatar_url":"https://github.com/ipitio.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# Cl\u003cimg src=closure.png height=\"19\" width=\"19\" style=\"top: .025em;position: relative;\" alt=\"o\"\u003esure\n\n\u003cstrong\u003eComplex? Simplicial.\u003c/strong\u003e\n\n---\n\n[![build](https://github.com/ipitio/closure/actions/workflows/release.yml/badge.svg)](https://github.com/ipitio/closure/releases/latest)\n\n\u003c/div\u003e\n\nProvision a fresh Ubuntu install as a Hub, Spoke, or hybrid of both!\n\nYou can run WireGuard with Docker or on the host. If you run it with Docker (beta, available for armv7+ and amd64), you'll also get Unbound and Pi-hole v5, which will come with [pihole-speedtest](https://github.com/arevindh/pihole-speedtest) and [pihole-updatelists](https://github.com/jacklul/pihole-updatelists). In either case, Kodi will be installed with the Jellyfin add-on source, for your convenience. You can also choose between Netplan and hostapd for your access point needs.\n\n## Getting Started\n\nInstall. Configure. Reboot.\n\n### Definitions\n\nOne of the variables you'll set in `env.sh` will be `CLS_TYPE_NODE`, which is the type of node you're setting up. The options are:\n\n- **Hub**: A WireGuard server through which peers can route traffic. It just listens for incoming connections.\n- **Spoke**: A WireGuard client that connects, and can route traffic, to a Hub or HaaS.\n- **HaaS**: A special Hub that routes traffic to a special Spoke, a SaaH.\n- **SaaH**: A WireGuard client through which a HaaS routes traffic. It initiates the connection to a HaaS.\n\nA SaaH-HaaS[-Spoke] topology may be useful when you can't forward the WireGuard port at the location you'd like to have a Hub, but can where you'd otherwise have a stationary, always-on Spoke. While a Spoke can route traffic to a Hub or HaaS, a HaaS can only route traffic to a SaaH.\n\n\u003e [!NOTE]\n\u003e If your Hub or HaaS is behind a dynamic public IP address, sign up for a DDNS provider like freedns.afraid.org and set `CLS_DYN_DNS` to the update URL.\n\n\u003e [!CAUTION]\n\u003e If you use freeDNS, or another provider with a similar option, unlink updates of the same IP address.\n\n### Configuration\n\nWhen configuring, move everything in `examples/` out to the parent directory first. The files to edit are:\n\n- `dhcp/*dhcp*`: optional DHCP server config, if you don't want to use Pi-hole for that\n- `resolv.conf`: optional DNS client config\n- `netplan.yml`: primary network config\n- `env.sh`: environment variables for the scripts\n- `compose.yml`: environment variables for the services and bare WireGuard\n- `hooks/{pre,post}-{up,down}.sh`: scripts that run from the active user's home directory before and after everything is started or stopped, respectively\n- `hostapd/*.conf`: hostapd configs for your non-netplan APs, for more control and AP+STA mode support\n\nKeep in mind that:\n\n- The default DHCP config doesn't enable it.\n- Unbound connects to Cloudflare's servers using DoT by default, but you can uncomment its volume in `compose.yml` to use it as a recursive resolver.\n- To configure Pi-hole more extensively, such as by enabling DHCP, see the [Pi-hole documentation](https://github.com/pi-hole/docker-pi-hole/tree/2024.07.0?tab=readme-ov-file#environment-variables).\n- The hooks may be useful, for example, if you'd like to coordinate with an external, outbound VPN on a Hub or SaaH. All arguments given to `start.sh`and `stop.sh` are passed to their respective hooks.\n- For AP+STA mode, you can define as many `X@[iface].conf` files as bands the device supports, where X is an integer band.\n\n\u003e [!NOTE]\n\u003e The WireGuard service in the Compose file must be configured whether or not you'll use Docker ([docs](https://docs.linuxserver.io/images/docker-wireguard)).\n\n\u003e [!WARNING]\n\u003e If a user you specify in `env.sh` doesn't exist, it will be created. By default, the password will be the same as the username; change it!\n\n### Deployment\n\nCreate a node in no more than four steps (probably three or two) (or update in one). The initial reboot, as well as those after upgrading, may take a while as everything is set up, but the subsequent ones will be much faster. For example, the SaaH peer will be created on a HaaS if it doesn't exist. This means that you should set a Hub or HaaS up first, so SaaH and Spoke peer configurations can be generated. Drop those in their `wireguard/config/wg_confs` directories before rebooting. This [AllowedIPs Calculator](https://www.procustodibus.com/blog/2021/03/wireguard-allowedips-calculator) is pretty nifty, if you need it.\n\n#### Installing or Updating\n\nThe second step only needs to be done once, if at all.\n\n1. Install or update the package by either:\n    - pasting the one-liner or block below;\n    - downloading it from [Releases](https://github.com/ipitio/closure/releases); or\n    - copying this repo to `/opt/closure`.\n2. If you copied the repo, finish installing by copying `rc.local` to `/etc`.\n\n```{bash}\nwget -qO- https://ipitio.github.io/closure/i | sudo bash\n```\n\n```{bash}\nsudo apt-get update\nsudo DEBIAN_FRONTEND=noninteractive apt-get install -qq gpg wget\nsudo mkdir -m 0755 -p /etc/apt/keyrings/\nwget -qO- https://ipitio.github.io/closure/gpg.key | gpg --dearmor | sudo tee /etc/apt/keyrings/closure.gpg \u003e /dev/null\necho \"deb [signed-by=/etc/apt/keyrings/closure.gpg] https://ipitio.github.io/closure master main\" | sudo tee /etc/apt/sources.list.d/closure.list \u0026\u003e/dev/null\nsudo chmod 644 /etc/apt/keyrings/closure.gpg\nsudo chmod 644 /etc/apt/sources.list.d/closure.list\nsudo apt-get update\nsudo DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -qq closure\n```\n\n#### Configuring\n\nWhen you're ready for your system to be reconfigured:\n\n1. Copy an existing configuration to `/opt/closure` and/or configure the files as discussed, then reboot.\n2. On a Hub or HaaS, add Spokes you didn't define yet by running `add.sh` as described below.\n\n\u003e [!NOTE]\n\u003e Any arguments passed to `kickstart.sh` are passed to `start.sh`, which can add or edit wifi networks -- useful on a Raspberry Pi Zero (2) W! See the top of `start.sh` for the arguments it takes.\n\n\u003e [!IMPORTANT]\n\u003e Remember to forward a port to your Hub or HaaS, which listens on 51820 by default. Use 443 on your router to bypass some basic firewall filters.\n\n### Maintenance\n\nYou can (re)configure WireGuard peers; add WireGuard peers or modify the AllowedIPs of existing ones, show peer config QR codes, and delete peers with:\n\n```{bash}\nsudo bash wireguard/add.sh \u003cpeer_name\u003e [option] [-- args]\nsudo bash wireguard/get.sh \u003cpeer_name\u003e\nsudo bash wireguard/del.sh \u003cpeer_name\u003e [args]\n```\n\nBy default, `add.sh` sets the peer to route outgoing traffic through the VPN. You can change this default by modifying AllowedIPs in `compose.yml`. The option it takes may be one of:\n\n```{bash}\n-e, --internet    Route all traffic through the VPN\n-a, --intranet    Allow access to the internal space\n-l, --link        Allow access to just the VPN\n-o, --outgoing    Route outgoing traffic through the VPN\n```\n\nThe args are passed to `re/start.sh`.\n\n\u003e [!NOTE]\n\u003e While `start.sh` brings everything up, `restart.sh` only restarts WireGuard unless `CLS_WG_ONLY=false` is exported first.\n\n\u003e [!TIP]\n\u003e Don't forget to share an updated config with its peer.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fipitio%2Fclosure","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fipitio%2Fclosure","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fipitio%2Fclosure/lists"}