mirror of
https://github.com/pivpn/pivpn.git
synced 2025-02-23 03:28:14 +00:00
Automatic backup of existing OpenVPN/WireGuard folder should only be readable by root
This commit is contained in:
parent
0cb5546608
commit
3730d315e9
1 changed files with 6 additions and 0 deletions
|
@ -1735,7 +1735,10 @@ confOpenVPN(){
|
|||
# Backup the openvpn folder
|
||||
OPENVPN_BACKUP="openvpn_$(date +%Y-%m-%d-%H%M%S).tar.gz"
|
||||
echo "::: Backing up the openvpn folder to /etc/${OPENVPN_BACKUP}"
|
||||
CURRENT_UMASK=$(umask)
|
||||
umask 0077
|
||||
$SUDO tar czf "/etc/${OPENVPN_BACKUP}" /etc/openvpn &> /dev/null
|
||||
umask "$CURRENT_UMASK"
|
||||
|
||||
if [ -f /etc/openvpn/server.conf ]; then
|
||||
$SUDO rm /etc/openvpn/server.conf
|
||||
|
@ -1912,7 +1915,10 @@ confWireGuard(){
|
|||
# Backup the wireguard folder
|
||||
WIREGUARD_BACKUP="wireguard_$(date +%Y-%m-%d-%H%M%S).tar.gz"
|
||||
echo "::: Backing up the wireguard folder to /etc/${WIREGUARD_BACKUP}"
|
||||
CURRENT_UMASK=$(umask)
|
||||
umask 0077
|
||||
$SUDO tar czf "/etc/${WIREGUARD_BACKUP}" /etc/wireguard &> /dev/null
|
||||
umask "$CURRENT_UMASK"
|
||||
|
||||
if [ -f /etc/wireguard/wg0.conf ]; then
|
||||
$SUDO rm /etc/wireguard/wg0.conf
|
||||
|
|
Loading…
Add table
Reference in a new issue