angristan / angristan/wireguard-install

Remove client config files when uninstalling

Abierto
#175 1 comentario 0 reacciones 0 asignados Ver en GitHub
enhancement
Lenguaje dominante
Shell
Estrellas
11.3k
Forks
1.7k
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

Add "uninstall generated client file" to the `uninstallWg()` function. Something like this, but removing all custom WG config files:

```
function uninstallWg(){
#REMOVE USER CONFIG
# Home directory of the user, where the client configuration will be written
CLIENT_NAME=$(grep -E "^### Client" "/etc/wireguard/${SERVER_WG_NIC}.conf" | cut$
if [ -e "/home/${CLIENT_NAME}" ]; then # if $1 is a user name
HOME_DIR="/home/${CLIENT_NAME}"
elif [ "${SUDO_USER}" ]; then # if not, use SUDO_USER
HOME_DIR="/home/${SUDO_USER}"
else # if not SUDO_USER, use /root
HOME_DIR="/root"
fi
echo "usr config delete: ${HOME_DIR}/${SERVER_WG_NIC}-client-${CLIENT_NAME}.conf"
# remove generated client file
rm -f "${HOME_DIR}/${SERVER_WG_NIC}"-client-*.conf

rm -rf /etc/wireguard
rm -f /etc/sysctl.d/wg.conf
}
```

P.S. If you do not delete the custom WG configuration files and remove the protective cover, then when you reinstall it, configurations 2, 3, 4, 5 ... for one user will appear in the custom file, and the QR code will become larger and displayed with errors

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.