Generate WireGuard tunnel configs
Go to file
Arash Hatami 301b51cee6
add toml req
2023-04-17 16:07:23 +03:30
.github Update actions/setup-python action to v4 2023-03-03 18:38:18 +00:00
.gitattributes Initial commit 2022-09-25 11:11:51 +03:30
.gitignore Update .gitignore 2023-04-17 15:05:53 +03:30
Makefile add install target 2023-04-17 15:06:05 +03:30
README.md Update README.md 2022-09-26 15:02:14 +03:30
main.py Update main.py 2023-03-03 22:03:27 +03:30
requirements.txt add toml req 2023-04-17 16:07:23 +03:30

README.md

WireGuard config generator

made-with-python GitHub release Pylint CodeQL

This simple script will generate tunnel config files for WireGuard.

How to use

You need to give two file contains your information:

  • endpoints.json : Contains the endpoints you want to connect to ( Name, Address ).
  • ip-list.json : Contains the IP addresses you want to use.

And also give private/other information as a .env file.

endpoints.json

[
  {
    "name": "Company-Server-1",
    "address": "wg-1.domain.xyz:1234"
  },
  {
    "name": "Company-Server-2",
    "address": "wg-2.domain.xyz:1234"
  }
]

ip-list.json

{
  "k8s-cluster": [
    "1.2.3.4/32", 
    "5.6.7.8.9/32", 
    "1.2.3.4/27"
  ],
  "grafana": [
    "1.2.3.4/32", 
    "5.6.7.8.9/32", 
    "1.2.3.4/27"
  ],
  "other": [
    "1.2.3.4/32", 
    "5.6.7.8.9/32", 
    "1.2.3.4/27"
  ]
}

Note: Array keys ( grafana, other, etc ) are not important and can be used to group IP addresses for you to read/edit better.

.env

PRIVATE_KEY=
PUBLIC_KEY=
ADDRESS=
MTU=
PERSISTENT_KEEPALIVE=

Note: If you need extra data than the above, you should add your variables in main.py too.

Run

To generate config files for all endpoints, run:

make run

This script will create file(s) based on the given endpoints. In this example, it will create Company-Server-1.conf and Company-Server-2.conf files like this:

[Interface]
PrivateKey = <PRIVATE_KEY>
Address = <ADDRESS>
MTU = <MTU>

[Peer]
PublicKey = <PUBLIC_KEY>
Endpoint = wg-1.domain.xyz:1234
AllowedIPs = 1.2.3.4/32, 5.6.7.8/32, ...
PersistentKeepalive = <PERSISTENT_KEEPALIVE>

Now, you can import all generated configs in WireGuard.


Support 💛

Donate with Bitcoin Donate with Ethereum

ko-fi

Contributing 🤝

Don't be shy and reach out to us if you want to contribute 😉

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request

Issues

Each project may have many problems. Contributing to the better development of this project by reporting them. 👍