A mini web-based key generation service for Mikrotik that provides a ready for use CLI command to add a new wg peer, just put it into your Microtik terminal.
- Firstly, you need
dockeranddocker composehttps://docs.docker.com/engine/install/ubuntu/ - Make sure for not used tcp port
8055(if you need another, just editdocker-compose.yml - Run command
docker build -t wg-generate . && docker compose up -d - its ready to use
Run it:
curl -X GET "http://localhost:8055/?local_address=1.2.3.4&dns=8.8.8.8,8.8.4.4&endpoint=228.13.37.0&server_pubkey=ADmkdlsnghklsnklsdnlkh=&allowed_ips=192.168.0.0/24,10.10.1.1/32"ORcurl -X GET "http://localhost:8055/?local_address=1.2.3.4&dns=8.8.8.8,8.8.4.4&endpoint=228.13.37.0&server_pubkey=ADmkdlsnghklsnklsdnlkh=&allowed_ips=192.168.0.0/24,10.10.1.1/32" > test.conf
You may get something like this:
# /interface wireguard peer add public-key="Q...
[Interface]
PrivateKey = dYsxq/oaIY979obGCB2GAnFe6mQF7F6mLGUnQIhuBGc=
ListenPort = 46558
Address = 1.2.3.4
DNS = 8.8.8.8,8.8.4.4
[Peer]
PublicKey = ADmkdlsnghklsnklsdnlkh=
AllowedIPs = 192.168.0.0/24,10.10.1.1/32
Endpoint = 228.13.37.0This part put to your Mikrotik (with configured wg server for ex.):
/interface wireguard peer add public-key="QK4wzAuzF0D33YkgAzO+77o12sBAamXGhVZOBFKgPg4=" interface=wg0 allowed-address=1.2.3.4 persistent-keepalive=1m
This part you can save to test.conf and put it to Wireguard client programm:
[Interface]
PrivateKey = dYsxq/oaIY979obGCB2GAnFe6mQF7F6mLGUnQIhuBGc=
ListenPort = 46558
Address = 1.2.3.4
DNS = 8.8.8.8,8.8.4.4
[Peer]
PublicKey = ADmkdlsnghklsnklsdnlkh=
AllowedIPs = 192.168.0.0/24,10.10.1.1/32
Endpoint = 228.13.37.0I explained this Thanks for your stars🙏