TEXT 62
Wireguard Guest on 8th September 2021 07:34:55 PM
  1. nano wireguard-install.sh
  2.  
  3. insert text as following:
  4.  
  5. ###########################################################################
  6.  
  7. #!/bin/bash
  8.  
  9. # Secure WireGuard server installer for Debian, Ubuntu, CentOS, Fedora and Arch Linux
  10. # https://github.com/angristan/wireguard-install
  11.  
  12. RED='\033[0;31m'
  13. ORANGE='\033[0;33m'
  14. NC='\033[0m'
  15.  
  16. function isRoot() {
  17.         if [ "${EUID}" -ne 0 ]; then
  18.                 echo "You need to run this script as root"
  19.                 exit 1
  20.         fi
  21. }
  22.  
  23. function checkVirt() {
  24.         if [ "$(systemd-detect-virt)" == "openvz" ]; then
  25.                 echo "OpenVZ is not supported"
  26.                 exit 1
  27.         fi
  28.  
  29.         if [ "$(systemd-detect-virt)" == "lxc" ]; then
  30.                 echo "LXC is not supported (yet)."
  31.                 echo "WireGuard can technically run in an LXC container,"
  32.                 echo "but the kernel module has to be installed on the host,"
  33.                 echo "the container has to be run with some specific parameters"
  34.                 echo "and only the tools need to be installed in the container."
  35.                 exit 1
  36.         fi
  37. }
  38.  
  39. function checkOS() {
  40.         # Check OS version
  41.         if [[ -e /etc/debian_version ]]; then
  42.                 source /etc/os-release
  43.                 OS="${ID}" # debian or ubuntu
  44.                 if [[ ${ID} == "debian" || ${ID} == "raspbian" ]]; then
  45.                         if [[ ${VERSION_ID} -lt 10 ]]; then
  46.                                 echo "Your version of Debian (${VERSION_ID}) is not supported. Please use Debian 10 Buster or later"
  47.                                 exit 1
  48.                         fi
  49.                 fi
  50.         elif [[ -e /etc/fedora-release ]]; then
  51.                 source /etc/os-release
  52.                 OS="${ID}"
  53.         elif [[ -e /etc/centos-release ]]; then
  54.                 source /etc/os-release
  55.                 OS=centos
  56.         elif [[ -e /etc/arch-release ]]; then
  57.                 OS=arch
  58.         else
  59.                 echo "Looks like you aren't running this installer on a Debian, Ubuntu, Fedora, CentOS or Arch Linux system"
  60.                 exit 1
  61.         fi
  62. }
  63.  
  64. function initialCheck() {
  65.         isRoot
  66.         checkVirt
  67.         checkOS
  68. }
  69.  
  70. function installQuestions() {
  71.         echo "Welcome to the WireGuard installer!"
  72.         echo "The git repository is available at: https://github.com/angristan/wireguard-install"
  73.         echo ""
  74.         echo "I need to ask you a few questions before starting the setup."
  75.         echo "You can leave the default options and just press enter if you are ok with them."
  76.         echo ""
  77.  
  78.         # Detect public IPv4 or IPv6 address and pre-fill for the user
  79.         SERVER_PUB_IP=$(ip -4 addr | sed -ne 's|^.* inet \([^/]*\)/.* scope global.*$|\1|p' | head -1)
  80.         if [[ -z ${SERVER_PUB_IP} ]]; then
  81.                 # Detect public IPv6 address
  82.                 SERVER_PUB_IP=$(ip -6 addr | sed -ne 's|^.* inet6 \([^/]*\)/.* scope global.*$|\1|p' | head -1)
  83.         fi
  84.         read -rp "IPv4 or IPv6 public address: " -e -i "${SERVER_PUB_IP}" SERVER_PUB_IP
  85.  
  86.         # Detect public interface and pre-fill for the user
  87.         SERVER_NIC="$(ip -4 route ls | grep default | grep -Po '(?<=dev )(\S+)' | head -1)"
  88.         until [[ ${SERVER_PUB_NIC} =~ ^[a-zA-Z0-9_]+$ ]]; do
  89.                 read -rp "Public interface: " -e -i "${SERVER_NIC}" SERVER_PUB_NIC
  90.         done
  91.  
  92.         until [[ ${SERVER_WG_NIC} =~ ^[a-zA-Z0-9_]+$ && ${#SERVER_WG_NIC} -lt 16 ]]; do
  93.                 read -rp "WireGuard interface name: " -e -i wg0 SERVER_WG_NIC
  94.         done
  95.  
  96.         until [[ ${SERVER_WG_IPV4} =~ ^([0-9]{1,3}\.){3} ]]; do
  97.                 read -rp "Server's WireGuard IPv4: " -e -i 10.66.66.1 SERVER_WG_IPV4
  98.         done
  99.  
  100.         until [[ ${SERVER_WG_IPV6} =~ ^([a-f0-9]{1,4}:){3,4}: ]]; do
  101.                 read -rp "Server's WireGuard IPv6: " -e -i fd42:42:42::1 SERVER_WG_IPV6
  102.         done
  103.  
  104.         # Generate random number within private ports range
  105.         RANDOM_PORT=$(shuf -i49152-65535 -n1)
  106.         until [[ ${SERVER_PORT} =~ ^[0-9]+$ ]] && [ "${SERVER_PORT}" -ge 1 ] && [ "${SERVER_PORT}" -le 65535 ]; do
  107.                 read -rp "Server's WireGuard port [1-65535]: " -e -i "${RANDOM_PORT}" SERVER_PORT
  108.         done
  109.  
  110.         # Adguard DNS by default
  111.         until [[ ${CLIENT_DNS_1} =~ ^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$ ]]; do
  112.                 read -rp "First DNS resolver to use for the clients: " -e -i 94.140.14.14 CLIENT_DNS_1
  113.         done
  114.         until [[ ${CLIENT_DNS_2} =~ ^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$ ]]; do
  115.                 read -rp "Second DNS resolver to use for the clients (optional): " -e -i 94.140.15.15 CLIENT_DNS_2
  116.                 if [[ ${CLIENT_DNS_2} == "" ]]; then
  117.                         CLIENT_DNS_2="${CLIENT_DNS_1}"
  118.                 fi
  119.         done
  120.  
  121.         echo ""
  122.         echo "Okay, that was all I needed. We are ready to setup your WireGuard server now."
  123.         echo "You will be able to generate a client at the end of the installation."
  124.         read -n1 -r -p "Press any key to continue..."
  125. }
  126.  
  127. function installWireGuard() {
  128.         # Run setup questions first
  129.         installQuestions
  130.  
  131.         # Install WireGuard tools and module
  132.         if [[ ${OS} == 'ubuntu' ]] || [[ ${OS} == 'debian' && ${VERSION_ID} -gt 10 ]]; then
  133.                 apt-get update
  134.                 apt-get install -y wireguard iptables resolvconf qrencode
  135.         elif [[ ${OS} == 'debian' ]]; then
  136.                 if ! grep -rqs "^deb .* buster-backports" /etc/apt/; then
  137.                         echo "deb http://deb.debian.org/debian buster-backports main" >/etc/apt/sources.list.d/backports.list
  138.                         apt-get update
  139.                 fi
  140.                 apt update
  141.                 apt-get install -y iptables resolvconf qrencode
  142.                 apt-get install -y -t buster-backports wireguard
  143.         elif [[ ${OS} == 'fedora' ]]; then
  144.                 if [[ ${VERSION_ID} -lt 32 ]]; then
  145.                         dnf install -y dnf-plugins-core
  146.                         dnf copr enable -y jdoss/wireguard
  147.                         dnf install -y wireguard-dkms
  148.                 fi
  149.                 dnf install -y wireguard-tools iptables qrencode
  150.         elif [[ ${OS} == 'centos' ]]; then
  151.                 yum -y install epel-release elrepo-release
  152.                 if [[ ${VERSION_ID} -eq 7 ]]; then
  153.                         yum -y install yum-plugin-elrepo
  154.                 fi
  155.                 yum -y install kmod-wireguard wireguard-tools iptables qrencode
  156.         elif [[ ${OS} == 'arch' ]]; then
  157.                 pacman -S --needed --noconfirm wireguard-tools qrencode
  158.         fi
  159.  
  160.         # Make sure the directory exists (this does not seem the be the case on fedora)
  161.         mkdir /etc/wireguard >/dev/null 2>&1
  162.  
  163.         chmod 600 -R /etc/wireguard/
  164.  
  165.         SERVER_PRIV_KEY=$(wg genkey)
  166.         SERVER_PUB_KEY=$(echo "${SERVER_PRIV_KEY}" | wg pubkey)
  167.  
  168.         # Save WireGuard settings
  169.         echo "SERVER_PUB_IP=${SERVER_PUB_IP}
  170. SERVER_PUB_NIC=${SERVER_PUB_NIC}
  171. SERVER_WG_NIC=${SERVER_WG_NIC}
  172. SERVER_WG_IPV4=${SERVER_WG_IPV4}
  173. SERVER_WG_IPV6=${SERVER_WG_IPV6}
  174. SERVER_PORT=${SERVER_PORT}
  175. SERVER_PRIV_KEY=${SERVER_PRIV_KEY}
  176. SERVER_PUB_KEY=${SERVER_PUB_KEY}
  177. CLIENT_DNS_1=${CLIENT_DNS_1}
  178. CLIENT_DNS_2=${CLIENT_DNS_2}" >/etc/wireguard/params
  179.  
  180.         # Add server interface
  181.         echo "[Interface]
  182. Address = ${SERVER_WG_IPV4}/24,${SERVER_WG_IPV6}/64
  183. ListenPort = ${SERVER_PORT}
  184. PrivateKey = ${SERVER_PRIV_KEY}" >"/etc/wireguard/${SERVER_WG_NIC}.conf"
  185.  
  186.         if pgrep firewalld; then
  187.                 FIREWALLD_IPV4_ADDRESS=$(echo "${SERVER_WG_IPV4}" | cut -d"." -f1-3)".0"
  188.                 FIREWALLD_IPV6_ADDRESS=$(echo "${SERVER_WG_IPV6}" | sed 's/:[^:]*$/:0/')
  189.                 echo "PostUp = firewall-cmd --add-port ${SERVER_PORT}/udp && firewall-cmd --add-rich-rule='rule family=ipv4 source address=${FIREWALLD_IPV4_ADDRESS}/24 masquerade' && firewall-cmd --add-rich-rule='rule family=ipv6 source address=${FIREWALLD_IPV6_ADDRESS}/24 masquerade'
  190. PostDown = firewall-cmd --remove-port ${SERVER_PORT}/udp && firewall-cmd --remove-rich-rule='rule family=ipv4 source address=${FIREWALLD_IPV4_ADDRESS}/24 masquerade' && firewall-cmd --remove-rich-rule='rule family=ipv6 source address=${FIREWALLD_IPV6_ADDRESS}/24 masquerade'" >>"/etc/wireguard/${SERVER_WG_NIC}.conf"
  191.         else
  192.                 echo "PostUp = iptables -A FORWARD -i ${SERVER_PUB_NIC} -o ${SERVER_WG_NIC} -j ACCEPT; iptables -A FORWARD -i ${SERVER_WG_NIC} -j ACCEPT; iptables -t nat -A POSTROUTING -o ${SERVER_PUB_NIC} -j MASQUERADE; ip6tables -A FORWARD -i ${SERVER_WG_NIC} -j ACCEPT; ip6tables -t nat -A POSTROUTING -o ${SERVER_PUB_NIC} -j MASQUERADE
  193. PostDown = iptables -D FORWARD -i ${SERVER_PUB_NIC} -o ${SERVER_WG_NIC} -j ACCEPT; iptables -D FORWARD -i ${SERVER_WG_NIC} -j ACCEPT; iptables -t nat -D POSTROUTING -o ${SERVER_PUB_NIC} -j MASQUERADE; ip6tables -D FORWARD -i ${SERVER_WG_NIC} -j ACCEPT; ip6tables -t nat -D POSTROUTING -o ${SERVER_PUB_NIC} -j MASQUERADE" >>"/etc/wireguard/${SERVER_WG_NIC}.conf"
  194.         fi
  195.  
  196.         # Enable routing on the server
  197.         echo "net.ipv4.ip_forward = 1
  198. net.ipv6.conf.all.forwarding = 1" >/etc/sysctl.d/wg.conf
  199.  
  200.         sysctl --system
  201.  
  202.         systemctl start "wg-quick@${SERVER_WG_NIC}"
  203.         systemctl enable "wg-quick@${SERVER_WG_NIC}"
  204.  
  205.         newClient
  206.         echo "If you want to add more clients, you simply need to run this script another time!"
  207.  
  208.         # Check if WireGuard is running
  209.         systemctl is-active --quiet "wg-quick@${SERVER_WG_NIC}"
  210.         WG_RUNNING=$?
  211.  
  212.         # WireGuard might not work if we updated the kernel. Tell the user to reboot
  213.         if [[ ${WG_RUNNING} -ne 0 ]]; then
  214.                 echo -e "\n${RED}WARNING: WireGuard does not seem to be running.${NC}"
  215.                 echo -e "${ORANGE}You can check if WireGuard is running with: systemctl status wg-quick@${SERVER_WG_NIC}${NC}"
  216.                 echo -e "${ORANGE}If you get something like \"Cannot find device ${SERVER_WG_NIC}\", please reboot!${NC}"
  217.         fi
  218. }
  219.  
  220. function newClient() {
  221.         ENDPOINT="${SERVER_PUB_IP}:${SERVER_PORT}"
  222.  
  223.         echo ""
  224.         echo "Tell me a name for the client."
  225.         echo "The name must consist of alphanumeric character. It may also include an underscore or a dash and can't exceed 15 chars."
  226.  
  227.         until [[ ${CLIENT_NAME} =~ ^[a-zA-Z0-9_-]+$ && ${CLIENT_EXISTS} == '0' && ${#CLIENT_NAME} -lt 16 ]]; do
  228.                 read -rp "Client name: " -e CLIENT_NAME
  229.                 CLIENT_EXISTS=$(grep -c -E "^### Client ${CLIENT_NAME}\$" "/etc/wireguard/${SERVER_WG_NIC}.conf")
  230.  
  231.                 if [[ ${CLIENT_EXISTS} == '1' ]]; then
  232.                         echo ""
  233.                         echo "A client with the specified name was already created, please choose another name."
  234.                         echo ""
  235.                 fi
  236.         done
  237.  
  238.         for DOT_IP in {2..254}; do
  239.                 DOT_EXISTS=$(grep -c "${SERVER_WG_IPV4::-1}${DOT_IP}" "/etc/wireguard/${SERVER_WG_NIC}.conf")
  240.                 if [[ ${DOT_EXISTS} == '0' ]]; then
  241.                         break
  242.                 fi
  243.         done
  244.  
  245.         if [[ ${DOT_EXISTS} == '1' ]]; then
  246.                 echo ""
  247.                 echo "The subnet configured supports only 253 clients."
  248.                 exit 1
  249.         fi
  250.  
  251.         BASE_IP=$(echo "$SERVER_WG_IPV4" | awk -F '.' '{ print $1"."$2"."$3 }')
  252.         until [[ ${IPV4_EXISTS} == '0' ]]; do
  253.                 read -rp "Client's WireGuard IPv4: ${BASE_IP}." -e -i "${DOT_IP}" DOT_IP
  254.                 CLIENT_WG_IPV4="${BASE_IP}.${DOT_IP}"
  255.                 IPV4_EXISTS=$(grep -c "$CLIENT_WG_IPV4/24" "/etc/wireguard/${SERVER_WG_NIC}.conf")
  256.  
  257.                 if [[ ${IPV4_EXISTS} == '1' ]]; then
  258.                         echo ""
  259.                         echo "A client with the specified IPv4 was already created, please choose another IPv4."
  260.                         echo ""
  261.                 fi
  262.         done
  263.  
  264.         BASE_IP=$(echo "$SERVER_WG_IPV6" | awk -F '::' '{ print $1 }')
  265.         until [[ ${IPV6_EXISTS} == '0' ]]; do
  266.                 read -rp "Client's WireGuard IPv6: ${BASE_IP}::" -e -i "${DOT_IP}" DOT_IP
  267.                 CLIENT_WG_IPV6="${BASE_IP}::${DOT_IP}"
  268.                 IPV6_EXISTS=$(grep -c "${CLIENT_WG_IPV6}/64" "/etc/wireguard/${SERVER_WG_NIC}.conf")
  269.  
  270.                 if [[ ${IPV6_EXISTS} == '1' ]]; then
  271.                         echo ""
  272.                         echo "A client with the specified IPv6 was already created, please choose another IPv6."
  273.                         echo ""
  274.                 fi
  275.         done
  276.  
  277.         # Generate key pair for the client
  278.         CLIENT_PRIV_KEY=$(wg genkey)
  279.         CLIENT_PUB_KEY=$(echo "${CLIENT_PRIV_KEY}" | wg pubkey)
  280.         CLIENT_PRE_SHARED_KEY=$(wg genpsk)
  281.  
  282.         # Home directory of the user, where the client configuration will be written
  283.         if [ -e "/home/${CLIENT_NAME}" ]; then
  284.                 # if $1 is a user name
  285.                 HOME_DIR="/home/${CLIENT_NAME}"
  286.         elif [ "${SUDO_USER}" ]; then
  287.                 # if not, use SUDO_USER
  288.                 if [ "${SUDO_USER}" == "root" ]; then
  289.                         # If running sudo as root
  290.                         HOME_DIR="/root"
  291.                 else
  292.                         HOME_DIR="/home/${SUDO_USER}"
  293.                 fi
  294.         else
  295.                 # if not SUDO_USER, use /root
  296.                 HOME_DIR="/root"
  297.         fi
  298.  
  299.         # Create client file and add the server as a peer
  300.         echo "[Interface]
  301. PrivateKey = ${CLIENT_PRIV_KEY}
  302. Address = ${CLIENT_WG_IPV4}/32,${CLIENT_WG_IPV6}/128
  303. DNS = ${CLIENT_DNS_1},${CLIENT_DNS_2}
  304.  
  305. [Peer]
  306. PublicKey = ${SERVER_PUB_KEY}
  307. PresharedKey = ${CLIENT_PRE_SHARED_KEY}
  308. Endpoint = ${ENDPOINT}
  309. AllowedIPs = 0.0.0.0/0,::/0" >>"${HOME_DIR}/${SERVER_WG_NIC}-client-${CLIENT_NAME}.conf"
  310.  
  311.         # Add the client as a peer to the server
  312.         echo -e "\n### Client ${CLIENT_NAME}
  313. [Peer]
  314. PublicKey = ${CLIENT_PUB_KEY}
  315. PresharedKey = ${CLIENT_PRE_SHARED_KEY}
  316. AllowedIPs = ${CLIENT_WG_IPV4}/32,${CLIENT_WG_IPV6}/128" >>"/etc/wireguard/${SERVER_WG_NIC}.conf"
  317.  
  318.         wg syncconf "${SERVER_WG_NIC}" <(wg-quick strip "${SERVER_WG_NIC}")
  319.  
  320.         echo -e "\nHere is your client config file as a QR Code:"
  321.  
  322.         qrencode -t ansiutf8 -l L <"${HOME_DIR}/${SERVER_WG_NIC}-client-${CLIENT_NAME}.conf"
  323.  
  324.         echo "It is also available in ${HOME_DIR}/${SERVER_WG_NIC}-client-${CLIENT_NAME}.conf"
  325. }
  326.  
  327. function revokeClient() {
  328.         NUMBER_OF_CLIENTS=$(grep -c -E "^### Client" "/etc/wireguard/${SERVER_WG_NIC}.conf")
  329.         if [[ ${NUMBER_OF_CLIENTS} == '0' ]]; then
  330.                 echo ""
  331.                 echo "You have no existing clients!"
  332.                 exit 1
  333.         fi
  334.  
  335.         echo ""
  336.         echo "Select the existing client you want to revoke"
  337.         grep -E "^### Client" "/etc/wireguard/${SERVER_WG_NIC}.conf" | cut -d ' ' -f 3 | nl -s ') '
  338.         until [[ ${CLIENT_NUMBER} -ge 1 && ${CLIENT_NUMBER} -le ${NUMBER_OF_CLIENTS} ]]; do
  339.                 if [[ ${CLIENT_NUMBER} == '1' ]]; then
  340.                         read -rp "Select one client [1]: " CLIENT_NUMBER
  341.                 else
  342.                         read -rp "Select one client [1-${NUMBER_OF_CLIENTS}]: " CLIENT_NUMBER
  343.                 fi
  344.         done
  345.  
  346.         # match the selected number to a client name
  347.         CLIENT_NAME=$(grep -E "^### Client" "/etc/wireguard/${SERVER_WG_NIC}.conf" | cut -d ' ' -f 3 | sed -n "${CLIENT_NUMBER}"p)
  348.  
  349.         # remove [Peer] block matching $CLIENT_NAME
  350.         sed -i "/^### Client ${CLIENT_NAME}\$/,/^$/d" "/etc/wireguard/${SERVER_WG_NIC}.conf"
  351.  
  352.         # remove generated client file
  353.         rm -f "${HOME}/${SERVER_WG_NIC}-client-${CLIENT_NAME}.conf"
  354.  
  355.         # restart wireguard to apply changes
  356.         wg syncconf "${SERVER_WG_NIC}" <(wg-quick strip "${SERVER_WG_NIC}")
  357. }
  358.  
  359. function uninstallWg() {
  360.         echo ""
  361.         read -rp "Do you really want to remove WireGuard? [y/n]: " -e -i n REMOVE
  362.         if [[ $REMOVE == 'y' ]]; then
  363.                 checkOS
  364.  
  365.                 systemctl stop "wg-quick@${SERVER_WG_NIC}"
  366.                 systemctl disable "wg-quick@${SERVER_WG_NIC}"
  367.  
  368.                 if [[ ${OS} == 'ubuntu' ]]; then
  369.                         apt-get autoremove --purge -y wireguard qrencode
  370.                 elif [[ ${OS} == 'debian' ]]; then
  371.                         apt-get autoremove --purge -y wireguard qrencode
  372.                 elif [[ ${OS} == 'fedora' ]]; then
  373.                         dnf remove -y wireguard-tools qrencode
  374.                         if [[ ${VERSION_ID} -lt 32 ]]; then
  375.                                 dnf remove -y wireguard-dkms
  376.                                 dnf copr disable -y jdoss/wireguard
  377.                         fi
  378.                         dnf autoremove -y
  379.                 elif [[ ${OS} == 'centos' ]]; then
  380.                         yum -y remove kmod-wireguard wireguard-tools qrencode
  381.                         yum -y autoremove
  382.                 elif [[ ${OS} == 'arch' ]]; then
  383.                         pacman -Rs --noconfirm wireguard-tools qrencode
  384.                 fi
  385.  
  386.                 rm -rf /etc/wireguard
  387.                 rm -f /etc/sysctl.d/wg.conf
  388.  
  389.                 # Reload sysctl
  390.                 sysctl --system
  391.  
  392.                 # Check if WireGuard is running
  393.                 systemctl is-active --quiet "wg-quick@${SERVER_WG_NIC}"
  394.                 WG_RUNNING=$?
  395.  
  396.                 if [[ ${WG_RUNNING} -eq 0 ]]; then
  397.                         echo "WireGuard failed to uninstall properly."
  398.                         exit 1
  399.                 else
  400.                         echo "WireGuard uninstalled successfully."
  401.                         exit 0
  402.                 fi
  403.         else
  404.                 echo ""
  405.                 echo "Removal aborted!"
  406.         fi
  407. }
  408.  
  409. function manageMenu() {
  410.         echo "Welcome to WireGuard-install!"
  411.         echo "The git repository is available at: https://github.com/angristan/wireguard-install"
  412.         echo ""
  413.         echo "It looks like WireGuard is already installed."
  414.         echo ""
  415.         echo "What do you want to do?"
  416.         echo "   1) Add a new user"
  417.         echo "   2) Revoke existing user"
  418.         echo "   3) Uninstall WireGuard"
  419.         echo "   4) Exit"
  420.         until [[ ${MENU_OPTION} =~ ^[1-4]$ ]]; do
  421.                 read -rp "Select an option [1-4]: " MENU_OPTION
  422.         done
  423.         case "${MENU_OPTION}" in
  424.         1)
  425.                 newClient
  426.                 ;;
  427.         2)
  428.                 revokeClient
  429.                 ;;
  430.         3)
  431.                 uninstallWg
  432.                 ;;
  433.         4)
  434.                 exit 0
  435.                 ;;
  436.         esac
  437. }
  438.  
  439. # Check for root, virt, OS...
  440. initialCheck
  441.  
  442. # Check if WireGuard is already installed and load params
  443. if [[ -e /etc/wireguard/params ]]; then
  444.         source /etc/wireguard/params
  445.         manageMenu
  446. else
  447.         installWireGuard
  448. fi
  449.  
  450. ###################################################################
  451.  
  452. make executable:
  453. chmod +x wireguard-install.sh
  454.  
  455. install with:
  456. ./wireguard-install.sh
  457.  
  458. after install, run ./wireguard-install.sh to add user/QR Codes
  459.  
  460. that´s it
  461.  
  462. happy VPN ;)

Paste ist fuer Quelltexte und generelles Debugging.

Login oder Registrieren um zu bearbeiten, löschen, um deine Pastes zu verfolgen und mehr.

Raw Paste

Login oder Registrieren um diesen Paste zu bearbeiten. Es ist kostenlos.