2 Commits
v0.1 ... v0.3

Author SHA1 Message Date
9d3fe38e37 fichier de conf + script installation 2022-02-09 11:20:26 +01:00
78b1b1923d Script de sauvegarde/restauration 2022-02-09 10:33:18 +01:00
20 changed files with 25623 additions and 0 deletions

View File

@ -0,0 +1,3 @@
[client]
user=ap45
password=Azerty1+

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

26
script/restauration/rest43 Executable file
View File

@ -0,0 +1,26 @@
#!/bin/bash
HOST=root@onfarbo43
restore () {
ssh "${HOST}" "mysql -u ap45 -pAzerty1+ bdarbre" < bdarbre43.sql
}
while getopts "f" OPT
do
case "${OPT}" in
f)
restore
exit 0;
;;
esac
done
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
}
confirm
exit 0

26
script/restauration/rest45 Executable file
View File

@ -0,0 +1,26 @@
#!/bin/bash
HOST=root@onfarbo45
restore () {
ssh "${HOST}" "mysql -u ap45 -pAzerty1+ bdarbre" < bdarbre45.sql
}
while getopts "f" OPT
do
case "${OPT}" in
f)
restore
exit 0;
;;
esac
done
confirm() {
read -r -n 1 -p "${1:-Confirmer?} [o/n]: " REPLY
case $REPLY in
[oO]) echo ; restore ;;
[nN]) echo ; exit 0 ;;
*) printf " \033[31m %s \n\033[0m" "Entrée non valide"
esac
}
confirm
exit 0

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,19 @@
<?php
include_once 'include/chargementClasses.php';
try{
$laConnexion = new ConnexionBDD();
$sql = 'SELECT * FROM intervention INNER JOIN arbre ON arbre.id = intervention.idArbre;';
$reponse = $laConnexion->dbh()->query($sql);
$output = array("lesInterventions"=>$reponse->fetchAll(PDO::FETCH_ASSOC));
}catch (Exception $e){
die('Erreur : '.$e->getMessage());
}
echo(json_encode($output));

View File

@ -0,0 +1,45 @@
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
class ConnexionBDD {
private $_dbh; // Chaine de connexion
/**
* Connexion persistante au serveur
* @return \PDO Connexion
*/
public function __construct(){
// Définition des variables de connexion
$user = "ap43";
$pass = "Azerty1+";
$dsn ='mysql:host=localhost;dbname=bdarbre'; //Data Source Name
// Connexion
try {
$this->_dbh = new PDO($dsn, $user, $pass, array(PDO::ATTR_PERSISTENT=>true,
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'UTF8\'')); // Connexion persistante
}
catch (PDOException $e) {
die("Erreur : " . $e->getMessage());
}
}
/** afficherErreurSQL :
* Affichage de messages lors l'accès à la bdd avec une requete SQL
* @param $message : message a afficher
*/
function afficherErreurSQL($message, $sql="") {
echo $message . "<br />" . $sql . "<br />";
$info = $this->_dbh->errorInfo();
echo "Code erreur : " . $info[0] . ", Message : " . $info[2];
die();
}
function dbh() {
return $this->_dbh;
}
}

View File

@ -0,0 +1,7 @@
<?php
spl_autoload_register('chargerClasse');
function chargerClasse($classe){
require "include/".$classe.".php";
}

View File

@ -0,0 +1,17 @@
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<?php
// put your code here
?>
</body>
</html>

View File

@ -0,0 +1,6 @@
copy.src.files=false
copy.src.on.open=false
copy.src.target=/var/www/PhpProject1
index.file=index.php
run.as=LOCAL
url=http://localhost/PHPProjects/ONF/

View File

@ -0,0 +1,7 @@
include.path=${php.global.include.path}
php.version=PHP_80
source.encoding=UTF-8
src.dir=.
tags.asp=false
tags.short=false
web.root=.

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.php.project</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/php-project/1">
<name>ONF</name>
</data>
</configuration>
</project>

View File

@ -0,0 +1,14 @@
#!/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/PHPProjects/ONF /root/sauv/php43
exit 0

View 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

Binary file not shown.

Binary file not shown.

18
wireguard/wg0.conf Normal file
View 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
View 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