From a991f19ca3e86b4c2f009c82429ba2d9fce1b80a Mon Sep 17 00:00:00 2001 From: oldnick85 Date: Thu, 9 Feb 2023 21:59:37 +0300 Subject: [PATCH] [add] autoconfiguration yggdrasil --- Dockerfile | 3 ++- README.md | 7 ++----- entrypoint.sh | 17 ++++++++++++++++- yggdrasil.conf | 6 +++--- 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2515145..2aaa986 100644 --- a/Dockerfile +++ b/Dockerfile @@ -60,7 +60,8 @@ RUN DEBIAN_FRONTEND=noninteractive\ zlib1g RUN DEBIAN_FRONTEND=noninteractive\ apt-get install -y \ - libminiupnpc17 + libminiupnpc17 \ + git python3 iputils-ping # Ports Used by I2P # Webconsole EXPOSE 7070 diff --git a/README.md b/README.md index 41f3807..6f520f3 100644 --- a/README.md +++ b/README.md @@ -5,11 +5,8 @@ This project is a set of tools for building [I2PD](https://i2pd.website/) over [YGGDRASIL](https://yggdrasil-network.github.io/) docker images. No clearnet for i2p, only yggdrasil! -## First of all! - -Before rest of all you have to make changes in configuration files: - -* yggdrasil.conf: fill *Peers* with outbound peer connections, *PublicKey* and *PrivateKey* with generated [keys](https://yggdrasil-network.github.io/configuration.html) +At startup, the script searches YGGDRASIL public peers and chooses several best of them. +Then it generates YGGDRASIL *PublicKey* and *PrivateKey* unless the keys not set in environment variables. ## Building diff --git a/entrypoint.sh b/entrypoint.sh index fbc349e..3bbd55f 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,7 +1,22 @@ #!/bin/bash +git clone https://github.com/oldnick85/yggdrasil_get_keys.git /tmp/yggdrasil_get_keys +python3 /tmp/yggdrasil_get_keys/yggdrasil_get_keys.py \ + --genkeys="/YGGDRASIL/genkeys" \ + --yggdrasil-conf="/YGGDRASIL/yggdrasil.conf" \ + --timeout=10 \ + --environment +rm -rf /tmp/yggdrasil_get_keys +git clone https://github.com/oldnick85/yggdrasil_find_public_peers.git /tmp/yggdrasil_find_public_peers +python3 /tmp/yggdrasil_find_public_peers/yggdrasil_find_public_peers.py \ + --yggdrasil-conf="/YGGDRASIL/yggdrasil.conf" \ + --parallel=4 \ + --pings=10 \ + --best=5 \ + --ping-interval=0.5 +rm -rf yggdrasil_find_public_peers sysctl net.ipv6.conf.all.disable_ipv6=0 || true /YGGDRASIL/yggdrasil -useconffile /YGGDRASIL/yggdrasil.conf & sleep 1m /I2PD/i2pd --datadir /I2PD --conf /I2PD/i2pd.conf & wait -n -exit $? +exit $? \ No newline at end of file diff --git a/yggdrasil.conf b/yggdrasil.conf index f628c44..db45fc3 100644 --- a/yggdrasil.conf +++ b/yggdrasil.conf @@ -3,7 +3,7 @@ # e.g. tls://a.b.c.d:e or socks://a.b.c.d:e/f.g.h.i:j. These connections # will obey the operating system routing table, therefore you should # use this section when you may connect via different interfaces. - Peers: [!!!CHANGE_ME!!!] + Peers: [] # List of connection strings for outbound peer connections in URI format, # arranged by source interface, e.g. { "eth0": [ "tls://a.b.c.d:e" ] }. @@ -54,10 +54,10 @@ # Your public key. Your peers may ask you for this to put # into their AllowedPublicKeys configuration. - PublicKey: !!!CHANGE_ME!!! + PublicKey: # Your private key. DO NOT share this with anyone! - PrivateKey: !!!CHANGE_ME!!! + PrivateKey: # Local network interface name for TUN adapter, or "auto" to select # an interface automatically, or "none" to run without TUN.