Compare commits
4 Commits
v0.1
...
bb2fbcb736
Author | SHA1 | Date | |
---|---|---|---|
bb2fbcb736 | |||
90d59e754e | |||
9d3fe38e37 | |||
78b1b1923d |
3
script/restauration/.my.cnf
Normal file
3
script/restauration/.my.cnf
Normal file
@ -0,0 +1,3 @@
|
||||
[client]
|
||||
user=ap45
|
||||
password=Azerty1+
|
53
script/restauration/rest43
Executable file
53
script/restauration/rest43
Executable file
@ -0,0 +1,53 @@
|
||||
#!/bin/bash
|
||||
HOST=root@onfarbo43
|
||||
|
||||
usage() {
|
||||
echo -e "Usage: $0 [-f] <compressed dumpfile>\n\t-f: force mode\n\t-h: this help\n" 1>&2; exit 1; }
|
||||
|
||||
restore() {
|
||||
zcat "${filename}" | ssh "${HOST}" "mysql -u ap43 -pAzerty1+ bdarbre"
|
||||
}
|
||||
|
||||
confirm() {
|
||||
read -r -n 1 -p "${1:-Confirmer?} [o/n]: " REPLY
|
||||
case "${REPLY}" in
|
||||
[oO]) echo ; restore ;;
|
||||
[nN]) echo ; exit 1 ;;
|
||||
*) printf " \033[31m %s \n\033[0m" "Entrée non valide"
|
||||
esac
|
||||
}
|
||||
|
||||
while getopts "fh" OPT
|
||||
do
|
||||
case "${OPT}" in
|
||||
f)
|
||||
forcemode=1
|
||||
;;
|
||||
|
||||
h)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND-1))
|
||||
|
||||
filename="${1}"
|
||||
|
||||
if [[ -z "${filename}" ]] ; then
|
||||
usage
|
||||
fi
|
||||
|
||||
if [[ ! -r "${filename}" ]] ; then
|
||||
echo "erreur ouverture fichier"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if [[ "${forcemode}" == 1 ]]; then
|
||||
restore
|
||||
exit 0
|
||||
else
|
||||
confirm
|
||||
exit 0
|
||||
fi
|
||||
exit 0
|
53
script/restauration/rest45
Executable file
53
script/restauration/rest45
Executable file
@ -0,0 +1,53 @@
|
||||
#!/bin/bash
|
||||
HOST=root@onfarbo45
|
||||
|
||||
usage() {
|
||||
echo -e "Usage: $0 [-f] <compressed dumpfile>\n\t-f: force mode\n\t-h: this help\n" 1>&2; exit 1; }
|
||||
|
||||
restore() {
|
||||
zcat "${filename}" | ssh "${HOST}" "mysql -u ap45 -pAzerty1+ bdarbre"
|
||||
}
|
||||
|
||||
confirm() {
|
||||
read -r -n 1 -p "${1:-Confirmer?} [o/n]: " REPLY
|
||||
case "${REPLY}" in
|
||||
[oO]) echo ; restore ;;
|
||||
[nN]) echo ; exit 1 ;;
|
||||
*) printf " \033[31m %s \n\033[0m" "Entrée non valide"
|
||||
esac
|
||||
}
|
||||
|
||||
while getopts "fh" OPT
|
||||
do
|
||||
case "${OPT}" in
|
||||
f)
|
||||
forcemode=1
|
||||
;;
|
||||
|
||||
h)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND-1))
|
||||
|
||||
filename="${1}"
|
||||
|
||||
if [[ -z "${filename}" ]] ; then
|
||||
usage
|
||||
fi
|
||||
|
||||
if [[ ! -r "${filename}" ]] ; then
|
||||
echo "erreur ouverture fichier"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if [[ "${forcemode}" == 1 ]]; then
|
||||
restore
|
||||
exit 0
|
||||
else
|
||||
confirm
|
||||
exit 0
|
||||
fi
|
||||
exit 0
|
BIN
script/sauvegarde/jour/bdarbre43-3.sql.gz
Normal file
BIN
script/sauvegarde/jour/bdarbre43-3.sql.gz
Normal file
Binary file not shown.
BIN
script/sauvegarde/jour/bdarbre45-3.sql.gz
Normal file
BIN
script/sauvegarde/jour/bdarbre45-3.sql.gz
Normal file
Binary file not shown.
15
script/sauvegarde/sauvegarde43.sh
Executable file
15
script/sauvegarde/sauvegarde43.sh
Executable file
@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
HOST=root@onfarbo43
|
||||
DATEJ=$(date +%u)
|
||||
DATES=$(date +%W)
|
||||
semaineMod=$(("${DATES}" % 4))
|
||||
|
||||
ssh "${HOST}" "mysqldump -u ap43 -pAzerty1+ bdarbre | gzip" > /root/sauv/jour/bdarbre43-"${DATEJ}".sql.gz
|
||||
|
||||
ssh "${HOST}" "mysqldump -u ap43 -pAzerty1+ bdarbre | gzip" > /root/sauv/semaine/bdarbre43-"${semaineMod}".sql.gz
|
||||
|
||||
scp -r "${HOST}":/var/www/html/PHPProjectsAM/ /root/sauv/php43/AM
|
||||
scp -r "${HOST}":/var/www/html/PHPProjectsAS/ /root/sauv/php43/AS
|
||||
|
||||
|
||||
exit 0
|
14
script/sauvegarde/sauvegarde45.sh
Executable file
14
script/sauvegarde/sauvegarde45.sh
Executable file
@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
HOST=root@onfarbo45
|
||||
DATEJ=$(date +%u)
|
||||
DATES=$(date +%W)
|
||||
semaineMod=$(("${DATES}" % 4))
|
||||
|
||||
ssh "${HOST}" "mysqldump -u ap45 -pAzerty1+ bdarbre | gzip" > /root/sauv/jour/bdarbre45-"${DATEJ}".sql.gz
|
||||
|
||||
ssh "${HOST}" "mysqldump -u ap45 -pAzerty1+ bdarbre | gzip" > /root/sauv/semaine/bdarbre45-"${semaineMod}".sql.gz
|
||||
|
||||
scp -r "${HOST}":/var/www/html/PHPProjects/ONF /root/sauv/php45
|
||||
|
||||
|
||||
exit 0
|
BIN
script/sauvegarde/semaine/bdarbre45-0.sql.gz
Normal file
BIN
script/sauvegarde/semaine/bdarbre45-0.sql.gz
Normal file
Binary file not shown.
18
wireguard/wg0.conf
Normal file
18
wireguard/wg0.conf
Normal file
@ -0,0 +1,18 @@
|
||||
# local settings for Endpoint A
|
||||
[Interface]
|
||||
PrivateKey = kJfPU7pqldy6d7K+8Gbby7Hbw1zh7amdIIccmC9NY1s=
|
||||
Address = 10.0.0.1/32
|
||||
ListenPort = 51820
|
||||
|
||||
# remote settings for Endpoint B
|
||||
[Peer]
|
||||
PublicKey = pMaLJGkdgcT3jwPC7F/EUlr9U8VbkZli9Ru65zkXH2U=
|
||||
#Endpoint = 192.168.1.82:51820
|
||||
AllowedIPs = 10.0.0.2/32
|
||||
|
||||
# remote settings for Endpoint C
|
||||
[Peer]
|
||||
PublicKey = HuwPkFzi25gAovg+Ni7lpCK6TvcK1HBdbgg3lVRK+zY=
|
||||
#Endpoint = x.y.z.t:51820
|
||||
AllowedIPs = 10.0.0.3/32
|
||||
|
79
wireguard/wgap4.sh
Normal file
79
wireguard/wgap4.sh
Normal file
@ -0,0 +1,79 @@
|
||||
#!/bin/bash
|
||||
set -u
|
||||
set -e
|
||||
|
||||
AddressAwg=10.0.0.1/32 # Adresse VPN Wireguard extremite A
|
||||
EndpointA=10.121.38.70 # Adresse extremite A
|
||||
PortA=51820 # Port ecoute extremite A
|
||||
AddressBwg=10.0.0.2/32 # Adresse VPN Wireguard extremite B
|
||||
EndpointB=192.168.1.82 # Adresse extremite B
|
||||
PortB=51820 # Port ecoute extremite B
|
||||
AddressCwg=10.0.0.3/32
|
||||
EndpointC=x.y.z.t
|
||||
PortC=51820
|
||||
|
||||
umask 077 ;
|
||||
wg genkey > endpoint-a.key
|
||||
wg pubkey < endpoint-a.key > endpoint-a.pub
|
||||
|
||||
wg genkey > endpoint-b.key
|
||||
wg pubkey < endpoint-b.key > endpoint-b.pub
|
||||
|
||||
wg genkey > endpoint-c.key
|
||||
wg pubkey < endpoint-c.key > endpoint-c.pub
|
||||
PKA=$(cat endpoint-a.key)
|
||||
pKA=$(cat endpoint-a.pub)
|
||||
PKB=$(cat endpoint-b.key)
|
||||
pKB=$(cat endpoint-b.pub)
|
||||
PKC=$(cat endpoint-c.key)
|
||||
pKC=$(cat endpoint-c.pub)
|
||||
|
||||
|
||||
cat <<FINI > wg0-a.conf
|
||||
# local settings for Endpoint A
|
||||
[Interface]
|
||||
PrivateKey = $PKA
|
||||
Address = $AddressAwg
|
||||
ListenPort = $PortA
|
||||
|
||||
# remote settings for Endpoint B
|
||||
[Peer]
|
||||
PublicKey = $pKB
|
||||
#Endpoint = ${EndpointB}:$PortB
|
||||
AllowedIPs = $AddressBwg
|
||||
|
||||
# remote settings for Endpoint C
|
||||
[Peer]
|
||||
PublicKey = $pKC
|
||||
#Endpoint = ${EndpointC}:$PortC
|
||||
AllowedIPs = $AddressCwg
|
||||
|
||||
FINI
|
||||
cat <<FINI > wg0-b.conf
|
||||
# local settings for Endpoint B
|
||||
[Interface]
|
||||
PrivateKey = $PKB
|
||||
Address = $AddressBwg
|
||||
ListenPort = $PortB
|
||||
|
||||
# remote settings for Endpoint A
|
||||
[Peer]
|
||||
PublicKey = $pKA
|
||||
Endpoint = ${EndpointA}:$PortA
|
||||
AllowedIPs = $AddressAwg
|
||||
|
||||
FINI
|
||||
cat <<FINI > wg0-c.conf
|
||||
# local settings for Endpoint C
|
||||
[Interface]
|
||||
PrivateKey = $PKC
|
||||
Address = $AddressCwg
|
||||
ListenPort = $PortC
|
||||
|
||||
# remote settings for Endpoint A
|
||||
[Peer]
|
||||
PublicKey = $pKA
|
||||
Endpoint = ${EndpointA}:$PortA
|
||||
AllowedIPs = $AddressAwg
|
||||
|
||||
FINI
|
Reference in New Issue
Block a user