aboutsummaryrefslogblamecommitdiffstatshomepage
path: root/index.html
blob: 3c27900f0febc53e0718f2f1bc83f38bd35d43cc (plain) (tree)
1
2
3
4
5
6
7
8
9





                
          
                                                              
                                                                
           








                                          
                                                         




                                                                               
                                                                           



                                                                     
                                               






                                          
                                                                                                                               



                                           
                                                                                                   














                                                                                  



                                                                               

                                                                                                                                                                                                                                                  


        
                                                                              


                            

                                   



                                                                                    
                              
                                


                                                                                                                                                                                           
                                                                                                           
                                                                                                                                                                     

                                           

                
              
            

            







                                                                                                    



            
 
                  
---
title: Main page
layout: plain
navbar:
  link: Main
  icon: home
custom_js:
  - https://cdn.jsdelivr.net/npm/ipaddr.js@2.0.1/ipaddr.min.js
  - https://cdn.jsdelivr.net/npm/qrious@4.0.2/dist/qrious.min.js
  - main.js

params:
  - id: server
    desc: Server
    items:
      - id: public_key
        name: Public key
        placeholder: "Server's public key"
        help: |
          Query using <code>wg show wg0 public-key</code>
      - id: endpoint
        name: Endpoint
        placeholder: "Server's endpoint in the HOST:PORT format"
        help: |
          Server's public IP address or a hostname, accessible from the client.
          Query the current port using <code>wg show wg0 listen-port</code>
      - id: preshared_key
        name: Preshared key
        placeholder: Preshared key (shared between server and client)
        help: |
          Generate using <code>wg genpsk</code>
  - id: client
    desc: Client
    items:
      - id: public_key
        name: Public key
        placeholder: "Client's public key"
        help: |
          Generate both the private and the public keys using <code>wg genkey | tee private.key | wg pubkey > public.key</code>
      - id: private_key
        name: Private key
        placeholder: "Client's private key"
        help: |
          Unless generated in one go with the public key, generate one using <code>wg genkey</code>
      - id: ipv4
        name: IPv4
        placeholder: IPv4 address and netmask, like 192.168.123.5/24
        help: |
          IPv4 address to assign to the client and its netmask in the CIDR format.
      - id: ipv6
        name: IPv6
        placeholder: IPv6 address and netmask, like fd01:2345:6789::5/48
        help: |
          IPv6 address to assign to the client and its netmask in the CIDR format.
---
<h1>WireGuard configuration</h1>

<div class="row">
  <div class="col-md-8">
    <p class="text-muted">This page assumes that you have a WireGuard server
configured on interface <code>wg0</code>.
You can then generate the new client's keys, feed them to this page and it will
show the configuration that can be easily consumed by the new client.</p>
    <p class="text-muted">An example configuration (with bogus key values) can
be seen <a href="https://egor-tensin.github.io/wireguard-config/?server_public_key=a&server_endpoint=b%3A123&server_preshared_key=c&client_public_key=d&client_private_key=e&client_ipv4=192.168.1.1%2F24&client_ipv6=fd%3A%3A%2F48">here</a>.</p>
  </div>
</div>

<form action="javascript:void(0);" onsubmit="form_on_submit(); return false;">
  <div class="row">
{% for grp in page.params %}
    <div class="col-md-6">
      <div class="form-horizontal">
        <div class="form-group">
          <div class="col-sm-offset-3 col-sm-9">
            <h2 class="text-center h3" style="margin-bottom: 0;">{{ grp.desc }}</h2>
          </div>
        </div>
  {% for param in grp.items %}
        <div class="form-group">
          <label for="param_{{ grp.id }}_{{ param.id }}" class="col-sm-3 control-label">{{ param.name }}</label>
          <div class="col-sm-9">
            <input type="text" class="form-control" id="param_{{ grp.id }}_{{ param.id }}" placeholder="{{ param.placeholder }}" aria-describedby="param_{{ grp.id }}_{{ param.id }}_help">
            <span id="param_{{ grp.id }}_{{ param.id }}_help" class="help-block" style="margin-bottom: 0;">
              <span id="param_{{ grp.id }}_{{ param.id }}_error" class="text-danger small" style="display: block; white-space: pre-line; margin-bottom: 5px;"></span>
              <span>{{ param.help }}</span>
            </span>
          </div>
        </div>
  {% endfor %}
      </div>
    </div>
{% endfor %}
    <div class="col-md-offset-6 col-md-6">
      <div class="row">
        <div class="col-sm-offset-3 col-sm-9 text-center">
          <button type="submit" class="btn btn-primary">Generate</button>
          <span class="help-block" style="margin-bottom: 0;">
            <span id="params_error" class="text-danger small" style="white-space: pre-line;"></span>
          </span>
        </div>
      </div>
    </div>
  </div>
</form>

<div id="guides"/>