Wireguard

Wireguard

Created = this.file.ctime
Updated = this.file.mtime

Information

Wireguard is a VPN software/protocol that is known for being newer than OpenVPN and far less complex, providing it with a lower surface area for attack. Outside of security purposes, such as when [[ Torrent|torrenting ]], when behind a CG-NAT, such as with [[ Starlink ]], there is a need for a tunnel to provide a port-forwarded public IP address when self hosting. This creates a unique set of requirements where;

  1. The VPN must provide both port forwarding and a static IP, and the port forwarding must allow for low ports (such as 80, 443, etc.) This is usually counter to security needs, so many VPN providers do not offer these features. Currently OVPN is used.
  2. The VPN must be run in a way that not all outgoing traffic is routed through it, rather only specific outgoing traffic. This allows for local traffic to be kept locally - especially important for [[ Jellyfin ]] where speed and latency become problematic.
  3. Incoming traffic however, needs to be routable to any container. Because of these the final solution is that wireguard is run as a container, with the host OS traffic running normally. Containers that need outgoing traffic routed through the VPN have a network_mode: service:wireguard and their ports added to the Wireguard container instead. This basically causes those container to route traffic through the Wireguard container. [[ NginX Proxy Manager ]] is also attached in this way, as the Wireguard connection has a static public IP address, the reverse proxy can be used as per usual targeting the internal IP for the containers.

    Docker Compose Script

        wireguard:
        image: lscr.io/linuxserver/wireguard
        container_name: wireguard
        cap_add:
          - NET_ADMIN
          - SYS_MODULE
        environment:
          - PUID=1000
          - PGID=1000
          - TZ=Australia/Adelaide
        volumes:
          - /docker/wireguard/config:/config
          - /docker/wireguard/lib/modules:/lib/modules
        ports:
          - 8080:8080
          - 8112:8112
          - 81:81
          - 80:80
          - 443:443
        sysctls:
          - net.ipv4.conf.all.src_valid_mark=1
        restart: unless-stopped
    

    wg0.conf

    ```conf [Interface] PrivateKey = {Provided Private Key} Address = {Provided Address} DNS = {Provided DNS} PostUp = DROUTE=(iproute|grepdefault|awkprint$3);HOMENET=192.168.0.0/16;HOMENET2=10.0.0.0/8;HOMENET3=172.16.0.0/12;iprouteaddHOMENET3 via DROUTE;iprouteaddHOMENET2 via DROUTE;iprouteaddHOMENET via DROUTE;iptablesIOUTPUTdHOMENET -j ACCEPT;iptables -A OUTPUT -d HOMENET2jACCEPT;iptablesAOUTPUTdHOMENET3 -j ACCEPT;  iptables -A OUTPUT ! -o %i -m mark ! –mark (wgshowPreDown=HOMENET=192.168.0.0/16;HOMENET2=10.0.0.0/8;HOMENET3=172.18.0.0/12;iproutedeleteHOMENET; ip route delete HOMENET2;iproutedeleteHOMENET3; iptables -D OUTPUT ! -o %i -m mark ! –mark (wgshowHOMENET -j ACCEPT; iptables -D OUTPUT -d HOMENET2jACCEPT;iptablesDOUTPUTdHOMENET3 -j ACCEPT

[Peer] PublicKey = {Provided Public Key} AllowedIPs = 0.0.0.0/0 Endpoint = {Provided Endpoint} ```

Setup

  1. Add the above to your docker compose script
  2. Run sudo nano /docker/wireguard/config/wg0.conf and paste the above conf file, replacing the {Provided x} with those from your VPN provider.
  3. Create your docker container

[Type:: Seedling]

Notes mentioning this note


Here are all the notes in this garden, along with their links, visualized as a graph.

BooksAtomic habitsAurora burningAurora rising📖 Auroras End📖 The Art of Doing Science and Engineering -...Contemporary strategy analysis📖 Every Tools a Hammer📖 I'm Glad My Mom Died📖 Scythe📖 The Art of Doing Science and Engineering -...Adam savageAchievement motivation theoryBusn8009 creating resilient supply chains and...Busn9147 leading a future workforceBusn9152 legal signposts for decision makersBusn9153 emerging business modelsBusiness lexiconBusiness modelsBusiness strategyBusiness structuresCollaborationsCooperativesFranchisesJoint venturesLicensing structuresPartnershipsProprietary and public companiesSole tradingTrustsUnincorporated & incorporated associationsCollaborationsContext in lawEthical leadershipFour worlds of work for 2030Leader motive profile theoryLeadershipPorters five forcesPygmalion effectSupply chain operationSupply chain planningSupply chainsTheory x and theory yTheranosTrait leadership theoryVulnerable supply chainsAi builderBower bi visualisationsCanvas appsConnectorsDataverseMicrosoft power platform overviewModel Driven appsPoliciesPower appsPower automatePower bi data cleansingPower biPower virtual agentsData streamsErrors & exceptionsProcessing log filesProgramming homePython subprocessesRegular expressionsTestingUsing python to interact with the os final...Job requistionsRecruitment systemBreadGlutenSourdoughBlueberriesCurrantsGarden Beds🫐 Midyim BerryRaspberriesRhubarbDelugeDockerHome serverProwlarrRadarrReadarrWireguardMaking3d printingAlex's firmwareAquila x2Edc twoSewingWaxed canvasBachelor of ScienceDemon 79Digital GardenIndigenous VoiceJekyllMarkdownNetlifyNotesPairing FunctionPaprikaThought Log 12-11-23BUSN8006 - Week 1BUSN8008 - Week 2BUSN8008 - Week 3BUSN8008 - Week 9BUSN9146 - Week 1BUSN9148 - Week 5