Remove wirehole tests

This commit is contained in:
Nicolas Meienberger 2022-04-24 14:22:02 +02:00
parent 21a871f682
commit 46e05e7919
6 changed files with 2 additions and 184 deletions

View file

@ -1,6 +0,0 @@
FROM ubuntu:latest
# Install curl
RUN apt-get update && apt-get install -y curl
ENTRYPOINT ["tail", "-f", "/dev/null"]

View file

@ -1,11 +0,0 @@
{
"name": "BusyBox",
"port": 3000,
"id": "busybox",
"description": "",
"short_desc": "",
"author": "",
"source": "",
"image": "https://raw.githubusercontent.com/docker-library/docs/cc5d5e47fd7e0c57c9b8de4c1bfb6258e0dac85d/busybox/logo.png",
"form_fields": {}
}

View file

@ -1,6 +0,0 @@
version: "3.7"
services:
test:
image: meienberger/ubuntu-test
networks:
- tipi_main_network

View file

@ -14,7 +14,7 @@ services:
pihole:
depends_on: [unbound]
container_name: pihole
container_name: pihole:2022.04.3
image: pihole/pihole:latest
restart: unless-stopped
hostname: pihole
@ -31,7 +31,7 @@ services:
environment:
TZ: ${TZ}
WEBPASSWORD: ${APP_PASSWORD}
PIHOLE_DNS_: 10.21.21.200 #127.0.0.1#5335
PIHOLE_DNS_: 10.21.21.200 # Points to unbound
FTLCONF_REPLY_ADDR4: 10.21.21.201
cap_add:
- NET_ADMIN

View file

@ -1,90 +0,0 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: GPL-2.0
#
# Copyright (C) 2016-2018 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
die() {
echo "[-] Error: $1" >&2
exit 1
}
PROGRAM="${0##*/}"
ARGS=( "$@" )
SELF="${BASH_SOURCE[0]}"
[[ $SELF == */* ]] || SELF="./$SELF"
SELF="$(cd "${SELF%/*}" && pwd -P)/${SELF##*/}"
[[ $UID == 0 ]] || exec sudo -p "[?] $PROGRAM must be run as root. Please enter the password for %u to continue: " -- "$BASH" -- "$SELF" "${ARGS[@]}"
[[ ${BASH_VERSINFO[0]} -ge 4 ]] || die "bash ${BASH_VERSINFO[0]} detected, when bash 4+ required"
type curl >/dev/null || die "Please install curl and then try again."
type jq >/dev/null || die "Please install jq and then try again."
set -e
read -p "[?] Please enter your Mullvad account number: " -r ACCOUNT
echo "[+] Contacting Mullvad API for server locations."
declare -A SERVER_ENDPOINTS
declare -A SERVER_PUBLIC_KEYS
declare -A SERVER_LOCATIONS
declare -a SERVER_CODES
RESPONSE="$(curl -LsS https://api.mullvad.net/public/relays/wireguard/v1/)" || die "Unable to connect to Mullvad API."
FIELDS="$(jq -r 'foreach .countries[] as $country (.; .; foreach $country.cities[] as $city (.; .; foreach $city.relays[] as $relay (.; .; $country.name, $city.name, $relay.hostname, $relay.public_key, $relay.ipv4_addr_in)))' <<<"$RESPONSE")" || die "Unable to parse response."
while read -r COUNTRY && read -r CITY && read -r HOSTNAME && read -r PUBKEY && read -r IPADDR; do
CODE="${HOSTNAME%-wireguard}"
SERVER_CODES+=( "$CODE" )
SERVER_LOCATIONS["$CODE"]="$CITY, $COUNTRY"
SERVER_PUBLIC_KEYS["$CODE"]="$PUBKEY"
SERVER_ENDPOINTS["$CODE"]="$IPADDR:51820"
done <<<"$FIELDS"
shopt -s nocasematch
for CODE in "${SERVER_CODES[@]}"; do
CONFIGURATION_FILE="/etc/wireguard/mullvad-$CODE.conf"
[[ -f $CONFIGURATION_FILE ]] || continue
while read -r line; do
[[ $line =~ ^PrivateKey\ *=\ *([a-zA-Z0-9+/]{43}=)\ *$ ]] && PRIVATE_KEY="${BASH_REMATCH[1]}" && break
done < "$CONFIGURATION_FILE"
[[ -n $PRIVATE_KEY ]] && echo "[+] Using existing private key." && break
done
shopt -u nocasematch
if [[ -z $PRIVATE_KEY ]]; then
echo "[+] Generating new private key."
PRIVATE_KEY="$(wg genkey)"
fi
echo "[+] Contacting Mullvad API."
RESPONSE="$(curl -sSL https://api.mullvad.net/wg/ -d account="$ACCOUNT" --data-urlencode pubkey="$(wg pubkey <<<"$PRIVATE_KEY")")" || die "Could not talk to Mullvad API."
[[ $RESPONSE =~ ^[0-9a-f:/.,]+$ ]] || die "$RESPONSE"
ADDRESS="$RESPONSE"
DNS="193.138.218.74"
echo "[+] Writing WriteGuard configuration files."
for CODE in "${SERVER_CODES[@]}"; do
CONFIGURATION_FILE="/etc/wireguard/mullvad-$CODE.conf"
umask 077
mkdir -p /etc/wireguard/
rm -f "$CONFIGURATION_FILE.tmp"
cat > "$CONFIGURATION_FILE.tmp" <<-_EOF
[Interface]
PrivateKey = $PRIVATE_KEY
Address = $ADDRESS
DNS = $DNS
[Peer]
PublicKey = ${SERVER_PUBLIC_KEYS["$CODE"]}
Endpoint = ${SERVER_ENDPOINTS["$CODE"]}
AllowedIPs = 0.0.0.0/0, ::/0
_EOF
mv "$CONFIGURATION_FILE.tmp" "$CONFIGURATION_FILE"
done
echo "[+] Success. The following commands may be run for connecting to Mullvad:"
for CODE in "${SERVER_CODES[@]}"; do
echo "- ${SERVER_LOCATIONS["$CODE"]}:"
echo " \$ wg-quick up mullvad-$CODE"
done
echo "Please wait up to 60 seconds for your public key to be added to the servers."

View file

@ -1,69 +0,0 @@
version: "3.7"
services:
# unbound:
# image: "mvance/unbound:latest"
# container_name: unbound
# restart: unless-stopped
# hostname: "unbound"
# volumes:
# - "./unbound:/opt/unbound/etc/unbound/"
# networks:
# private_network:
# ipv4_address: 10.21.21.50
wireguard:
depends_on: [pihole]
image: linuxserver/wireguard
container_name: wireguard
cap_add:
- NET_ADMIN
- SYS_MODULE
environment:
- PUID=1000
- PGID=1000
- TZ=${TZ} # Change to your timezone
- SERVERPORT=51822
- SERVERURL=mail.meienberger.dev #optional - For use with DDNS (Uncomment to use)
- PEERS=1 # How many peers to generate for you (clients)
- PEERDNS=10.21.21.51 # Set it to point to pihole
- INTERNAL_SUBNET=10.6.0.0
volumes:
- ${APP_DATA_DIR}/data/wireguard:/config
- /lib/modules:/lib/modules
ports:
- "51822:51820/udp"
dns:
- 10.21.21.51
sysctls:
- net.ipv4.conf.all.src_valid_mark=1
restart: unless-stopped
networks:
tipi_main_network:
ipv4_address: 10.21.21.52
pihole:
container_name: pihole
image: pihole/pihole:latest
restart: unless-stopped
hostname: pihole
dns:
- 127.0.0.1
# - 10.21.21.50 # Points to unbound
ports:
- 53:53/tcp
- 53:53/udp
- ${APP_PORT}:80
volumes:
- ${APP_DATA_DIR}/data/pihole:/etc/pihole
- ${APP_DATA_DIR}/data/dnsmasq:/etc/dnsmasq.d
environment:
TZ: ${TZ}
WEBPASSWORD: ${APP_PASSWORD}
PIHOLE_DNS_: 9.9.9.9 #127.0.0.1#5335
FTLCONF_REPLY_ADDR4: 10.21.21.51
cap_add:
- NET_ADMIN
networks:
tipi_main_network:
ipv4_address: 10.21.21.51