#!/bin/bash # # Wireguard / VPN Service PATH=$HOME/.docker/cli-plugins:/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin get_appvars config_wireguard() { echo -ne "* Configuring wireguard container.." if [ ! -d "/federated/apps/wireguard" ]; then mkdir -p /federated/apps/wireguard/data/config/coredns fi cat > /federated/apps/wireguard/docker-compose.yml < /federated/apps/wireguard/.env < /federated/apps/wireguard/data/config/coredns/Corefile < /federated/apps/mail/data/root/certs/mailfile <

Wireguard is now installed on $DOMAIN

Your core comes with a very powerful VPN solution built using Wireguard. The following information is needed by your users so that they can use the VPN. Please treat this information as a very important secret. There are two important parts of the VPN:

Here is your VPN configuration:
EOF sed "s/$/
/" /federated/apps/wireguard/data/config/peer1/peer1.conf >> /federated/apps/mail/data/root/certs/mailfile cat >> /federated/apps/mail/data/root/certs/mailfile <

Thanks for your support!

Thank you for your support of Federated Computer. We really appreciate it and hope you have a very successful time with Federated Core.

Again, if we can be of any assistance, please don't hesitate to get in touch.

Support: https://support.federated.computer
Phone: (970) 722-8715
Email: support@federated.computer

It's your computer. Let's make it work for you! EOF # Send out e-mail from mail container with details docker exec mail bash -c "mail -r admin@$DOMAIN -a \"Content-type: text/html\" -s \"Application installed on $DOMAIN\" $EMAIL < /root/certs/mailfile" rm /federated/apps/mail/data/root/certs/mailfile kill -9 $SPINPID &> /dev/null echo -ne "done.\n" } uninstall_wireguard() { echo -ne "* Uninstalling wireguard container.." spin & SPINPID=$! # First stop the service cd /federated/apps/wireguard && docker compose -f docker-compose.yml -p wireguard down &> /dev/null # Delete the app directory rm -rf /federated/apps/wireguard kill -9 $SPINPID &> /dev/null echo -ne "done.\n" } start_wireguard() { # Start service with command to make sure it's up before proceeding start_service "wireguard" "nc -uvz 192.168.0.24 51820 &> /dev/null" "8" echo -ne "done." }