Skip to content

Configuration File Reference

General Options

OptionTypeDefaultExplanation
Socketstring/tmp/wag.sockAdministrative unix socket path
GIDintProcess GIDGroup ID for unix socket
CheckUpdatesstringtrueEnable checking updates (reaches out to github)
NumberProxiesint0Number of reverse proxies
DevModeboolfalseEnable debug mode, will enable a pprof server on :6060
ExposePorts[]stringnoneList of ports to expose externally
NATbooltrueEnable Network Address Translation

Webserver

OptionTypeDefaultExplanation
Lockoutint5Number of allowed authentication attempts before account is locked

ACME

Configuration block for automatically getting TLS certificates, supports DNS-01 and HTTP-01 challenge types.

OptionTypeDefaultExplanation
Emailstring-Your email address to give to the acme provider
CAProviderstringhttps://acme-staging-v02.api.letsencrypt.org/directoryThe ACME provider to talk to for certificates
CloudflareDNSTokenstring-Cloudflare API token for adding DNS-01 challenge

Public

The public webserver configuration options, this web server provides the wireguard configuration configs to your clients via the registration tokens endpoint.

It also accepts webhooks.

OptionTypeDefaultExplanation
DownloadConfigFileNamestringwg0.confThe filename for the generated wireguard profile
ExternalAddressstring-The IP or domain that the wireguard port can be reached
Domainstring-The domain of the public webserver, must be defined for ACME
ListenAddressstring-Listen address for the public registration endpoint
TLSboolfalseEnable TLS on this endpoint (will automatically use ACME if certificate paths are not defined)
CertificatePathstring-Path to certificate to load in on first run
PrivateKeyPathstring-Path to private key to load into wag on first run
ExternalAddressstring-External address to be baked in to generated wireguard configs, i.e where your wireguard connections connect to.

Tunnel

The webserver configurations for VPN tunnel handler, this will handle authentication and user exposed apis, such as those that return the user routes.

OptionTypeDefaultExplanation
Portstring-Port for the tunnel endpoint
Domainstring-Domain
TLSboolfalseEnable TLS on this endpoint (will automatically use ACME if certificate paths are not defined)
CertificatePathstring-Path to certificate to load on first run
PrivateKeyPathstring-Path to private key to load on first run
HelpMailstring-Email address that is displayed in error messages
MaxSessionLifetimeMinutesint-Maximum session lifetime in minutes
SessionInactivityTimeoutMinutesint-Session inactivity timeout in minutes
DefaultMethodstring-Default MFA authentication method
Issuerstring-Issuer identifier for authentication
Methods[]string-List of available authentication methods, can be totp, webauthn, oidc, pam, some of these methods may require additional configuration
OIDC.IssuerURLstring-OpenID Connect issuer URL
OIDC.ClientSecretstring-OpenID Connect client secret
OIDC.ClientIDstring-OpenID Connect client ID
OIDC.GroupsClaimNamestring-Name of the groups claim in OIDC tokens
OIDC.DeviceUsernameClaimstring-Name of the device username claim in OIDC tokens
OIDC.Scopes[]string-List of OIDC scopes to request
PAM.ServiceNamestring-PAM service name for authentication

Management

Configuration options for the management web interface, when password is enable (which is default) an administrative user is generated on first run.

Otherwise you can configure OIDC for login.

OptionTypeDefaultExplanation
Domainstring-Domain
TLSboolfalseEnable TLS on this endpoint (will automatically use ACME if certificate paths are not defined)
CertificatePathstring-Path to certificate to load on first run
PrivateKeyPathstring-Path to private key to load on first run
ListenAddressstring-Listen address for the management UI endpoint
EnabledbooltrueEnable the management UI
Password.Enabledbool-Enable password authentication
OIDC.Enabledbool-Enable OpenID Connect authentication
OIDC.IssuerURLstring-OpenID Connect issuer URL authentication
OIDC.ClientSecretstring-OpenID Connect client secret
OIDC.ClientIDstring-OpenID Connect client ID

Clustering

Wag has two modes of clustering, you can either set up an external ETCd cluster then attach wag clients to it, or you can use the in-built local cluster.

Local Clustering

OptionTypeDefaultExplanation
Namestring-Name of the etcd cluster
ListenAddresses[]string-Listen address of etcd
Peersmap[string][]string-Map of peer nodes and their addresses
DatabaseLocationstring-Path to store etcd database on disk
ETCDLogLevelstring-Log level for ETCD
Witnessbool-Enable witness mode for the cluster node, this means that wireguard will not be spun up, this will only be for running etcd
ClusterStatestring-Initial state of the cluster, i.e are you creating a new cluster or joining an existing one
TLSManagerStoragestring-Where to store automatically generate certificates for etcd
TLSManagerListenURLstring-URL for the TLS manager to listen on, if you want to join other wag instances to the local cluster this must be exposed to copy down certificates

Remote Clustering

These options are used if wag is connecting to a remote etcd cluster. This will disable the cluster management features within wag.

Please read the ETCD configuration documentation here:

https://pkg.go.dev/go.etcd.io/etcd/client/v3#ConfigSpec

Wireguard

These are the options for configuring the wireguard device.

OptionTypeDefaultExplanation
DevNamestring-Device name for the wireguard interface
ListenPortint-Port for wireguard to listen on
PrivateKeystring-Private key for the wireguard interface
Addressstring-Network range for VPN, i.e 192.168.2.1/24 will give you a /24 network
MTUint-Maximum transmission unit for the wireguard interface
LogLevelint-Log level for wireguard
ServerPersistentKeepAliveintdisabledPersistent keepalive interval in seconds
DNS[]string-List of DNS servers for wireguard clients

Full golang structure

go
type Config struct {
	Socket        string 
	GID           *int   
	CheckUpdates  bool   
	NumberProxies int
	DevMode       bool 

	ExposePorts []string 
	NAT         *bool    

	Webserver struct {
		Acme struct {
			Email              string
			CAProvider         string
			CloudflareDNSToken string
		}

		Public struct {
			webserverDetails
			DownloadConfigFileName string 
			ExternalAddress        string
		}

		Lockout int

		Tunnel struct {
			Port   string
			Domain string
			TLS    bool

			CertificatePath string
			PrivateKeyPath  string

			HelpMail string

			MaxSessionLifetimeMinutes       int
			SessionInactivityTimeoutMinutes int

			DefaultMethod string 
			Issuer        string
			Methods       []string 

			OIDC struct {
				IssuerURL           string
				ClientSecret        string
				ClientID            string
				GroupsClaimName     string   
				DeviceUsernameClaim string   
				Scopes              []string 
			} 

			PAM struct {
				ServiceName string
			} 
		}

		Management struct {
			webserverDetails

			Enabled bool

			Password struct {
				Enabled *bool 
			} 

			OIDC struct {
				IssuerURL    string
				ClientSecret string
				ClientID     string
				Enabled      bool
			} 
		} 
	}

	Clustering ClusteringDetails

	RemoteCluster *clientv3.ConfigSpec

	Wireguard struct {
		DevName    string
		ListenPort int
		PrivateKey string
		Address    string
		MTU        int

		LogLevel int

		//Not externally configurable
		Range                     *net.IPNet 
		ServerAddress             net.IP     
		ServerPersistentKeepAlive int

		DNS []string 
	}

}

Example configuration

json
{
    "Socket": "/tmp/wag.sock",
    "NumberProxies": 0,
    "ExposePorts": [
        "10/tcp",
        "100-500/tcp"
    ],
    "NAT": true,

    "Webserver": {
        "Lockout": 5,

        "Tunnel": {
            "Domain": "vpn.test",
            "Port": "8082",

            "MaxSessionLifetimeMinutes": 2,
            "SessionInactivityTimeoutMinutes": 1,

            "HelpMail": "[email protected]",

            "DefaultMethod": "totp",
            "Issuer": "vpn.test",
            "Methods": [
                "totp"
            ],
            "OIDC": {
                "IssuerURL": "",
                "ClientSecret": "",
                "ClientID": "",
                "DeviceUsernameClaim": "",
                "Scopes": []
            },
            "PAM": {
                "ServiceName": ""
            }
        },

        "Public": {
            "ListenAddress": ":8081",
         

            "ExternalAddress": "192.168.121.61",
            "DownloadConfigFileName": "wg0.conf"

        },
        "Management": {
            "Enabled": true,
            "ListenAddress": "127.0.0.1:4433",
            "Password": {
                "Enabled": true
            },
            "OIDC": {
                "IssuerURL": "",
                "ClientSecret": "",
                "ClientID": "",
                "Enabled": false
            }
        }
    },

    "Wireguard": {
        "DevName": "wg1",
        "ListenPort": 53230,
        "PrivateKey": "<REPLACEME>",
        "Address": "192.168.122.1/24",
        "ServerPersistentKeepAlive": 0
        
    },
    "Clustering": {
        "ClusterState": "new",
        "ETCDLogLevel": "error",
        "ListenAddresses": [
            "https://127.0.0.1:2380"
        ],
        "TLSManagerListenURL": "https://127.0.0.1:3434"
    }
}

Released under the MIT License