mirror of https://github.com/wg-easy/wg-easy
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
22 KiB
1 lines
22 KiB
{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Welcome to the Documentation for <code>wg-easy</code>","text":"<p>\u00a0This Documentation is Versioned</p> <p>Make sure to select the correct version of this documentation! It should match the version of the image you are using. The default version corresponds to the <code>:latest</code> image tag - the most recent stable release.</p> <p>This documentation provides you not only with the basic setup and configuration of wg-easy but also with advanced configuration, elaborate usage scenarios, detailed examples, hints and more.</p>"},{"location":"#about","title":"About","text":"<p><code>wg-easy</code> is the easiest way to run WireGuard VPN + Web-based Admin UI.</p>"},{"location":"#contents","title":"Contents","text":""},{"location":"#getting-started","title":"Getting Started","text":"<p>If you're new to wg-easy, make sure to read the Getting Started chapter first. If you want to look at examples for Docker Run and Compose, we have an Examples page.</p>"},{"location":"#contributing","title":"Contributing","text":"<p>We are always happy to welcome new contributors. For guidelines and entrypoints please have a look at the Contributing section.</p>"},{"location":"#migration","title":"Migration","text":"<p>If you are migrating from an older version of <code>wg-easy</code>, please read the Migration chapter.</p>"},{"location":"getting-started/","title":"Getting Started","text":"<p>This page explains how to get started with wg-easy. The guide uses Docker Compose as a reference. In our examples, we mount the named volume <code>etc_wireguard</code> to <code>/etc/wireguard</code> inside the container.</p>"},{"location":"getting-started/#preliminary-steps","title":"Preliminary Steps","text":"<p>Before you can get started with deploying your own VPN, there are some requirements to be met:</p> <ol> <li>You need to have a host that you can manage</li> <li>You need to have a domain name or a public IP address</li> <li>You need a supported architecture (x86_64, arm64)</li> </ol>"},{"location":"getting-started/#host-setup","title":"Host Setup","text":"<p>There are a few requirements for a suitable host system:</p> <ol> <li>You need to have a container runtime installed</li> </ol> <p>About the Container Runtime</p> <p>On the host, you need to have a suitable container runtime (like Docker or Podman) installed. We assume Docker Compose is installed. We have aligned file names and configuration conventions with the latest Docker Compose specification. If you're using podman, make sure to read the related documentation.</p>"},{"location":"getting-started/#deploying-the-actual-image","title":"Deploying the Actual Image","text":""},{"location":"getting-started/#tagging-convention","title":"Tagging Convention","text":"<p>To understand which tags you should use, read this section carefully. Our CI will automatically build, test and push new images to the following container registry:</p> <ol> <li>GitHub Container Registry (<code>ghcr.io/wg-easy/wg-easy</code>)</li> </ol> <p>All workflows are using the tagging convention listed below. It is subsequently applied to all images.</p> Event Image Tags <code>cron</code> on <code>master</code> <code>nightly</code> <code>push</code> a tag (<code>v1.2.3</code>) <code>1.2.3</code>, <code>1.2</code>, <code>1</code>, <code>latest</code> <p>When publishing a tag we follow the Semantic Versioning specification. The <code>latest</code> tag is always pointing to the latest stable release. If you want to avoid breaking changes, use the major version tag (e.g. <code>15</code>).</p>"},{"location":"getting-started/#get-all-files","title":"Get All Files","text":"<p>Issue the following command to acquire the necessary file:</p> <pre><code>wget \"https://raw.githubusercontent.com/wg-easy/wg-easy/master/docker-compose.yml\"\n</code></pre>"},{"location":"getting-started/#start-the-container","title":"Start the Container","text":"<p>To start the container, issue the following command:</p> <pre><code>sudo docker compose up -d\n</code></pre>"},{"location":"getting-started/#configuration-steps","title":"Configuration Steps","text":"<p>Now follow the setup process in your web browser</p>"},{"location":"getting-started/#stopping-the-container","title":"Stopping the Container","text":"<p>To stop the container, issue the following command:</p> <pre><code>sudo docker compose down\n</code></pre> <p>Using the Correct Commands For Stopping and Starting wg-easy</p> <p>Use <code>sudo docker compose up / down</code>, not <code>sudo docker compose start / stop</code>. Otherwise, the container is not properly destroyed and you may experience problems during startup because of inconsistent state.</p> <p>That's it! It really is that easy.</p> <p>If you need more help you can read the Basic Installation Tutorial.</p>"},{"location":"advanced/api/","title":"API","text":"<p>TODO</p>"},{"location":"advanced/config/optional-config/","title":"Optional Configuration","text":"<p>TODO</p> Env Default Example Description <code>PORT</code> <code>51821</code> <code>6789</code> TCP port for Web UI. <code>HOST</code> <code>0.0.0.0</code> <code>localhost</code> IP address web UI binds to. <code>INSECURE</code> <code>false</code> <code>true</code> If access over http is allowed"},{"location":"advanced/config/unattended-setup/","title":"Unattended Setup","text":"<p>If you want to run the setup without any user interaction, e.g. with a tool like Ansible, you can use these environment variables to configure the setup.</p> <p>These will only be used during the first start of the container. After that, the setup will be disabled.</p> Env Example Description Group <code>INIT_ENABLED</code> <code>true</code> Enables the below env vars 0 <code>INIT_USERNAME</code> <code>admin</code> Sets admin username 1 <code>INIT_PASSWORD</code> <code>Se!ureP%ssw</code> Sets admin password 1 <code>INIT_HOST</code> <code>vpn.example.com</code> Host clients will connect to 1 <code>INIT_PORT</code> <code>51820</code> Port clients will connect to and wireguard will listen on 1 <code>INIT_DNS</code> <code>1.1.1.1,8.8.8.8</code> Sets global dns setting 2 <code>INIT_IPV4_CIDR</code> <code>10.8.0.0/24</code> Sets IPv4 cidr 3 <code>INIT_IPV6_CIDR</code> <code>2001:0DB8::/32</code> Sets IPv6 cidr 3 <p>\u00a0Variables have to be used together</p> <p>If variables are in the same group, you have to set all of them. For example, if you set <code>INIT_IPV4_CIDR</code>, you also have to set <code>INIT_IPV6_CIDR</code>.</p> <p>If you want to skip the setup process, you have to configure group <code>1</code></p> <p>Security</p> <p>The initial username and password is not checked for complexity. Make sure to set a long enough username and a secure password. Otherwise, the user won't be able to log in.</p> <p>Its recommended to remove the variables after the setup is done to prevent the password from being exposed.</p>"},{"location":"advanced/metrics/prometheus/","title":"Prometheus","text":"<p>TODO</p>"},{"location":"advanced/migrate/","title":"Migrate","text":"<p>If you want to migrate from an older version of <code>wg-easy</code> to the new version, you can find the migration guides listed below.</p> <ul> <li>Migrate from v14 to v15 : This guide should also work for any version before <code>v14</code>.</li> </ul>"},{"location":"advanced/migrate/from-14-to-15/","title":"Migrate from v14 to v15","text":"<p>This guide will help you migrate from <code>v14</code> to version <code>v15</code> of <code>wg-easy</code>.</p>"},{"location":"advanced/migrate/from-14-to-15/#changes","title":"Changes","text":"<ul> <li>This is a complete rewrite of the <code>wg-easy</code> project. Therefore the configuration files and the way you interact with the project have changed.</li> <li>If you use armv6 or armv7, you can't migrate to <code>v15</code> yet. We are working on it.</li> <li>If you are connecting to the web ui via HTTP, you need to set the <code>INSECURE</code> environment variable to <code>true</code> in the new container.</li> </ul>"},{"location":"advanced/migrate/from-14-to-15/#migration","title":"Migration","text":""},{"location":"advanced/migrate/from-14-to-15/#backup","title":"Backup","text":"<p>Before you start the migration, make sure to backup your existing configuration files.</p> <p>Go into the Web Ui and click the Backup button, this should download a <code>wg0.json</code> file.</p> <p>Or download the <code>wg0.json</code> file from your container volume to your pc.</p> <p>You will need this file for the migration</p>"},{"location":"advanced/migrate/from-14-to-15/#remove-old-container","title":"Remove old container","text":"<ol> <li>Stop the running container</li> </ol> <p>If you are using <code>docker run</code></p> <pre><code>docker stop wg-easy\n</code></pre> <p>If you are using <code>docker-compose</code></p> <pre><code>docker-compose down\n</code></pre>"},{"location":"advanced/migrate/from-14-to-15/#start-new-container","title":"Start new container","text":"<p>Follow the instructions in the Getting Started or Basic Installation guide to start the new container.</p> <p>In the setup wizard, select that you already already have a configuration file and upload the <code>wg0.json</code> file you downloaded in the backup step.</p>"},{"location":"advanced/migrate/from-14-to-15/#done","title":"Done","text":"<p>You have now successfully migrated to <code>v15</code> of <code>wg-easy</code>.</p>"},{"location":"contributing/general/","title":"General Information","text":""},{"location":"contributing/general/#coding-style","title":"Coding Style","text":"<p>When refactoring, writing or altering files, adhere to these rules:</p> <ol> <li>Adjust your style of coding to the style that is already present! Even if you do not like it, this is due to consistency. There was a lot of work involved in making all files consistent.</li> <li>Use <code>pnpm lint</code> to check your scripts! Your contributions are checked by GitHub Actions too, so you will need to do this.</li> <li>Use the provided <code>.vscode/settings.json</code> file.</li> </ol>"},{"location":"contributing/general/#documentation","title":"Documentation","text":"<p>Make sure to select <code>nightly</code> in the dropdown menu at the top. Navigate to the page you would like to edit and click the edit button in the top right. This allows you to make changes and create a pull-request.</p> <p>Alternatively you can make the changes locally. For that you'll need to have Docker installed. Run</p> <pre><code>pnpm docs:serve\n</code></pre> <p>This serves the documentation on your local machine on port <code>8080</code>. Each change will be hot-reloaded onto the page you view, just edit, save and look at the result.</p>"},{"location":"contributing/issues-and-pull-requests/","title":"Issues and Pull Requests","text":"<p>This project is Open Source. That means that you can contribute on enhancements, bug fixing or improving the documentation.</p>"},{"location":"contributing/issues-and-pull-requests/#opening-an-issue","title":"Opening an Issue","text":"<p>Attention</p> <p>Before opening an issue, read the <code>README</code> carefully, study the docs for your version (maybe latest) and your search engine you trust. The issue tracker is not meant to be used for unrelated questions!</p> <p>When opening an issue, please provide details use case to let the community reproduce your problem.</p> <p>Attention</p> <p>Use the issue templates to provide the necessary information. Issues which do not use these templates are not worked on and closed.</p> <p>By raising issues, I agree to these terms and I understand, that the rules set for the issue tracker will help both maintainers as well as everyone to find a solution.</p> <p>Maintainers take the time to improve on this project and help by solving issues together. It is therefore expected from others to make an effort and comply with the rules.</p>"},{"location":"contributing/issues-and-pull-requests/#filing-a-bug-report","title":"Filing a Bug Report","text":"<p>Thank you for participating in this project and reporting a bug. wg-easy is a community-driven project, and each contribution counts!</p> <p>Maintainers and moderators are volunteers. We greatly appreciate reports that take the time to provide detailed information via the template, enabling us to help you in the best and quickest way. Ignoring the template provided may seem easier, but discourages receiving any support (via assignment of the label <code>meta/no template - no support</code>).</p> <p>Markdown formatting can be used in almost all text fields (unless stated otherwise in the description).</p> <p>Be as precise as possible, and if in doubt, it's best to add more information that too few.</p> <p>When an option is marked with \"not officially supported\" / \"unsupported\", then support is dependent on availability from specific maintainers.</p>"},{"location":"contributing/issues-and-pull-requests/#pull-requests","title":"Pull Requests","text":"<p>Motivation</p> <p>You want to add a feature? Feel free to start creating an issue explaining what you want to do and how you're thinking doing it. Other users may have the same need and collaboration may lead to better results.</p>"},{"location":"contributing/issues-and-pull-requests/#submit-a-pull-request","title":"Submit a Pull-Request","text":"<p>The development workflow is the following:</p> <ol> <li>Fork the project</li> <li>Write the code that is needed :D</li> <li>Document your improvements if necessary</li> <li>Commit (and sign your commit), push and create a pull-request to merge into <code>master</code>. Please use the pull-request template to provide a minimum of contextual information and make sure to meet the requirements of the checklist.</li> </ol> <p>Pull requests are automatically tested against the CI and will be reviewed when tests pass. When your changes are validated, your branch is merged. CI builds the new <code>:nightly</code> image every night and your changes will be includes in the next version release.</p>"},{"location":"examples/tutorials/adguard/","title":"AdGuard Home","text":"<p>TODO</p>"},{"location":"examples/tutorials/auto-updates/","title":"Auto Updates","text":""},{"location":"examples/tutorials/auto-updates/#docker-compose","title":"Docker Compose","text":"<p>With Docker Compose <code>wg-easy</code> can be updated with a single command:</p> <p>Replace <code>$DIR</code> with the directory where your <code>docker-compose.yml</code> is located.</p> <pre><code>cd $DIR\nsudo docker compose up -d --pull always\n</code></pre>"},{"location":"examples/tutorials/auto-updates/#docker-run","title":"Docker Run","text":"<pre><code>sudo docker stop wg-easy\nsudo docker rm wg-easy\nsudo docker pull ghcr.io/wg-easy/wg-easy\n</code></pre> <p>And then run the <code>docker run -d \\ ...</code> command from Docker Run again.</p>"},{"location":"examples/tutorials/auto-updates/#podman","title":"Podman","text":"<p>To update <code>wg-easy</code> (and every container that has auto updates enabled), you can run the following command:</p> <pre><code>sudo podman auto-update\n</code></pre>"},{"location":"examples/tutorials/basic-installation/","title":"Basic Installation","text":""},{"location":"examples/tutorials/basic-installation/#requirements","title":"Requirements","text":"<ol> <li>You need to have a host that you can manage</li> <li>You need to have a domain name or a public IP address</li> <li>You need a supported architecture (x86_64, arm64)</li> <li>You need curl installed on your host</li> </ol>"},{"location":"examples/tutorials/basic-installation/#install-docker","title":"Install Docker","text":"<p>Follow the Docs here: https://docs.docker.com/engine/install/ and install Docker on your host.</p>"},{"location":"examples/tutorials/basic-installation/#install-wg-easy","title":"Install <code>wg-easy</code>","text":"<ol> <li>Create a directory for the configuration files (you can choose any directory you like):</li> </ol> <pre><code>DIR=/docker/wg-easy\nsudo mkdir -p $DIR\n</code></pre> <ol> <li>Download docker compose file</li> </ol> <pre><code>sudo curl -o $DIR/docker-compose.yml https://raw.githubusercontent.com/wg-easy/wg-easy/master/docker-compose.yml\n</code></pre> <ol> <li>Start <code>wg-easy</code></li> </ol> <pre><code> sudo docker-compose -f $DIR/docker-compose.yml up -d\n</code></pre>"},{"location":"examples/tutorials/basic-installation/#setup-firewall","title":"Setup Firewall","text":"<p>If you are using a firewall, you need to open the following ports:</p> <ul> <li>UDP 51820 (WireGuard)</li> <li>TCP 51821 (Web UI)</li> </ul> <p>These ports can be changed, so if you change them you have to update your firewall rules accordingly.</p>"},{"location":"examples/tutorials/basic-installation/#setup-reverse-proxy","title":"Setup Reverse Proxy","text":"<p>TODO</p>"},{"location":"examples/tutorials/basic-installation/#access-the-web-ui","title":"Access the Web UI","text":"<p>Open your browser and navigate to <code>https://<your-domain>:51821</code> or <code>https://<your-ip>:51821</code>.</p> <p>Follow the instructions to set up your WireGuard VPN.</p>"},{"location":"examples/tutorials/basic-installation/#update-wg-easy","title":"Update <code>wg-easy</code>","text":"<p>To update <code>wg-easy</code> to the latest version, run:</p> <pre><code>sudo docker-compose -f $DIR/docker-compose.yml pull\nsudo docker-compose -f $DIR/docker-compose.yml up -d\n</code></pre>"},{"location":"examples/tutorials/basic-installation/#auto-update","title":"Auto Update","text":"<p>If you want to enable auto-updates, follow the instructions here: Auto Updates</p>"},{"location":"examples/tutorials/caddy/","title":"Caddy","text":"<p>TODO</p>"},{"location":"examples/tutorials/docker-run/","title":"Docker Run","text":"<p>To setup the IPv6 Network, simply run once:</p> <pre><code> docker network create \\\n -d bridge --ipv6 \\\n -d default \\\n --subnet 10.42.42.0/24 \\\n --subnet fdcc:ad94:bacf:61a3::/64 wg \\\n</code></pre> <p>To automatically install & run ``wg-easy, simply run:</p> <pre><code> docker run -d \\\n --net wg \\\n -e INSECURE=true \\\n --name wg-easy \\\n --ip6 fdcc:ad94:bacf:61a3::2a \\\n --ip 10.42.42.42 \\\n -v ~/.wg-easy:/etc/wireguard \\\n -v /lib/modules:/lib/modules:ro \\\n -p 51820:51820/udp \\\n -p 51821:51821/tcp \\\n --cap-add NET_ADMIN \\\n --cap-add SYS_MODULE \\\n --sysctl net.ipv4.ip_forward=1 \\\n --sysctl net.ipv4.conf.all.src_valid_mark=1 \\\n --sysctl net.ipv6.conf.all.disable_ipv6=0 \\\n --sysctl net.ipv6.conf.all.forwarding=1 \\\n --sysctl net.ipv6.conf.default.forwarding=1 \\\n --restart unless-stopped \\\n ghcr.io/wg-easy/wg-easy:15\n</code></pre> <p>The Web UI will now be available on <code>http://0.0.0.0:51821</code>.</p> <p>\ud83d\udca1 Your configuration files will be saved in <code>~/.wg-easy</code></p>"},{"location":"examples/tutorials/dockerless/","title":"Without Docker","text":"<p>TODO</p>"},{"location":"examples/tutorials/nginx/","title":"NGINX","text":"<p>TODO</p>"},{"location":"examples/tutorials/podman/","title":"Podman","text":"<p>This guide will show you how to run <code>wg-easy</code> with rootful Podman and nftables.</p>"},{"location":"examples/tutorials/podman/#requirements","title":"Requirements","text":"<ol> <li>Podman installed with version 4.4 or higher</li> </ol>"},{"location":"examples/tutorials/podman/#configuration","title":"Configuration","text":"<p>Create a Folder for the configuration files:</p> <pre><code>sudo mkdir -p /etc/containers/systemd/wg-easy\nsudo mkdir -p /etc/containers/volumes/wg-easy\n</code></pre> <p>Create a file <code>/etc/containers/systemd/wg-easy/wg-easy.container</code> with the following content:</p> <pre><code>[Container]\nContainerName=wg-easy\nImage=ghcr.io/wg-easy/wg-easy:15\nAutoUpdate=registry\n\nVolume=/etc/containers/volumes/wg-easy:/etc/wireguard:Z\nNetwork=wg-easy.network\nPublishPort=51820:51820/udp\nPublishPort=51821:51821/tcp\n\n# this is used to allow access over HTTP\n# remove this when using a reverse proxy\nEnvironment=INSECURE=true\n\nAddCapability=NET_ADMIN\nAddCapability=SYS_MODULE\nAddCapability=NET_RAW\nSysctl=net.ipv4.ip_forward=1\nSysctl=net.ipv4.conf.all.src_valid_mark=1\nSysctl=net.ipv6.conf.all.disable_ipv6=0\nSysctl=net.ipv6.conf.all.forwarding=1\nSysctl=net.ipv6.conf.default.forwarding=1\n\n[Install]\n# this is used to start the container on boot\nWantedBy=default.target\n</code></pre> <p>Create a file <code>/etc/containers/systemd/wg-easy/wg-easy.network</code> with the following content:</p> <pre><code>[Network]\nNetworkName=wg-easy\nIPv6=true\n</code></pre>"},{"location":"examples/tutorials/podman/#load-kernel-modules","title":"Load Kernel Modules","text":"<p>You will need to load the following kernel modules</p> <pre><code>wireguard\nnft_masq\n</code></pre> <p>Create a file <code>/etc/modules-load.d/wg-easy.conf</code> with the following content:</p> <pre><code>wireguard\nnft_masq\n</code></pre>"},{"location":"examples/tutorials/podman/#start-the-container","title":"Start the Container","text":"<pre><code>sudo systemctl daemon-reload\nsudo systemctl start wg-easy\n</code></pre>"},{"location":"examples/tutorials/podman/#edit-hooks","title":"Edit Hooks","text":"<p>In the Admin Panel of your WireGuard server, go to the <code>Hooks</code> tab and add the following hook:</p> <ol> <li>PostUp</li> </ol> <pre><code>apk add nftables; nft add table inet wg_table; nft add chain inet wg_table postrouting { type nat hook postrouting priority 100 \\; }; nft add rule inet wg_table postrouting ip saddr {{ipv4Cidr}} oifname {{device}} masquerade; nft add rule inet wg_table postrouting ip6 saddr {{ipv6Cidr}} oifname {{device}} masquerade; nft add chain inet wg_table input { type filter hook input priority 0 \\; policy drop \\; }; nft add rule inet wg_table input udp dport {{port}} accept; nft add rule inet wg_table input tcp dport {{uiPort}} accept; nft add chain inet wg_table forward { type filter hook forward priority 0 \\; policy drop \\; }; nft add rule inet wg_table forward iifname \"wg0\" accept; nft add rule inet wg_table forward oifname \"wg0\" accept;\n</code></pre> <ol> <li>PostDown</li> </ol> <pre><code>nft delete table inet wg_table\n</code></pre> <p>If you don't have iptables loaded on your server, you could see many errors in the logs or in the UI. You can ignore them.</p>"},{"location":"examples/tutorials/podman/#restart-the-container","title":"Restart the Container","text":"<p>Restart the container to apply the new hooks:</p> <pre><code>sudo systemctl restart wg-easy\n</code></pre>"},{"location":"examples/tutorials/traefik/","title":"Traefik","text":"<p>TODO</p>"}]}
|