DN42 peer config generation utility

fox.cpp a412937fe9 Add support for per-peer local link address override 1 month ago
example_output 93b3c1758b Add option to override local WG port 1 month ago
.gitignore 7ffd78e668 Add example_output 2 months ago
LICENSE f58977cc5a Initial commit 3 months ago
README.md a26c66debb Rollback dn42_all change, fix IP addresses parsing mess 2 months ago
alpha.example.toml 93b3c1758b Add option to override local WG port 1 month ago
go.mod f58977cc5a Initial commit 3 months ago
go.sum f58977cc5a Initial commit 3 months ago
peergen.go a412937fe9 Add support for per-peer local link address override 1 month ago

README.md

peergen

BIRD + networkd configuration generation utility for DN42 peerings

Supports only Wireguard now. Assumes BIRD configuration from https://git.hexanet.dev/foxcpp/chicken-coop

Compilation

As usual for Go.

go build

Configuration templates used

The whole thing is IPv6-only. Encourage proper IPv6 support and annoy people who have broken or missing IPv6!

peergen generates .netdev and .network files for use by systemd-networkd and drop-in .conf files for use by BIRD 2.

systemd-networkd configuration files contain inline private key for compatibilty with old systemd versions. Unless disabled via CLI flag, permissions are adjusted to make .netdev files accessible only for networkd. Generated files use 30000-39999 port range for tunnels.

BIRD 2 configuration is generated with the assumption that you have the function dn42_auth and dn42_all defined as below

function dn42_auth(int link_latency; int link_bandwidth; int link_crypto)
function dn42_all(int link_latency; int link_bandwidth; int link_crypto)

Usable implementations of this function can be found in https://git.hexanet.dev/foxcpp/chicken-coop/src/branch/master/common/dn42_filters.conf

Additionally, it expects you to have dn42_peer protocol template defined with shared configuration directives.

Again, here is the example from our configuration: https://git.hexanet.dev/foxcpp/chicken-coop/src/branch/master/common/dn42.conf

peergen generates a separate configuration file defining each protocol instance and places it in a directory specified via configuration flags. You can include all files from the directory in your main configuration using something like include "/etc/bird/dn42_peers/*.conf";

peergen renames all files ending in .conf from the used directory to have ~ suffix. Files with manual_ prefix are never touched. Same logic is applied for networkd, but all files with dn42 prefix are affected.

peergen configuration

See alpha.example.toml. It should not be hard to figure out.

Run:

# ./peergen -cfg alpha.example.toml
# networkctl reload 
# birdc configure