diff --git a/configs/ssh/config b/configs/ssh/config index 967a558..01c4648 100644 --- a/configs/ssh/config +++ b/configs/ssh/config @@ -19,10 +19,11 @@ Host ewpratten-* User ewpratten # VPN -Host *.pratten.ca +Host vpn.pratten.ca User evan -Host *.vpn - ProxyJump vpn.pratten.ca + Hostname 10.10.0.1 +# Host *.vpn +# ProxyJump vpn.pratten.ca # Home network Host unifi diff --git a/scripts/pratten-edge b/scripts/pratten-edge new file mode 100755 index 0000000..799ea67 --- /dev/null +++ b/scripts/pratten-edge @@ -0,0 +1,75 @@ +#! /bin/bash +set -e + +case "$1" in + dns) + case "$2" in + check) + if [[ -z "$3" ]]; then + echo "Usage: $(basename $0) dns check " >&2 + exit 1 + fi + ssh -t vpn.pratten.ca docker exec -it services-pihole-1 pihole query "$3" + ;; + flush) + ssh -t vpn.pratten.ca docker exec -it services-pihole-1 pihole flush + ;; + monitor) + ssh -t vpn.pratten.ca docker exec -it services-pihole-1 pihole chronometer + ;; + refresh) + ssh -t vpn.pratten.ca docker exec -it services-pihole-1 pihole updateGravity + ;; + tail) + ssh -t vpn.pratten.ca docker exec -it services-pihole-1 pihole tail + ;; + *) + echo "Usage: $(basename $0) dns {command}" >&2 + echo " check: Check if a domain is blocked" >&2 + echo " flush: Flush the DNS cache" >&2 + echo " monitor: Monitor the DNS server" >&2 + echo " refresh: Refresh the blocklists" >&2 + echo " tail: Tail the DNS server logs" >&2 + exit 1 + ;; + esac + ;; + proxy) + case "$2" in + edit) + if [[ -z "$3" ]]; then + echo "Usage: $(basename $0) proxy edit {internal|external}" >&2 + exit 1 + fi + ssh -t vpn.pratten.ca sudoedit "/root/services/caddy/$3/Caddyfile" + ;; + restart) + if [[ -z "$3" ]]; then + echo "Usage: $(basename $0) proxy restart {internal|external}" >&2 + exit 1 + fi + ssh -t vpn.pratten.ca sudo docker-compose -f /root/services/docker-compose.yml restart "caddy_$3" + ;; + tail|logs) + if [[ -z "$3" ]]; then + echo "Usage: $(basename $0) proxy {tail|logs} {internal|external}" >&2 + exit 1 + fi + ssh -t vpn.pratten.ca sudo docker-compose -f /root/services/docker-compose.yml logs -f "caddy_$3" + ;; + *) + echo "Usage: $(basename $0) proxy {command} " >&2 + echo " edit: Edit the proxy configuration" >&2 + echo " restart: Restart the proxy" >&2 + echo " tail: Tail the proxy logs" >&2 + exit 1 + ;; + esac + ;; + *) + echo "Usage: $(basename $0) {dns} [args]" >&2 + echo " dns: Interact with the DNS server" >&2 + echo " proxy: Interact with the HTTP proxies" >&2 + exit 1 + ;; +esac \ No newline at end of file