diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b16cd90 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +Makefile.conf +tmp/ +keys/ +configs/ diff --git a/Makefile.conf.sample b/Makefile.conf.sample new file mode 100644 index 0000000..2ab9728 --- /dev/null +++ b/Makefile.conf.sample @@ -0,0 +1,27 @@ +##### PARAMS + +nets = myfirstnet + +net_myfirstnet_domain = net.private +net_myfirstnet_hosts = privatehost1 privatehost2 + +net_myfirstnet_privatehost1_public_address = privatehost1.private.lan +net_myfirstnet_privatehost1_local_address = 192.168.100.1/24 +net_myfirstnet_privatehost1_local_subnets = 192.168.100.0/24 192.168.10.0/24 192.168.20.0/24 + +net_myfirstnet_privatehost2_local_address = 192.168.101.1/24 +net_myfirstnet_privatehost2_local_subnets = 192.168.101.0/24 + +nets += mysecondnet + +net_mysecondnet_domain = mysecondnet.public +net_mysecondnet_hosts = host1 host2 + +net_mysecondnet_host1_public_address = host1.somedomain.com +net_mysecondnet_host1_public_port = 656 +net_mysecondnet_host1_local_address = 192.168.200.2/24 +net_mysecondnet_host1_local_subnets = 192.168.200.0/24 + +net_mysecondnet_host2_public_address = host2.otherdomain.com +net_mysecondnet_host2_local_address = 192.168.201.1/24 +net_mysecondnet_host2_local_subnets = 192.168.201.0/24 192.168.111.0/24 192.168.112.0/24 diff --git a/README.md b/README.md index 5a14354..3bdebbf 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,11 @@ -# tinc +# Script de génération de configuration pour le VPN tinc + +Ce dépot contient un Makefile permettant de simplifier la génération des confs pour le VPN [tinc](https://tinc-vpn.org) + +## Génération des confs + +1. Faites une copie du fichier Makefile.conf.sample nomée Makefile.conf. +2. Editez ce dernier avec vos préférences. +3. Lancez la génération des confs avec la commande ```make``` +4. Copiez les configurations générées vers les hôtes respectifs. -Scripts pour générer des confs pour [tinc](https://tinc-vpn.org) \ No newline at end of file diff --git a/scripts/subnet-down b/scripts/subnet-down new file mode 100755 index 0000000..53daab7 --- /dev/null +++ b/scripts/subnet-down @@ -0,0 +1,6 @@ +#!/bin/sh + +if [ "$NODE" != "$HOSTNAME" ] +then + ip route delete $SUBNET dev $INTERFACE +fi diff --git a/scripts/subnet-up b/scripts/subnet-up new file mode 100755 index 0000000..819c3d8 --- /dev/null +++ b/scripts/subnet-up @@ -0,0 +1,6 @@ +#!/bin/sh + +if [ "$NODE" != "$NAME" ] +then + ip route add $SUBNET dev $INTERFACE +fi diff --git a/scripts/tinc-down b/scripts/tinc-down new file mode 100755 index 0000000..d8558dd --- /dev/null +++ b/scripts/tinc-down @@ -0,0 +1,3 @@ +#!/bin/sh + +ip link set $INTERFACE down diff --git a/scripts/tinc-up b/scripts/tinc-up new file mode 100755 index 0000000..c1d5ff7 --- /dev/null +++ b/scripts/tinc-up @@ -0,0 +1,7 @@ +#!/bin/sh + +ADDRESS= + +ip address add $ADDRESS dev $INTERFACE +ip link set $INTERFACE up +