engels74/caddy
What is this?
A Docker image with Caddy 2 including DNS modules for Cloudflare, Njalla, and rate limiting. The default configuration restricts access to private IP ranges only.
Note: The Njalla DNS module uses a custom build pending the merge of this upstream PR.
Starting the container¶
1 2 3 4 5 6 7 8 9 10 11 | |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | |
Tags¶
| Tags | Description | Last Updated | Age |
|---|
Custom build¶
If you set the environment variable CUSTOM_BUILD to a file location like for example /config/caddy_linux_amd64_custom, an attempt is made to start Caddy with that binary. The custom build can be obtained from the Caddy download page. This is particularly useful if you need extra modules.
WireGuard¶
Info
This image includes VPN support. The cli/compose examples below are environment variables and settings complementary to the app image examples, this means you'll have to add/merge the stuff below with the stuff above. In case you are still in need of a VPN, consider using my affiliate links for Proton VPN, Proton Mail, Proton Drive, Proton Pass or Private Internet Access.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | |
-
The environment variable
VPN_LAN_NETWORKcan be set to for example192.168.1.0/24,192.168.1.0/24,192.168.44.0/24or192.168.1.33, so you can get access to the webui or other additional ports (see below). If for example you were to pick192.168.0.0/24, every device with an ip in the range192.168.0.0 - 192.168.0.255on your LAN is allowed access to the webui. -
If you need to expose ports on your LAN you can use
VPN_EXPOSE_PORTS_ON_LAN. For exampleVPN_EXPOSE_PORTS_ON_LAN=7878/tcp,9117/tcp, will block those ports on the vpn interface, so that there's no risk that they might be exposed to the world and allow access to them from your LAN. Some images also have aWEBUI_PORTSenvironment variable that does basically the same for the vpn part. For those apps that support it, it'll also change the port on which the app runs. -
With
net.ipv6.conf.all.disable_ipv6=1all ipv6 support is disabled. Leave ipv6 disabled and remove all references to it in yourwg0.conffile to keep things simple. If you need any sort of ipv6 support, enable it withnet.ipv6.conf.all.disable_ipv6=0. A WireGuard ipv6 endpoint is currently not supported. -
Possible values are
generic,protonandpia.
Affiliate links:
Proton VPN
Proton Mail
Proton Drive
Proton Pass
Private Internet Access -
There needs to be a file
wg0.conflocated in/config/wireguardand you need to set the variableVPN_ENABLEDtotruefor the VPN to start. If you'd like to execute some of your own bash commands you can place two scripts alongside yourwg0.conf, calledwg0-pre.shandwg0-post.sh. These will execute right before the check for the existence of awg0.conffile and almost at the end, right before the internet connectivity test. -
Auto retrieve a forwarded port and configure the supported app if set to
trueor if you can manually request/set a forwarded port in the VPN provider's web interface, fill in the port number (just the number). Useful website to check for open ports is YouGetSignal and ipleak.net to leak test with.torrentfile. -
By default a random server is used, but if you prefer a certain region you can fill in the region id. A list of available regions can be found in
/config/wireguardafter the first start. If you're seeing an error messageshuf: getrandom: Function not implemented, you can't let it pick one randomly and are forced to fill in a region id. -
With
VPN_CONFyou can set the name used for your WireGuard config. This is an example of how yourwg0.conffile should look like. If there's a lot of extra stuff, remove it unless you know what it's there for. The WireGuard config is automatically modified to useAllowedIPs = 0.0.0.0/1,128.0.0.0/1for compatibility with Synology/QNAP/Asustor/WSL2 systems if you append-fix, soVPN_CONF=wg0-fix. WSL2 users can also compile their own kernel if they don't wanna use this workaround.[Interface] PrivateKey = supersecretprivatekey Address = xx.xx.xxx.xxx/32 # Yes, /32 in most cases DNS = x.x.x.x [Peer] PublicKey = publickey AllowedIPs = 0.0.0.0/0 Endpoint = xxx.x.xxx.x:51820 -
If the WireGuard kernel module is missing (most likely on Synology/QNAP/Asustor), you can run WireGuard in userspace thanks to
wireguard-go. For that you'll need to add the device/dev/net/tun. It's most likely that the device/dev/net/tundoes not exist however, have a read here for instructions on checking and adding the device. -
DANGEROUS! Don't enable unless you know what you are doing!
-
When using
VPN_PROVIDER=pia, fill in your username and password. Awg0.confwill be automatically downloaded. -
Required in most cases, on some systems that don't have
rp_filterset to strict, it's optional. -
Fill in your DIP token here, if you've bought the dedicated ip option.
-
If you'd like to keep using the same forwarded port until it expires, set this to
true. -
Adds a redirect for the forwarded port from your vpn provider to the internal port on which the app runs, ports in this list are also not blocked on the wireguard interface, so this var is also useful if you want to expose a port on both your LAN and VPN. Values like
32400/tcpwill use the port fromVPN_AUTO_PORT_FORWARDto create the redirect or if set totruethe forwarded port from pia/proton. Use3000@3001/tcp,3002@3003/tcpsyntax for extra static redirects. The only known usecase as of right now is Plex and exposing it on the VPN with a non configurable forwarded port, because it's not possible to run Plex on anything else but 32400. Useful website to check for open ports is YouGetSignal and ipleak.net to leak test with.torrentfile. -
Possible values are
wg,8.8.8.8or1.1.1.1@853#cloudflare-dns.comseperated by a,. The valuewgwill use the nameservers from thewg0.conffile. The value8.8.8.8is to use a plain old nameserver. The value1.1.1.1@853#cloudflare-dns.comwill add aDNS over TLSnameserver, this will override all other regular nameservers. Leaving the variable empty will allow Unbound to work in recursive mode. -
Possible values are
auto,legacyornftables. The default isauto, this will try to use the most modern method available. If this doesn't work, you can try forcing it tolegacyornftables. -
If you want to use container hostnames to connect to other containers within a bridge network, you'll have to use
--hostnameand usecontainer-name.internalorcontainer-name.vpn. Currently.vpnis a non existing TLD, but that can change in the future. The TLD.internalshould become the standard for internal networks, so it's the safest choice. -
This will start Privoxy on the default port 8118 when set to
true. By default Privoxy is not exposed on the LAN, so if you need that, you'll have to addVPN_EXPOSE_PORTS_ON_LAN=8118/tcp,8118/udp. -
This is almost never needed, only in very rare cases (mostly when using PIA).
-
Enable Unbound by setting to
truewhen VPN is not active. -
Possible values are
8.8.8.8or1.1.1.1@853#cloudflare-dns.comseperated by a,. The value8.8.8.8is to use a plain old nameserver. The value1.1.1.1@853#cloudflare-dns.comwill add aDNS over TLSnameserver, this will override all other regular nameservers. Leaving the variable empty will allow Unbound to work in recursive mode.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | |
-
The environment variable
VPN_LAN_NETWORKcan be set to for example192.168.1.0/24,192.168.1.0/24,192.168.44.0/24or192.168.1.33, so you can get access to the webui or other additional ports (see below). If for example you were to pick192.168.0.0/24, every device with an ip in the range192.168.0.0 - 192.168.0.255on your LAN is allowed access to the webui. -
If you need to expose ports on your LAN you can use
VPN_EXPOSE_PORTS_ON_LAN. For exampleVPN_EXPOSE_PORTS_ON_LAN=7878/tcp,9117/tcp, will block those ports on the vpn interface, so that there's no risk that they might be exposed to the world and allow access to them from your LAN. Some images also have aWEBUI_PORTSenvironment variable that does basically the same for the vpn part. For those apps that support it, it'll also change the port on which the app runs. -
With
net.ipv6.conf.all.disable_ipv6=1all ipv6 support is disabled. Leave ipv6 disabled and remove all references to it in yourwg0.conffile to keep things simple. If you need any sort of ipv6 support, enable it withnet.ipv6.conf.all.disable_ipv6=0. A WireGuard ipv6 endpoint is currently not supported. -
Possible values are
generic,protonandpia.
Affiliate links:
Proton VPN
Proton Mail
Proton Drive
Proton Pass
Private Internet Access -
There needs to be a file
wg0.conflocated in/config/wireguardand you need to set the variableVPN_ENABLEDtotruefor the VPN to start. If you'd like to execute some of your own bash commands you can place two scripts alongside yourwg0.conf, calledwg0-pre.shandwg0-post.sh. These will execute right before the check for the existence of awg0.conffile and almost at the end, right before the internet connectivity test. -
Auto retrieve a forwarded port and configure the supported app if set to
trueor if you can manually request/set a forwarded port in the VPN provider's web interface, fill in the port number (just the number). Useful website to check for open ports is YouGetSignal and ipleak.net to leak test with.torrentfile. -
By default a random server is used, but if you prefer a certain region you can fill in the region id. A list of available regions can be found in
/config/wireguardafter the first start. If you're seeing an error messageshuf: getrandom: Function not implemented, you can't let it pick one randomly and are forced to fill in a region id. -
With
VPN_CONFyou can set the name used for your WireGuard config. This is an example of how yourwg0.conffile should look like. If there's a lot of extra stuff, remove it unless you know what it's there for. The WireGuard config is automatically modified to useAllowedIPs = 0.0.0.0/1,128.0.0.0/1for compatibility with Synology/QNAP/Asustor/WSL2 systems if you append-fix, soVPN_CONF=wg0-fix. WSL2 users can also compile their own kernel if they don't wanna use this workaround.[Interface] PrivateKey = supersecretprivatekey Address = xx.xx.xxx.xxx/32 # Yes, /32 in most cases DNS = x.x.x.x [Peer] PublicKey = publickey AllowedIPs = 0.0.0.0/0 Endpoint = xxx.x.xxx.x:51820 -
If the WireGuard kernel module is missing (most likely on Synology/QNAP/Asustor), you can run WireGuard in userspace thanks to
wireguard-go. For that you'll need to add the device/dev/net/tun. It's most likely that the device/dev/net/tundoes not exist however, have a read here for instructions on checking and adding the device. -
DANGEROUS! Don't enable unless you know what you are doing!
-
When using
VPN_PROVIDER=pia, fill in your username and password. Awg0.confwill be automatically downloaded. -
Required in most cases, on some systems that don't have
rp_filterset to strict, it's optional. -
Fill in your DIP token here, if you've bought the dedicated ip option.
-
If you'd like to keep using the same forwarded port until it expires, set this to
true. -
Adds a redirect for the forwarded port from your vpn provider to the internal port on which the app runs, ports in this list are also not blocked on the wireguard interface, so this var is also useful if you want to expose a port on both your LAN and VPN. Values like
32400/tcpwill use the port fromVPN_AUTO_PORT_FORWARDto create the redirect or if set totruethe forwarded port from pia/proton. Use3000@3001/tcp,3002@3003/tcpsyntax for extra static redirects. The only known usecase as of right now is Plex and exposing it on the VPN with a non configurable forwarded port, because it's not possible to run Plex on anything else but 32400. Useful website to check for open ports is YouGetSignal and ipleak.net to leak test with.torrentfile. -
Possible values are
wg,8.8.8.8or1.1.1.1@853#cloudflare-dns.comseperated by a,. The valuewgwill use the nameservers from thewg0.conffile. The value8.8.8.8is to use a plain old nameserver. The value1.1.1.1@853#cloudflare-dns.comwill add aDNS over TLSnameserver, this will override all other regular nameservers. Leaving the variable empty will allow Unbound to work in recursive mode. -
Possible values are
auto,legacyornftables. The default isauto, this will try to use the most modern method available. If this doesn't work, you can try forcing it tolegacyornftables. -
If you want to use container hostnames to connect to other containers within a bridge network, you'll have to use
--hostnameand usecontainer-name.internalorcontainer-name.vpn. Currently.vpnis a non existing TLD, but that can change in the future. The TLD.internalshould become the standard for internal networks, so it's the safest choice. -
This will start Privoxy on the default port 8118 when set to
true. By default Privoxy is not exposed on the LAN, so if you need that, you'll have to addVPN_EXPOSE_PORTS_ON_LAN=8118/tcp,8118/udp. -
This is almost never needed, only in very rare cases (mostly when using PIA).
-
Enable Unbound by setting to
truewhen VPN is not active. -
Possible values are
8.8.8.8or1.1.1.1@853#cloudflare-dns.comseperated by a,. The value8.8.8.8is to use a plain old nameserver. The value1.1.1.1@853#cloudflare-dns.comwill add aDNS over TLSnameserver, this will override all other regular nameservers. Leaving the variable empty will allow Unbound to work in recursive mode.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | |
-
The environment variable
VPN_LAN_NETWORKcan be set to for example192.168.1.0/24,192.168.1.0/24,192.168.44.0/24or192.168.1.33, so you can get access to the webui or other additional ports (see below). If for example you were to pick192.168.0.0/24, every device with an ip in the range192.168.0.0 - 192.168.0.255on your LAN is allowed access to the webui. -
If you need to expose ports on your LAN you can use
VPN_EXPOSE_PORTS_ON_LAN. For exampleVPN_EXPOSE_PORTS_ON_LAN=7878/tcp,9117/tcp, will block those ports on the vpn interface, so that there's no risk that they might be exposed to the world and allow access to them from your LAN. Some images also have aWEBUI_PORTSenvironment variable that does basically the same for the vpn part. For those apps that support it, it'll also change the port on which the app runs. -
With
net.ipv6.conf.all.disable_ipv6=1all ipv6 support is disabled. Leave ipv6 disabled and remove all references to it in yourwg0.conffile to keep things simple. If you need any sort of ipv6 support, enable it withnet.ipv6.conf.all.disable_ipv6=0. A WireGuard ipv6 endpoint is currently not supported. -
Possible values are
generic,protonandpia.
Affiliate links:
Proton VPN
Proton Mail
Proton Drive
Proton Pass
Private Internet Access -
There needs to be a file
wg0.conflocated in/config/wireguardand you need to set the variableVPN_ENABLEDtotruefor the VPN to start. If you'd like to execute some of your own bash commands you can place two scripts alongside yourwg0.conf, calledwg0-pre.shandwg0-post.sh. These will execute right before the check for the existence of awg0.conffile and almost at the end, right before the internet connectivity test. -
Auto retrieve a forwarded port and configure the supported app if set to
trueor if you can manually request/set a forwarded port in the VPN provider's web interface, fill in the port number (just the number). Useful website to check for open ports is YouGetSignal and ipleak.net to leak test with.torrentfile. -
By default a random server is used, but if you prefer a certain region you can fill in the region id. A list of available regions can be found in
/config/wireguardafter the first start. If you're seeing an error messageshuf: getrandom: Function not implemented, you can't let it pick one randomly and are forced to fill in a region id. -
With
VPN_CONFyou can set the name used for your WireGuard config. This is an example of how yourwg0.conffile should look like. If there's a lot of extra stuff, remove it unless you know what it's there for. The WireGuard config is automatically modified to useAllowedIPs = 0.0.0.0/1,128.0.0.0/1for compatibility with Synology/QNAP/Asustor/WSL2 systems if you append-fix, soVPN_CONF=wg0-fix. WSL2 users can also compile their own kernel if they don't wanna use this workaround.[Interface] PrivateKey = supersecretprivatekey Address = xx.xx.xxx.xxx/32 # Yes, /32 in most cases DNS = x.x.x.x [Peer] PublicKey = publickey AllowedIPs = 0.0.0.0/0 Endpoint = xxx.x.xxx.x:51820 -
If the WireGuard kernel module is missing (most likely on Synology/QNAP/Asustor), you can run WireGuard in userspace thanks to
wireguard-go. For that you'll need to add the device/dev/net/tun. It's most likely that the device/dev/net/tundoes not exist however, have a read here for instructions on checking and adding the device. -
DANGEROUS! Don't enable unless you know what you are doing!
-
When using
VPN_PROVIDER=pia, fill in your username and password. Awg0.confwill be automatically downloaded. -
Required in most cases, on some systems that don't have
rp_filterset to strict, it's optional. -
Fill in your DIP token here, if you've bought the dedicated ip option.
-
If you'd like to keep using the same forwarded port until it expires, set this to
true. -
Adds a redirect for the forwarded port from your vpn provider to the internal port on which the app runs, ports in this list are also not blocked on the wireguard interface, so this var is also useful if you want to expose a port on both your LAN and VPN. Values like
32400/tcpwill use the port fromVPN_AUTO_PORT_FORWARDto create the redirect or if set totruethe forwarded port from pia/proton. Use3000@3001/tcp,3002@3003/tcpsyntax for extra static redirects. The only known usecase as of right now is Plex and exposing it on the VPN with a non configurable forwarded port, because it's not possible to run Plex on anything else but 32400. Useful website to check for open ports is YouGetSignal and ipleak.net to leak test with.torrentfile. -
Possible values are
wg,8.8.8.8or1.1.1.1@853#cloudflare-dns.comseperated by a,. The valuewgwill use the nameservers from thewg0.conffile. The value8.8.8.8is to use a plain old nameserver. The value1.1.1.1@853#cloudflare-dns.comwill add aDNS over TLSnameserver, this will override all other regular nameservers. Leaving the variable empty will allow Unbound to work in recursive mode. -
Possible values are
auto,legacyornftables. The default isauto, this will try to use the most modern method available. If this doesn't work, you can try forcing it tolegacyornftables. -
If you want to use container hostnames to connect to other containers within a bridge network, you'll have to use
--hostnameand usecontainer-name.internalorcontainer-name.vpn. Currently.vpnis a non existing TLD, but that can change in the future. The TLD.internalshould become the standard for internal networks, so it's the safest choice. -
This will start Privoxy on the default port 8118 when set to
true. By default Privoxy is not exposed on the LAN, so if you need that, you'll have to addVPN_EXPOSE_PORTS_ON_LAN=8118/tcp,8118/udp. -
This is almost never needed, only in very rare cases (mostly when using PIA).
-
Enable Unbound by setting to
truewhen VPN is not active. -
Possible values are
8.8.8.8or1.1.1.1@853#cloudflare-dns.comseperated by a,. The value8.8.8.8is to use a plain old nameserver. The value1.1.1.1@853#cloudflare-dns.comwill add aDNS over TLSnameserver, this will override all other regular nameservers. Leaving the variable empty will allow Unbound to work in recursive mode.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | |
-
The environment variable
VPN_LAN_NETWORKcan be set to for example192.168.1.0/24,192.168.1.0/24,192.168.44.0/24or192.168.1.33, so you can get access to the webui or other additional ports (see below). If for example you were to pick192.168.0.0/24, every device with an ip in the range192.168.0.0 - 192.168.0.255on your LAN is allowed access to the webui. -
If you need to expose ports on your LAN you can use
VPN_EXPOSE_PORTS_ON_LAN. For exampleVPN_EXPOSE_PORTS_ON_LAN=7878/tcp,9117/tcp, will block those ports on the vpn interface, so that there's no risk that they might be exposed to the world and allow access to them from your LAN. Some images also have aWEBUI_PORTSenvironment variable that does basically the same for the vpn part. For those apps that support it, it'll also change the port on which the app runs. -
With
net.ipv6.conf.all.disable_ipv6=1all ipv6 support is disabled. Leave ipv6 disabled and remove all references to it in yourwg0.conffile to keep things simple. If you need any sort of ipv6 support, enable it withnet.ipv6.conf.all.disable_ipv6=0. A WireGuard ipv6 endpoint is currently not supported. -
Possible values are
generic,protonandpia.
Affiliate links:
Proton VPN
Proton Mail
Proton Drive
Proton Pass
Private Internet Access -
There needs to be a file
wg0.conflocated in/config/wireguardand you need to set the variableVPN_ENABLEDtotruefor the VPN to start. If you'd like to execute some of your own bash commands you can place two scripts alongside yourwg0.conf, calledwg0-pre.shandwg0-post.sh. These will execute right before the check for the existence of awg0.conffile and almost at the end, right before the internet connectivity test. -
Auto retrieve a forwarded port and configure the supported app if set to
trueor if you can manually request/set a forwarded port in the VPN provider's web interface, fill in the port number (just the number). Useful website to check for open ports is YouGetSignal and ipleak.net to leak test with.torrentfile. -
By default a random server is used, but if you prefer a certain region you can fill in the region id. A list of available regions can be found in
/config/wireguardafter the first start. If you're seeing an error messageshuf: getrandom: Function not implemented, you can't let it pick one randomly and are forced to fill in a region id. -
With
VPN_CONFyou can set the name used for your WireGuard config. This is an example of how yourwg0.conffile should look like. If there's a lot of extra stuff, remove it unless you know what it's there for. The WireGuard config is automatically modified to useAllowedIPs = 0.0.0.0/1,128.0.0.0/1for compatibility with Synology/QNAP/Asustor/WSL2 systems if you append-fix, soVPN_CONF=wg0-fix. WSL2 users can also compile their own kernel if they don't wanna use this workaround.[Interface] PrivateKey = supersecretprivatekey Address = xx.xx.xxx.xxx/32 # Yes, /32 in most cases DNS = x.x.x.x [Peer] PublicKey = publickey AllowedIPs = 0.0.0.0/0 Endpoint = xxx.x.xxx.x:51820 -
If the WireGuard kernel module is missing (most likely on Synology/QNAP/Asustor), you can run WireGuard in userspace thanks to
wireguard-go. For that you'll need to add the device/dev/net/tun. It's most likely that the device/dev/net/tundoes not exist however, have a read here for instructions on checking and adding the device. -
DANGEROUS! Don't enable unless you know what you are doing!
-
When using
VPN_PROVIDER=pia, fill in your username and password. Awg0.confwill be automatically downloaded. -
Required in most cases, on some systems that don't have
rp_filterset to strict, it's optional. -
Fill in your DIP token here, if you've bought the dedicated ip option.
-
If you'd like to keep using the same forwarded port until it expires, set this to
true. -
Adds a redirect for the forwarded port from your vpn provider to the internal port on which the app runs, ports in this list are also not blocked on the wireguard interface, so this var is also useful if you want to expose a port on both your LAN and VPN. Values like
32400/tcpwill use the port fromVPN_AUTO_PORT_FORWARDto create the redirect or if set totruethe forwarded port from pia/proton. Use3000@3001/tcp,3002@3003/tcpsyntax for extra static redirects. The only known usecase as of right now is Plex and exposing it on the VPN with a non configurable forwarded port, because it's not possible to run Plex on anything else but 32400. Useful website to check for open ports is YouGetSignal and ipleak.net to leak test with.torrentfile. -
Possible values are
wg,8.8.8.8or1.1.1.1@853#cloudflare-dns.comseperated by a,. The valuewgwill use the nameservers from thewg0.conffile. The value8.8.8.8is to use a plain old nameserver. The value1.1.1.1@853#cloudflare-dns.comwill add aDNS over TLSnameserver, this will override all other regular nameservers. Leaving the variable empty will allow Unbound to work in recursive mode. -
Possible values are
auto,legacyornftables. The default isauto, this will try to use the most modern method available. If this doesn't work, you can try forcing it tolegacyornftables. -
If you want to use container hostnames to connect to other containers within a bridge network, you'll have to use
--hostnameand usecontainer-name.internalorcontainer-name.vpn. Currently.vpnis a non existing TLD, but that can change in the future. The TLD.internalshould become the standard for internal networks, so it's the safest choice. -
This will start Privoxy on the default port 8118 when set to
true. By default Privoxy is not exposed on the LAN, so if you need that, you'll have to addVPN_EXPOSE_PORTS_ON_LAN=8118/tcp,8118/udp. -
This is almost never needed, only in very rare cases (mostly when using PIA).
-
Enable Unbound by setting to
truewhen VPN is not active. -
Possible values are
8.8.8.8or1.1.1.1@853#cloudflare-dns.comseperated by a,. The value8.8.8.8is to use a plain old nameserver. The value1.1.1.1@853#cloudflare-dns.comwill add aDNS over TLSnameserver, this will override all other regular nameservers. Leaving the variable empty will allow Unbound to work in recursive mode.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | |
-
The environment variable
VPN_LAN_NETWORKcan be set to for example192.168.1.0/24,192.168.1.0/24,192.168.44.0/24or192.168.1.33, so you can get access to the webui or other additional ports (see below). If for example you were to pick192.168.0.0/24, every device with an ip in the range192.168.0.0 - 192.168.0.255on your LAN is allowed access to the webui. -
If you need to expose ports on your LAN you can use
VPN_EXPOSE_PORTS_ON_LAN. For exampleVPN_EXPOSE_PORTS_ON_LAN=7878/tcp,9117/tcp, will block those ports on the vpn interface, so that there's no risk that they might be exposed to the world and allow access to them from your LAN. Some images also have aWEBUI_PORTSenvironment variable that does basically the same for the vpn part. For those apps that support it, it'll also change the port on which the app runs. -
With
net.ipv6.conf.all.disable_ipv6=1all ipv6 support is disabled. Leave ipv6 disabled and remove all references to it in yourwg0.conffile to keep things simple. If you need any sort of ipv6 support, enable it withnet.ipv6.conf.all.disable_ipv6=0. A WireGuard ipv6 endpoint is currently not supported. -
Possible values are
generic,protonandpia.
Affiliate links:
Proton VPN
Proton Mail
Proton Drive
Proton Pass
Private Internet Access -
There needs to be a file
wg0.conflocated in/config/wireguardand you need to set the variableVPN_ENABLEDtotruefor the VPN to start. If you'd like to execute some of your own bash commands you can place two scripts alongside yourwg0.conf, calledwg0-pre.shandwg0-post.sh. These will execute right before the check for the existence of awg0.conffile and almost at the end, right before the internet connectivity test. -
Auto retrieve a forwarded port and configure the supported app if set to
trueor if you can manually request/set a forwarded port in the VPN provider's web interface, fill in the port number (just the number). Useful website to check for open ports is YouGetSignal and ipleak.net to leak test with.torrentfile. -
By default a random server is used, but if you prefer a certain region you can fill in the region id. A list of available regions can be found in
/config/wireguardafter the first start. If you're seeing an error messageshuf: getrandom: Function not implemented, you can't let it pick one randomly and are forced to fill in a region id. -
With
VPN_CONFyou can set the name used for your WireGuard config. This is an example of how yourwg0.conffile should look like. If there's a lot of extra stuff, remove it unless you know what it's there for. The WireGuard config is automatically modified to useAllowedIPs = 0.0.0.0/1,128.0.0.0/1for compatibility with Synology/QNAP/Asustor/WSL2 systems if you append-fix, soVPN_CONF=wg0-fix. WSL2 users can also compile their own kernel if they don't wanna use this workaround.[Interface] PrivateKey = supersecretprivatekey Address = xx.xx.xxx.xxx/32 # Yes, /32 in most cases DNS = x.x.x.x [Peer] PublicKey = publickey AllowedIPs = 0.0.0.0/0 Endpoint = xxx.x.xxx.x:51820 -
If the WireGuard kernel module is missing (most likely on Synology/QNAP/Asustor), you can run WireGuard in userspace thanks to
wireguard-go. For that you'll need to add the device/dev/net/tun. It's most likely that the device/dev/net/tundoes not exist however, have a read here for instructions on checking and adding the device. -
DANGEROUS! Don't enable unless you know what you are doing!
-
When using
VPN_PROVIDER=pia, fill in your username and password. Awg0.confwill be automatically downloaded. -
Required in most cases, on some systems that don't have
rp_filterset to strict, it's optional. -
Fill in your DIP token here, if you've bought the dedicated ip option.
-
If you'd like to keep using the same forwarded port until it expires, set this to
true. -
Adds a redirect for the forwarded port from your vpn provider to the internal port on which the app runs, ports in this list are also not blocked on the wireguard interface, so this var is also useful if you want to expose a port on both your LAN and VPN. Values like
32400/tcpwill use the port fromVPN_AUTO_PORT_FORWARDto create the redirect or if set totruethe forwarded port from pia/proton. Use3000@3001/tcp,3002@3003/tcpsyntax for extra static redirects. The only known usecase as of right now is Plex and exposing it on the VPN with a non configurable forwarded port, because it's not possible to run Plex on anything else but 32400. Useful website to check for open ports is YouGetSignal and ipleak.net to leak test with.torrentfile. -
Possible values are
wg,8.8.8.8or1.1.1.1@853#cloudflare-dns.comseperated by a,. The valuewgwill use the nameservers from thewg0.conffile. The value8.8.8.8is to use a plain old nameserver. The value1.1.1.1@853#cloudflare-dns.comwill add aDNS over TLSnameserver, this will override all other regular nameservers. Leaving the variable empty will allow Unbound to work in recursive mode. -
Possible values are
auto,legacyornftables. The default isauto, this will try to use the most modern method available. If this doesn't work, you can try forcing it tolegacyornftables. -
If you want to use container hostnames to connect to other containers within a bridge network, you'll have to use
--hostnameand usecontainer-name.internalorcontainer-name.vpn. Currently.vpnis a non existing TLD, but that can change in the future. The TLD.internalshould become the standard for internal networks, so it's the safest choice. -
This will start Privoxy on the default port 8118 when set to
true. By default Privoxy is not exposed on the LAN, so if you need that, you'll have to addVPN_EXPOSE_PORTS_ON_LAN=8118/tcp,8118/udp. -
This is almost never needed, only in very rare cases (mostly when using PIA).
-
Enable Unbound by setting to
truewhen VPN is not active. -
Possible values are
8.8.8.8or1.1.1.1@853#cloudflare-dns.comseperated by a,. The value8.8.8.8is to use a plain old nameserver. The value1.1.1.1@853#cloudflare-dns.comwill add aDNS over TLSnameserver, this will override all other regular nameservers. Leaving the variable empty will allow Unbound to work in recursive mode.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | |
-
The environment variable
VPN_LAN_NETWORKcan be set to for example192.168.1.0/24,192.168.1.0/24,192.168.44.0/24or192.168.1.33, so you can get access to the webui or other additional ports (see below). If for example you were to pick192.168.0.0/24, every device with an ip in the range192.168.0.0 - 192.168.0.255on your LAN is allowed access to the webui. -
If you need to expose ports on your LAN you can use
VPN_EXPOSE_PORTS_ON_LAN. For exampleVPN_EXPOSE_PORTS_ON_LAN=7878/tcp,9117/tcp, will block those ports on the vpn interface, so that there's no risk that they might be exposed to the world and allow access to them from your LAN. Some images also have aWEBUI_PORTSenvironment variable that does basically the same for the vpn part. For those apps that support it, it'll also change the port on which the app runs. -
With
net.ipv6.conf.all.disable_ipv6=1all ipv6 support is disabled. Leave ipv6 disabled and remove all references to it in yourwg0.conffile to keep things simple. If you need any sort of ipv6 support, enable it withnet.ipv6.conf.all.disable_ipv6=0. A WireGuard ipv6 endpoint is currently not supported. -
Possible values are
generic,protonandpia.
Affiliate links:
Proton VPN
Proton Mail
Proton Drive
Proton Pass
Private Internet Access -
There needs to be a file
wg0.conflocated in/config/wireguardand you need to set the variableVPN_ENABLEDtotruefor the VPN to start. If you'd like to execute some of your own bash commands you can place two scripts alongside yourwg0.conf, calledwg0-pre.shandwg0-post.sh. These will execute right before the check for the existence of awg0.conffile and almost at the end, right before the internet connectivity test. -
Auto retrieve a forwarded port and configure the supported app if set to
trueor if you can manually request/set a forwarded port in the VPN provider's web interface, fill in the port number (just the number). Useful website to check for open ports is YouGetSignal and ipleak.net to leak test with.torrentfile. -
By default a random server is used, but if you prefer a certain region you can fill in the region id. A list of available regions can be found in
/config/wireguardafter the first start. If you're seeing an error messageshuf: getrandom: Function not implemented, you can't let it pick one randomly and are forced to fill in a region id. -
With
VPN_CONFyou can set the name used for your WireGuard config. This is an example of how yourwg0.conffile should look like. If there's a lot of extra stuff, remove it unless you know what it's there for. The WireGuard config is automatically modified to useAllowedIPs = 0.0.0.0/1,128.0.0.0/1for compatibility with Synology/QNAP/Asustor/WSL2 systems if you append-fix, soVPN_CONF=wg0-fix. WSL2 users can also compile their own kernel if they don't wanna use this workaround.[Interface] PrivateKey = supersecretprivatekey Address = xx.xx.xxx.xxx/32 # Yes, /32 in most cases DNS = x.x.x.x [Peer] PublicKey = publickey AllowedIPs = 0.0.0.0/0 Endpoint = xxx.x.xxx.x:51820 -
If the WireGuard kernel module is missing (most likely on Synology/QNAP/Asustor), you can run WireGuard in userspace thanks to
wireguard-go. For that you'll need to add the device/dev/net/tun. It's most likely that the device/dev/net/tundoes not exist however, have a read here for instructions on checking and adding the device. -
DANGEROUS! Don't enable unless you know what you are doing!
-
When using
VPN_PROVIDER=pia, fill in your username and password. Awg0.confwill be automatically downloaded. -
Required in most cases, on some systems that don't have
rp_filterset to strict, it's optional. -
Fill in your DIP token here, if you've bought the dedicated ip option.
-
If you'd like to keep using the same forwarded port until it expires, set this to
true. -
Adds a redirect for the forwarded port from your vpn provider to the internal port on which the app runs, ports in this list are also not blocked on the wireguard interface, so this var is also useful if you want to expose a port on both your LAN and VPN. Values like
32400/tcpwill use the port fromVPN_AUTO_PORT_FORWARDto create the redirect or if set totruethe forwarded port from pia/proton. Use3000@3001/tcp,3002@3003/tcpsyntax for extra static redirects. The only known usecase as of right now is Plex and exposing it on the VPN with a non configurable forwarded port, because it's not possible to run Plex on anything else but 32400. Useful website to check for open ports is YouGetSignal and ipleak.net to leak test with.torrentfile. -
Possible values are
wg,8.8.8.8or1.1.1.1@853#cloudflare-dns.comseperated by a,. The valuewgwill use the nameservers from thewg0.conffile. The value8.8.8.8is to use a plain old nameserver. The value1.1.1.1@853#cloudflare-dns.comwill add aDNS over TLSnameserver, this will override all other regular nameservers. Leaving the variable empty will allow Unbound to work in recursive mode. -
Possible values are
auto,legacyornftables. The default isauto, this will try to use the most modern method available. If this doesn't work, you can try forcing it tolegacyornftables. -
If you want to use container hostnames to connect to other containers within a bridge network, you'll have to use
--hostnameand usecontainer-name.internalorcontainer-name.vpn. Currently.vpnis a non existing TLD, but that can change in the future. The TLD.internalshould become the standard for internal networks, so it's the safest choice. -
This will start Privoxy on the default port 8118 when set to
true. By default Privoxy is not exposed on the LAN, so if you need that, you'll have to addVPN_EXPOSE_PORTS_ON_LAN=8118/tcp,8118/udp. -
This is almost never needed, only in very rare cases (mostly when using PIA).
-
Enable Unbound by setting to
truewhen VPN is not active. -
Possible values are
8.8.8.8or1.1.1.1@853#cloudflare-dns.comseperated by a,. The value8.8.8.8is to use a plain old nameserver. The value1.1.1.1@853#cloudflare-dns.comwill add aDNS over TLSnameserver, this will override all other regular nameservers. Leaving the variable empty will allow Unbound to work in recursive mode.