diff --git a/auth/index.php b/auth/index.php index 95d6513..41d54bc 100644 --- a/auth/index.php +++ b/auth/index.php @@ -7,11 +7,11 @@ Changer la clé de passe - Vous devez être authentifié·e pour utiliser Niver -
- Créer un compte -
- Se connecter + Vous devez être authentifié·e pour utiliser Niver +
+ Créer un compte +
+ Se connecter diff --git a/auth/login.php b/auth/login.php index efb3842..e79a0f2 100755 --- a/auth/login.php +++ b/auth/login.php @@ -1,15 +1,15 @@
-
- -
+
+ +
-
- -
+
+ +
- +
Pas de compte ? En créer un @@ -18,34 +18,34 @@ Pas de compte ? En créer un if (isset($_POST['username']) AND isset($_POST['password'])) { - antiCSRF(); + antiCSRF(); - if (!checkPasswordFormat($_POST['password'])) - exit("Le format du mot de passe n'est pas valide !"); + if (!checkPasswordFormat($_POST['password'])) + exit("Le format du mot de passe n'est pas valide !"); - if (!checkUsernameFormat($_POST['username'])) - exit("Le format du nom du compte n'est pas valide !"); + if (!checkUsernameFormat($_POST['username'])) + exit("Le format du nom du compte n'est pas valide !"); - if (checkPassword($_POST['username'], $_POST['password'])) { + if (checkPassword($_POST['username'], $_POST['password'])) { - $_SESSION['username'] = htmlspecialchars($_POST['username']); - $_SESSION['sftp_enabled'] = sftpStatus($_SESSION['username']); + $_SESSION['username'] = htmlspecialchars($_POST['username']); + $_SESSION['sftp_enabled'] = sftpStatus($_SESSION['username']); - if (outdatedPasswordHash($_SESSION['username'])) - changePassword($_SESSION['username'], $_POST['password']); + if (outdatedPasswordHash($_SESSION['username'])) + changePassword($_SESSION['username'], $_POST['password']); - if (isset($_GET['redir'])) { - if (preg_match("/^[0-9a-z\/-]+$/", $_GET['redir'])) - header('Location: ' . PREFIX . "/" . $_GET['redir']); - else - exit("ERROR : Wrong character in redir argument"); - } else { - header('Location: ' . PREFIX); - } - exit; - } else { - echo "
Connexion impossible : mot de passe invalide"; - } + if (isset($_GET['redir'])) { + if (preg_match("/^[0-9a-z\/-]+$/", $_GET['redir'])) + header('Location: ' . PREFIX . "/" . $_GET['redir']); + else + exit("ERROR : Wrong character in redir argument"); + } else { + header('Location: ' . PREFIX); + } + exit; + } else { + echo "
Connexion impossible : mot de passe invalide"; + } } diff --git a/auth/password.php b/auth/password.php index 76ea714..660404d 100644 --- a/auth/password.php +++ b/auth/password.php @@ -1,45 +1,45 @@

- Vous pouvez ici changer le mot de passe permettant d'accéder à votre compte Niver. + Vous pouvez ici changer le mot de passe permettant d'accéder à votre compte Niver.

-
-
+
+
-
-
+
+
- +
prepare("UPDATE users SET password = :password WHERE username = :username"); + $stmt = $db->prepare("UPDATE users SET password = :password WHERE username = :username"); - $stmt->bindParam(':username', $username); - $stmt->bindParam(':password', $newPassword); + $stmt->bindParam(':username', $username); + $stmt->bindParam(':password', $newPassword); - $stmt->execute(); + $stmt->execute(); - } else { - echo "
Le mot de passe actuel n'est pas bon !"; - } + } else { + echo "
Le mot de passe actuel n'est pas bon !"; + } } diff --git a/auth/register.php b/auth/register.php index 68a840d..d178d19 100755 --- a/auth/register.php +++ b/auth/register.php @@ -4,68 +4,68 @@ if (isset($_POST['username']) AND isset($_POST['password'])) { - antiCSRF(); + antiCSRF(); - if (!checkPasswordFormat($_POST['password'])) - exit("Le format du mot de passe n'est pas valide !"); + if (!checkPasswordFormat($_POST['password'])) + exit("Le format du mot de passe n'est pas valide !"); - if (!checkUsernameFormat($_POST['username'])) - exit("Le format du nom du compte n'est pas valide !"); + if (!checkUsernameFormat($_POST['username'])) + exit("Le format du nom du compte n'est pas valide !"); - $username = $_POST['username']; - $userExist = userExist($username); - if (!$userExist) { + $username = $_POST['username']; + $userExist = userExist($username); + if (!$userExist) { - $password = hashPassword($_POST['password']); + $password = hashPassword($_POST['password']); - $db = new PDO('sqlite:' . DB_PATH); + $db = new PDO('sqlite:' . DB_PATH); - $stmt = $db->prepare("INSERT INTO users(username, password, sftp_enabled, registration_date) VALUES(:username, :password, 0, :registration_date)"); + $stmt = $db->prepare("INSERT INTO users(username, password, sftp_enabled, registration_date) VALUES(:username, :password, 0, :registration_date)"); - $time = date("Y-m-d H:i:s"); + $time = date("Y-m-d H:i:s"); - $stmt->bindParam(':username', $username); - $stmt->bindParam(':password', $password); - $stmt->bindParam(':registration_date', $time); + $stmt->bindParam(':username', $username); + $stmt->bindParam(':password', $password); + $stmt->bindParam(':registration_date', $time); - $stmt->execute(); + $stmt->execute(); - $_SESSION['username'] = $username; - $_SESSION['sftp_enabled'] = false; - header('Location: ' . PREFIX . '/'); - exit; - } + $_SESSION['username'] = $username; + $_SESSION['sftp_enabled'] = false; + header('Location: ' . PREFIX . '/'); + exit; + } } ?>
- - Cet identifiant est déjà utilisé. Choisissez-en un autre."; - } - ?> - - +
Déjà un compte ? Se connecter diff --git a/bottom.inc.php b/bottom.inc.php index 6cfbba8..b404a5c 100644 --- a/bottom.inc.php +++ b/bottom.inc.php @@ -1,17 +1,17 @@ - - - + + + diff --git a/ht/gemini-domain.php b/ht/gemini-domain.php index 7482242..0c88808 100644 --- a/ht/gemini-domain.php +++ b/ht/gemini-domain.php @@ -1,87 +1,87 @@

- Ajouter un domaine sur un dossier de site
- Le domaine doit pointer vers ces adresses IP : -
IPv4 : -
IPv6 : + Ajouter un domaine sur un dossier de site
+ Le domaine doit pointer vers ces adresses IP : +
IPv4 : +
IPv6 :

-
-
-
-
+
+ -
- + if (!is_null($alreadyEnabledDirs)) { + foreach ($alreadyEnabledDirs as $dir) { + echo ""; + } + } + } + ?> + +
+
diff --git a/ht/gemini-onion.php b/ht/gemini-onion.php index 78c09f2..7cb8f03 100644 --- a/ht/gemini-onion.php +++ b/ht/gemini-onion.php @@ -1,100 +1,100 @@

- Ajouter un accès en .onion sur un dossier + Ajouter un accès en .onion sur un dossier

-
- + - " . $dir . ""; - } - } + if (!is_null($notYetEnabledDirs)) { + foreach ($notYetEnabledDirs as $dir) { + echo ""; + } + } - if (!is_null($alreadyEnabledDirs)) { - foreach ($alreadyEnabledDirs as $dir) { - echo ""; - } - } - } - ?> - -
- + if (!is_null($alreadyEnabledDirs)) { + foreach ($alreadyEnabledDirs as $dir) { + echo ""; + } + } + } + ?> + +
+
L'adresse de votre capsule Onion Gemini est :
gemini://" . $onion . "

"; + // Tell the user their site address + echo "

L'adresse de votre capsule Onion Gemini est :
gemini://" . $onion . "

"; } diff --git a/ht/http-onion.php b/ht/http-onion.php index bf4824c..42122a8 100644 --- a/ht/http-onion.php +++ b/ht/http-onion.php @@ -1,94 +1,94 @@

- Ajouter un accès en .onion sur un dossier + Ajouter un accès en .onion sur un dossier

-
- + - " . $dir . ""; - } - } + if (!is_null($notYetEnabledDirs)) { + foreach ($notYetEnabledDirs as $dir) { + echo ""; + } + } - if (!is_null($alreadyEnabledDirs)) { - foreach ($alreadyEnabledDirs as $dir) { - echo ""; - } - } - } - ?> - -
- + if (!is_null($alreadyEnabledDirs)) { + foreach ($alreadyEnabledDirs as $dir) { + echo ""; + } + } + } + ?> + +
+
L'adresse de votre site Onion HTTP est :
http://" . $onion . "

"; + // Tell the user their site address + echo "

L'adresse de votre site Onion HTTP est :
http://" . $onion . "

"; } diff --git a/ht/https-domain.php b/ht/https-domain.php index 63e9edb..c5f1af0 100644 --- a/ht/https-domain.php +++ b/ht/https-domain.php @@ -1,80 +1,80 @@

- Ajouter un domaine sur un dossier de site
- Le domaine doit pointer vers ces adresses IP : -
IPv4 : -
IPv6 : + Ajouter un domaine sur un dossier de site
+ Le domaine doit pointer vers ces adresses IP : +
IPv4 : +
IPv6 :

-
-
-
-
+
+ -
- + ?> + +
+
diff --git a/ht/index.php b/ht/index.php index ac75ab7..e6eefb6 100644 --- a/ht/index.php +++ b/ht/index.php @@ -1,30 +1,30 @@
-
Gérer l'accès SFTP
-
- Accéder à son espace SFTP, pour publier et mettre à jour ses sites -
-
Accès HTTP en Onion
-
- Un site HTML, accessible par Tor, avec une adresse en .onion -
-
Accès HTTPS par DNS
-
- Un site HTML, accessible directement, par un nom de domaine -
-
Accès Gemini en Onion
-
- Une capsule Gemini, accessible par Tor, avec une adresse en .onion -
-
Accès Gemini par DNS
-
- Une capsule Gemini, accessible directement, par un nom de domaine -
-
Let's Encrypt
-
- Installer un certificat Let's Encrypt sur un domaine -
+
Gérer l'accès SFTP
+
+ Accéder à son espace SFTP, pour publier et mettre à jour ses sites +
+
Accès HTTP en Onion
+
+ Un site HTML, accessible par Tor, avec une adresse en .onion +
+
Accès HTTPS par DNS
+
+ Un site HTML, accessible directement, par un nom de domaine +
+
Accès Gemini en Onion
+
+ Une capsule Gemini, accessible par Tor, avec une adresse en .onion +
+
Accès Gemini par DNS
+
+ Une capsule Gemini, accessible directement, par un nom de domaine +
+
Let's Encrypt
+
+ Installer un certificat Let's Encrypt sur un domaine +
diff --git a/ht/le.php b/ht/le.php index dc0906e..ece7cd0 100644 --- a/ht/le.php +++ b/ht/le.php @@ -1,53 +1,53 @@

- Installer un certificat Let's Encrypt + Installer un certificat Let's Encrypt

-
- -
- +
+ +
+
diff --git a/ht/sftp.php b/ht/sftp.php index 9a4c574..937ca6c 100644 --- a/ht/sftp.php +++ b/ht/sftp.php @@ -3,166 +3,166 @@

- Pour que vous puissiez mettre en ligne votre site via SFTP, veuillez définir un mot de passe. -
Il sera loggué en clair dans le système et il ne pourra pas être modifié. + Pour que vous puissiez mettre en ligne votre site via SFTP, veuillez définir un mot de passe. +
Il sera loggué en clair dans le système et il ne pourra pas être modifié.

-
-
+
+
- +
- Vous avez désormais accès à un espace SFTP. Vous pouvez téléverser vos sites dans /ht/<nom du site>/*. -
-
-

Quota

- L'espace est limité au total à 10Kio de stockage et 10 fichiers/dossiers. -
-
-

Clients SFTP

- Dolphin et GNOME Fichiers (Nautilus) sont disponibles sur la plupart des distributions GNU et sont installés par défaut respectivement sur les environnements de bureau KDE et GNOME. FileZilla est disponible aussi pour les autres systèmes d'exploitation de bureau. -
- C'est aussi possible d'utiliser le client sftp en ligne de commande. -
-
-

Informations de connexion

+ Vous avez désormais accès à un espace SFTP. Vous pouvez téléverser vos sites dans /ht/<nom du site>/*. +
+
+

Quota

+ L'espace est limité au total à 10Kio de stockage et 10 fichiers/dossiers. +
+
+

Clients SFTP

+ Dolphin et GNOME Fichiers (Nautilus) sont disponibles sur la plupart des distributions GNU et sont installés par défaut respectivement sur les environnements de bureau KDE et GNOME. FileZilla est disponible aussi pour les autres systèmes d'exploitation de bureau. +
+ C'est aussi possible d'utiliser le client sftp en ligne de commande. +
+
+

Informations de connexion

-
- sftp://@sftp.niver.4.niv.re/ -
+
+ sftp://@sftp.niver.4.niv.re/ +
- Indiquez les données ci-dessous à votre client SFTP pour y accéder. + Indiquez les données ci-dessous à votre client SFTP pour y accéder. -
-
Utilisataire
-
- -
+
+
Utilisataire
+
+ +
-
Clé de passe
-
- celle que vous avez définit lors de l'activation de l'accès SFTP -
+
Clé de passe
+
+ celle que vous avez définit lors de l'activation de l'accès SFTP +
-
Serveur
-
- sftp.niver.4.niv.re -
+
Serveur
+
+ sftp.niver.4.niv.re +
-
Port
-
- 22 (par défaut) -
+
Port
+
+ 22 (par défaut) +
-
Dossier
-
- / -
-
+
Dossier
+
+ / +
+
-
+
-
-

Vérifier la connexion

-
-

Ed25519

- +
+ N'acceptez la connexion que si votre client vous montre l'une de ces signatures ! +
+
diff --git a/inc/all.inc.php b/inc/all.inc.php index e752e5b..34ef22f 100644 --- a/inc/all.inc.php +++ b/inc/all.inc.php @@ -1,49 +1,49 @@ prepare('SELECT username FROM users WHERE username = ?'); - $op->execute($usernameArray); + $op = $db->prepare('SELECT username FROM users WHERE username = ?'); + $op->execute($usernameArray); - $data = $op->fetch(); - if (isset($data['username'])) - $dbUsername = $data['username']; - else - $dbUsername = NULL; + $data = $op->fetch(); + if (isset($data['username'])) + $dbUsername = $data['username']; + else + $dbUsername = NULL; - if (isset($dbUsername)) { - return true; - } else { - return false; - } + if (isset($dbUsername)) { + return true; + } else { + return false; + } } diff --git a/inc/auth.inc.php b/inc/auth.inc.php index 3a9f102..d8b60c8 100644 --- a/inc/auth.inc.php +++ b/inc/auth.inc.php @@ -1,59 +1,59 @@ prepare('SELECT username, password FROM users WHERE username = ?'); - $op->execute($username2); + $op = $db->prepare('SELECT username, password FROM users WHERE username = ?'); + $op->execute($username2); - $dbPassword = $op->fetch()['password']; + $dbPassword = $op->fetch()['password']; - return password_verify($password, $dbPassword); + return password_verify($password, $dbPassword); } function outdatedPasswordHash($username) { - $username2[0] = $username; + $username2[0] = $username; - $db = new PDO('sqlite:' . DB_PATH); + $db = new PDO('sqlite:' . DB_PATH); - $op = $db->prepare('SELECT username, password FROM users WHERE username = ?'); - $op->execute($username2); + $op = $db->prepare('SELECT username, password FROM users WHERE username = ?'); + $op->execute($username2); - $dbPassword = $op->fetch()['password']; + $dbPassword = $op->fetch()['password']; - return password_needs_rehash($dbPassword, ALGO_PASSWORD, OPTIONS_PASSWORD); + return password_needs_rehash($dbPassword, ALGO_PASSWORD, OPTIONS_PASSWORD); } function changePassword($username, $password) { - $password = hashPassword($password); + $password = hashPassword($password); - $db = new PDO('sqlite:' . DB_PATH); + $db = new PDO('sqlite:' . DB_PATH); - $stmt = $db->prepare("UPDATE users SET password = :password WHERE username = :username"); + $stmt = $db->prepare("UPDATE users SET password = :password WHERE username = :username"); - $stmt->bindParam(':username', $username); - $stmt->bindParam(':password', $password); + $stmt->bindParam(':username', $username); + $stmt->bindParam(':password', $password); - $stmt->execute(); + $stmt->execute(); } function antiCSRF() { - if (!isset($_SERVER['HTTP_SEC_FETCH_SITE']) AND !isset($_SERVER['HTTP_ORIGIN'])) - exit("ERROR: Browser sent neither Sec-Fetch-Site nor Origin HTTP headers, so anti-CSRF verification can't be done."); + if (!isset($_SERVER['HTTP_SEC_FETCH_SITE']) AND !isset($_SERVER['HTTP_ORIGIN'])) + exit("ERROR: Browser sent neither Sec-Fetch-Site nor Origin HTTP headers, so anti-CSRF verification can't be done."); - if (isset($_SERVER['HTTP_ORIGIN']) AND $_SERVER['HTTP_ORIGIN'] !== ORIGIN) - exit("ERROR: Anti-CSRF verification failed"); + if (isset($_SERVER['HTTP_ORIGIN']) AND $_SERVER['HTTP_ORIGIN'] !== ORIGIN) + exit("ERROR: Anti-CSRF verification failed"); - if (isset($_SERVER['HTTP_SEC_FETCH_SITE']) AND $_SERVER['HTTP_SEC_FETCH_SITE'] !== "same-origin") - exit("ERROR: Anti-CSRF verification failed"); + if (isset($_SERVER['HTTP_SEC_FETCH_SITE']) AND $_SERVER['HTTP_SEC_FETCH_SITE'] !== "same-origin") + exit("ERROR: Anti-CSRF verification failed"); } diff --git a/inc/const.inc.php b/inc/const.inc.php index b0baa36..a517b54 100644 --- a/inc/const.inc.php +++ b/inc/const.inc.php @@ -1,6 +1,6 @@ 65536, - "time_cost" => 24, - "threads" => 64, + "memory_cost" => 65536, + "time_cost" => 24, + "threads" => 64, )); // Color scheme define("THEME", array( - // Displayed on light theme - 'darkRegColor' => "#D100D1", - 'darkNsColor' => "#006DFF", - 'darkHtColor' => "#008768", - 'darkAuthColor' => "#EE0000", + // Displayed on light theme + 'darkRegColor' => "#D100D1", + 'darkNsColor' => "#006DFF", + 'darkHtColor' => "#008768", + 'darkAuthColor' => "#EE0000", - // Displayed on dark theme - 'lightRegColor' => "#FF50FF", - 'lightNsColor' => "#00FFFF", - 'lightHtColor' => "#FFFF00", - 'lightAuthColor' => "#00FF00", + // Displayed on dark theme + 'lightRegColor' => "#FF50FF", + 'lightNsColor' => "#00FFFF", + 'lightHtColor' => "#FFFF00", + 'lightAuthColor' => "#00FF00", - 'lightColor' => '#FFFFFF', - 'darkColor' => '#000000', + 'lightColor' => '#FFFFFF', + 'darkColor' => '#000000', )); // Public suffixes define("SUFFIXES", array( - REGISTRY, + REGISTRY, )); diff --git a/inc/form/form.ns.inc.php b/inc/form/form.ns.inc.php index 21069d5..ab301c7 100644 --- a/inc/form/form.ns.inc.php +++ b/inc/form/form.ns.inc.php @@ -1,59 +1,59 @@
- Domaine -
- -
- -
-
- -
- +
+
+ +
+ -
+ if (!empty($zones)) { + foreach ($zones as $zone) + echo ""; + } + ?> + +
- TTL -
- -
- - - -
-
- -
- -
+ TTL +
+ +
+ + + +
+
+ +
+ +
diff --git a/inc/format.inc.php b/inc/format.inc.php index 5b8bf3c..0fac824 100644 --- a/inc/format.inc.php +++ b/inc/format.inc.php @@ -1,32 +1,32 @@ $absoluteDir) { - $tree = explode("/", $absoluteDir); // The last key is NULL - end($tree); - $relativeDirs[$i] = prev($tree); // The name of the site dir is the before last key - } - return $relativeDirs; + exec(LS_PATH . " --format=single-column -d " . HT_PATH . "/" . $username . "/ht/*/", $absoluteDirs); + $relativeDirs = false; + foreach ($absoluteDirs as $i => $absoluteDir) { + $tree = explode("/", $absoluteDir); // The last key is NULL + end($tree); + $relativeDirs[$i] = prev($tree); // The name of the site dir is the before last key + } + return $relativeDirs; } function addSite($username, $siteDir, $domain, $domainType, $protocol) { - $db = new PDO('sqlite:' . DB_PATH); + $db = new PDO('sqlite:' . DB_PATH); - $op = $db->prepare("INSERT INTO sites(username, site_dir, domain, domain_type, protocol, creation_date, le_enabled) VALUES(:username, :site_dir, :domain, :domain_type, :protocol, :creation_date, :le_enabled)"); + $op = $db->prepare("INSERT INTO sites(username, site_dir, domain, domain_type, protocol, creation_date, le_enabled) VALUES(:username, :site_dir, :domain, :domain_type, :protocol, :creation_date, :le_enabled)"); - $time = date("Y-m-d H:i:s"); - if ($domainType === "dns" AND $protocol === "http") - $le_enabled = 0; - else - $le_enabled = NULL; + $time = date("Y-m-d H:i:s"); + if ($domainType === "dns" AND $protocol === "http") + $le_enabled = 0; + else + $le_enabled = NULL; - $op->bindParam(':username', $username); - $op->bindParam(':site_dir', $siteDir); - $op->bindParam(':domain', $domain); - $op->bindParam(':domain_type', $domainType); - $op->bindParam(':protocol', $protocol); - $op->bindParam(':creation_date', $time); - $op->bindParam(':le_enabled', $le_enabled); + $op->bindParam(':username', $username); + $op->bindParam(':site_dir', $siteDir); + $op->bindParam(':domain', $domain); + $op->bindParam(':domain_type', $domainType); + $op->bindParam(':protocol', $protocol); + $op->bindParam(':creation_date', $time); + $op->bindParam(':le_enabled', $le_enabled); - $op->execute(); + $op->execute(); } function listDbDirs($username, $domainType, $protocol) { - $db = new PDO('sqlite:' . DB_PATH); - $usernameArray[0] = $username; + $db = new PDO('sqlite:' . DB_PATH); + $usernameArray[0] = $username; - $op = $db->prepare('SELECT site_dir FROM sites WHERE username = :username AND domain_type = :domain_type AND protocol = :protocol'); - $op->bindParam(':username', $username); - $op->bindParam(':domain_type', $domainType); - $op->bindParam(':protocol', $protocol); - $op->execute(); + $op = $db->prepare('SELECT site_dir FROM sites WHERE username = :username AND domain_type = :domain_type AND protocol = :protocol'); + $op->bindParam(':username', $username); + $op->bindParam(':domain_type', $domainType); + $op->bindParam(':protocol', $protocol); + $op->execute(); - $i = 0; - $data = $op->fetch(); - if (isset($data['site_dir'])) - $siteDir = $data['site_dir']; - else - $siteDir = NULL; + $i = 0; + $data = $op->fetch(); + if (isset($data['site_dir'])) + $siteDir = $data['site_dir']; + else + $siteDir = NULL; - while ($siteDir != NULL) { - $siteDirs[$i] = $siteDir; - $i++; - $data = $op->fetch(); - if (isset($data['site_dir'])) - $siteDir = $data['site_dir']; - else - $siteDir = NULL; - } - if (isset($siteDirs)) - return $siteDirs; - else - return false; + while ($siteDir != NULL) { + $siteDirs[$i] = $siteDir; + $i++; + $data = $op->fetch(); + if (isset($data['site_dir'])) + $siteDir = $data['site_dir']; + else + $siteDir = NULL; + } + if (isset($siteDirs)) + return $siteDirs; + else + return false; } function sftpStatus($username) { - $db = new PDO('sqlite:' . DB_PATH); - $usernameArr[0] = $username; + $db = new PDO('sqlite:' . DB_PATH); + $usernameArr[0] = $username; - $op = $db->prepare('SELECT sftp_enabled FROM users WHERE username = ?'); - $op->execute($usernameArr); + $op = $db->prepare('SELECT sftp_enabled FROM users WHERE username = ?'); + $op->execute($usernameArr); - $status = $op->fetch()['sftp_enabled']; + $status = $op->fetch()['sftp_enabled']; - if ($status == "0") { - return false; - } else if ($status == "1") { - return true; - } else { - exit("Wrong value for sftp_enabled"); - } + if ($status == "0") { + return false; + } else if ($status == "1") { + return true; + } else { + exit("Wrong value for sftp_enabled"); + } } function enableSftp($username) { - $db = new PDO('sqlite:' . DB_PATH); + $db = new PDO('sqlite:' . DB_PATH); - $op = $db->prepare("UPDATE users SET sftp_enabled = 1 WHERE username = :username"); + $op = $db->prepare("UPDATE users SET sftp_enabled = 1 WHERE username = :username"); - $op->bindParam(':username', $username); + $op->bindParam(':username', $username); - $op->execute(); + $op->execute(); } function selectSites($username, $domainType, $protocol, $onlyLeAvailable) { - $db = new PDO('sqlite:' . DB_PATH); - $usernameArray[0] = $username; + $db = new PDO('sqlite:' . DB_PATH); + $usernameArray[0] = $username; - $query = "SELECT site_dir,domain FROM sites WHERE username = :username AND domain_type = :domain_type AND protocol = :protocol"; + $query = "SELECT site_dir,domain FROM sites WHERE username = :username AND domain_type = :domain_type AND protocol = :protocol"; - if ($onlyLeAvailable === true) - $query = $query . " AND le_enabled = 0"; + if ($onlyLeAvailable === true) + $query = $query . " AND le_enabled = 0"; - $op = $db->prepare($query); - $op->bindParam(':username', $username); - $op->bindParam(':domain_type', $domainType); - $op->bindParam(':protocol', $protocol); - $op->execute(); + $op = $db->prepare($query); + $op->bindParam(':username', $username); + $op->bindParam(':domain_type', $domainType); + $op->bindParam(':protocol', $protocol); + $op->execute(); - $i = 0; - $entry = $op->fetch(); - while (isset($entry['site_dir'])) { - $result[$i]["siteDir"] = $entry['site_dir']; - $result[$i]["domain"] = $entry['domain']; - $i++; - $entry = $op->fetch(); - } + $i = 0; + $entry = $op->fetch(); + while (isset($entry['site_dir'])) { + $result[$i]["siteDir"] = $entry['site_dir']; + $result[$i]["domain"] = $entry['domain']; + $i++; + $entry = $op->fetch(); + } - if (isset($result)) - return $result; - else - return false; + if (isset($result)) + return $result; + else + return false; } diff --git a/inc/ns.inc.php b/inc/ns.inc.php index 52f1770..d2e289e 100644 --- a/inc/ns.inc.php +++ b/inc/ns.inc.php @@ -1,83 +1,83 @@ = 300 AND $values['ttl'] <= 432000)) - exit("Erreur : le TTL doit être compris entre 5 minutes et 5 jours (entre 300 et 432000 secondes)"); + if (!($values['ttl'] >= 300 AND $values['ttl'] <= 432000)) + exit("Erreur : le TTL doit être compris entre 5 minutes et 5 jours (entre 300 et 432000 secondes)"); - return $values; + return $values; } function nsListUserZones($username) { - $db = new PDO('sqlite:' . DB_PATH); - $usernameArray[0] = $username; + $db = new PDO('sqlite:' . DB_PATH); + $usernameArray[0] = $username; - $op = $db->prepare('SELECT zone FROM zones WHERE username = ?'); - $op->execute($usernameArray); + $op = $db->prepare('SELECT zone FROM zones WHERE username = ?'); + $op->execute($usernameArray); - $data = $op->fetch(); - if (isset($data['zone'])) - $zone = $data['zone']; - else - $zone = NULL; + $data = $op->fetch(); + if (isset($data['zone'])) + $zone = $data['zone']; + else + $zone = NULL; - $i = 0; - $zones = NULL; + $i = 0; + $zones = NULL; - while ($zone != NULL) { - $zones[$i] = $zone; - $i++; - $data = $op->fetch(); - if (isset($data['zone'])) - $zone = $data['zone']; - else - $zone = NULL; - } + while ($zone != NULL) { + $zones[$i] = $zone; + $i++; + $data = $op->fetch(); + if (isset($data['zone'])) + $zone = $data['zone']; + else + $zone = NULL; + } - return $zones; + return $zones; } function nsCheckZonePossession($submittedZone) { - checkAbsoluteDomainFormat($submittedZone); + checkAbsoluteDomainFormat($submittedZone); - $db = new PDO('sqlite:' . DB_PATH); - $username[0] = $_SESSION['username']; + $db = new PDO('sqlite:' . DB_PATH); + $username[0] = $_SESSION['username']; - $op = $db->prepare('SELECT zone FROM zones WHERE username = ?'); - $op->execute($username); + $op = $db->prepare('SELECT zone FROM zones WHERE username = ?'); + $op->execute($username); - $dbZone = $op->fetch()['zone']; + $dbZone = $op->fetch()['zone']; - while ($dbZone != NULL) { - if ($dbZone === $submittedZone) return; - $dbZone = $op->fetch()['zone']; - } + while ($dbZone != NULL) { + if ($dbZone === $submittedZone) return; + $dbZone = $op->fetch()['zone']; + } - // If there is no entry in the database for the user matching the submitted zone - exit("ERROR: You don't own this zone on the nameserver"); + // If there is no entry in the database for the user matching the submitted zone + exit("ERROR: You don't own this zone on the nameserver"); } diff --git a/inc/pages.inc.php b/inc/pages.inc.php index 66eb696..2d05f12 100644 --- a/inc/pages.inc.php +++ b/inc/pages.inc.php @@ -1,117 +1,117 @@ prepare('SELECT domain FROM registry WHERE username = ?'); - $op->execute($usernameArray); + $op = $db->prepare('SELECT domain FROM registry WHERE username = ?'); + $op->execute($usernameArray); - $domains = false; - $i = 0; - $data = $op->fetch(); - $domain = $data['domain']; + $domains = false; + $i = 0; + $data = $op->fetch(); + $domain = $data['domain']; - while ($domain != NULL) { - $domains[$i] = $domain; + while ($domain != NULL) { + $domains[$i] = $domain; - $data = $op->fetch(); - if (isset($data['domain'])) - $domain = $data['domain']; - else - $domain = NULL; + $data = $op->fetch(); + if (isset($data['domain'])) + $domain = $data['domain']; + else + $domain = NULL; - $i++; - } + $i++; + } - return $domains; + return $domains; } function regCheckDomainPossession($domain) { - checkAbsoluteDomainFormat($domain); + checkAbsoluteDomainFormat($domain); - $db = new PDO('sqlite:' . DB_PATH); - $username[0] = $_SESSION['username']; + $db = new PDO('sqlite:' . DB_PATH); + $username[0] = $_SESSION['username']; - $op = $db->prepare('SELECT domain FROM registry WHERE username = ?'); - $op->execute($username); + $op = $db->prepare('SELECT domain FROM registry WHERE username = ?'); + $op->execute($username); - $dbDomain = $op->fetch()['domain']; + $dbDomain = $op->fetch()['domain']; - $owned = false; - while ($dbDomain != NULL) { - if ($dbDomain === $domain) { - $owned = true; - break; - } - $dbDomain = $op->fetch()['domain']; - } + $owned = false; + while ($dbDomain != NULL) { + if ($dbDomain === $domain) { + $owned = true; + break; + } + $dbDomain = $op->fetch()['domain']; + } - if (!($owned === true)) - exit("Erreur : Vous ne possédez pas ce domaine sur le registre !"); + if (!($owned === true)) + exit("Erreur : Vous ne possédez pas ce domaine sur le registre !"); } function regIsFree($domain) { - $domainArray[0] = $domain; + $domainArray[0] = $domain; - $db = new PDO('sqlite:' . DB_PATH); + $db = new PDO('sqlite:' . DB_PATH); - $req = $db->prepare('SELECT domain FROM registry WHERE domain = ?'); - $req->execute($domainArray); + $req = $db->prepare('SELECT domain FROM registry WHERE domain = ?'); + $req->execute($domainArray); - $data = $req->fetch(); + $data = $req->fetch(); - if (isset($data['domain'])) { - return false; - } else { - return true; - } + if (isset($data['domain'])) { + return false; + } else { + return true; + } } diff --git a/index.php b/index.php index 6d2136b..72cad63 100644 --- a/index.php +++ b/index.php @@ -1,22 +1,22 @@
-
Registre
-
- Demander l'attribution d'un sous-domaine de -
-
Serveurs de noms
-
- Utiliser le serveur de noms de Niver pour héberger ses zones -
-
Hypertexte
-
- Mettre en ligne son site statique sur un espace SFTP, et le faire répondre en HTTP ou Gemini par le DNS ou Tor -
-
Authentification
-
- Gérer son compte Niver -
+
Registre
+
+ Demander l'attribution d'un sous-domaine de +
+
Serveurs de noms
+
+ Utiliser le serveur de noms de Niver pour héberger ses zones +
+
Hypertexte
+
+ Mettre en ligne son site statique sur un espace SFTP, et le faire répondre en HTTP ou Gemini par le DNS ou Tor +
+
Authentification
+
+ Gérer son compte Niver +
diff --git a/less/buttons.less b/less/buttons.less index b0d3f13..eb81f82 100644 --- a/less/buttons.less +++ b/less/buttons.less @@ -1,160 +1,160 @@ .button { - font-size: 35px; - font-weight: 600; - border-width: 4px; - border-style: solid; - text-decoration: none; - border-radius: 20px; - padding: 14px 18px 16px 18px; - margin: 10px; - margin-left: 0px; - display: inline-block; + font-size: 35px; + font-weight: 600; + border-width: 4px; + border-style: solid; + text-decoration: none; + border-radius: 20px; + padding: 14px 18px 16px 18px; + margin: 10px; + margin-left: 0px; + display: inline-block; } .htButton { - .button(); + .button(); - @media @light { - border-color: @darkHtColor; - color: @darkHtColor; - &:hover, &:focus { - background-color: @darkHtColor; - &::selection { - color: @darkHtColor; - } - } - &::selection { - background-color: @darkHtColor; - } - } + @media @light { + border-color: @darkHtColor; + color: @darkHtColor; + &:hover, &:focus { + background-color: @darkHtColor; + &::selection { + color: @darkHtColor; + } + } + &::selection { + background-color: @darkHtColor; + } + } - @media @dark { - border-color: @lightHtColor; - color: @lightHtColor; - &:hover, &:focus { - background-color: @lightHtColor; - &::selection { - color: @lightHtColor; - } - } - &::selection { - background-color: @lightHtColor; - } - } + @media @dark { + border-color: @lightHtColor; + color: @lightHtColor; + &:hover, &:focus { + background-color: @lightHtColor; + &::selection { + color: @lightHtColor; + } + } + &::selection { + background-color: @lightHtColor; + } + } } .regButton { - .button(); + .button(); - @media @light { - border-color: @darkRegColor; - color: @darkRegColor; - &:hover, &:focus { - background-color: @darkRegColor; - &::selection { - color: @darkRegColor; - } - } - &::selection { - background-color: @darkRegColor; - } - } + @media @light { + border-color: @darkRegColor; + color: @darkRegColor; + &:hover, &:focus { + background-color: @darkRegColor; + &::selection { + color: @darkRegColor; + } + } + &::selection { + background-color: @darkRegColor; + } + } - @media @dark { - border-color: @lightRegColor; - color: @lightRegColor; - &:hover, &:focus { - background-color: @lightRegColor; - &::selection { - color: @lightRegColor; - } - } - &::selection { - background-color: @lightRegColor; - } - } + @media @dark { + border-color: @lightRegColor; + color: @lightRegColor; + &:hover, &:focus { + background-color: @lightRegColor; + &::selection { + color: @lightRegColor; + } + } + &::selection { + background-color: @lightRegColor; + } + } } .nsButton { - .button(); + .button(); - @media @light { - border-color: @darkNsColor; - color: @darkNsColor; - &:hover, &:focus { - background-color: @darkNsColor; - &::selection { - color: @darkNsColor; - } - } - &::selection { - background-color: @darkNsColor; - } - } + @media @light { + border-color: @darkNsColor; + color: @darkNsColor; + &:hover, &:focus { + background-color: @darkNsColor; + &::selection { + color: @darkNsColor; + } + } + &::selection { + background-color: @darkNsColor; + } + } - @media @dark { - border-color: @lightNsColor; - color: @lightNsColor; - &:hover, &:focus { - background-color: @lightNsColor; - &::selection { - color: @lightNsColor; - } - } - &::selection { - background-color: @lightNsColor; - } - } + @media @dark { + border-color: @lightNsColor; + color: @lightNsColor; + &:hover, &:focus { + background-color: @lightNsColor; + &::selection { + color: @lightNsColor; + } + } + &::selection { + background-color: @lightNsColor; + } + } } .authButton { - .button(); + .button(); - @media @light { - border-color: @darkAuthColor; - color: @darkAuthColor; - &:hover, &:focus { - background-color: @darkAuthColor; - &::selection { - color: @darkAuthColor; - } - } - &::selection { - background-color: @darkAuthColor; - } - } + @media @light { + border-color: @darkAuthColor; + color: @darkAuthColor; + &:hover, &:focus { + background-color: @darkAuthColor; + &::selection { + color: @darkAuthColor; + } + } + &::selection { + background-color: @darkAuthColor; + } + } - @media @dark { - border-color: @lightAuthColor; - color: @lightAuthColor; - &:hover, &:focus { - background-color: @lightAuthColor; - &::selection { - color: @lightAuthColor; - } - } - &::selection { - background-color: @lightAuthColor; - } - } + @media @dark { + border-color: @lightAuthColor; + color: @lightAuthColor; + &:hover, &:focus { + background-color: @lightAuthColor; + &::selection { + color: @lightAuthColor; + } + } + &::selection { + background-color: @lightAuthColor; + } + } } @media @light { - .htButton:hover, .regButton:hover, .nsButton:hover, .authButton:hover, - .htButton:focus, .regButton:focus, .nsButton:focus, .authButton:focus { - color: @lightColor; - &::selection { - background-color: @lightColor; - } - } + .htButton:hover, .regButton:hover, .nsButton:hover, .authButton:hover, + .htButton:focus, .regButton:focus, .nsButton:focus, .authButton:focus { + color: @lightColor; + &::selection { + background-color: @lightColor; + } + } } @media @dark { - .htButton:hover, .regButton:hover, .nsButton:hover, .authButton:hover, - .htButton:focus, .regButton:focus, .nsButton:focus, .authButton:focus { - color: @darkColor; - &::selection { - background-color: @darkColor; - } - } + .htButton:hover, .regButton:hover, .nsButton:hover, .authButton:hover, + .htButton:focus, .regButton:focus, .nsButton:focus, .authButton:focus { + color: @darkColor; + &::selection { + background-color: @darkColor; + } + } } diff --git a/less/form.less b/less/form.less index daf9b11..c565393 100644 --- a/less/form.less +++ b/less/form.less @@ -1,103 +1,103 @@ form { - margin-left: 50px; - margin-right: 50px; - text-align: center; - @media (max-width: 500px) { - margin-left: 0px; - margin-right: 0px; - } + margin-left: 50px; + margin-right: 50px; + text-align: center; + @media (max-width: 500px) { + margin-left: 0px; + margin-right: 0px; + } } input, select { - border-radius: 12px; - font-size: @fontSize; - margin: 5px; - padding: 10px; - border-style: solid; - border-width: 2px; + border-radius: 12px; + font-size: @fontSize; + margin: 5px; + padding: 10px; + border-style: solid; + border-width: 2px; - &:hover { - border-width: 3px; - padding: 9px; - } - &:focus { - border-width: 4px; - padding: 8px; - } + &:hover { + border-width: 3px; + padding: 9px; + } + &:focus { + border-width: 4px; + padding: 8px; + } - @media @light { - background-color: @lightColor; - color: @darkColor; - border-color: @darkColor; - } + @media @light { + background-color: @lightColor; + color: @darkColor; + border-color: @darkColor; + } - @media @dark { - background-color: @darkColor; - color: @lightColor; - border-color: @lightColor; - } + @media @dark { + background-color: @darkColor; + color: @lightColor; + border-color: @lightColor; + } } input[type=text] { - font-family: monospace; + font-family: monospace; } input[type=submit] { - margin: 22px; + margin: 22px; } input#subdomain, input#ttl-value { - text-align: right; + text-align: right; } #password { - width: 32ch; - text-align: center; + width: 32ch; + text-align: center; } #username { - width: 16ch; + width: 16ch; } #keytag { - width: 7ch; + width: 7ch; } input:invalid+span::after { - content: '✖'; + content: '✖'; } input:valid+span::after { - content: ''; // ✓ + content: ''; // ✓ } input+span::after { - display: inline-block; - width: 20px; - font-size: 30px; - padding-left: 20px; - font-family: monospace; + display: inline-block; + width: 20px; + font-size: 30px; + padding-left: 20px; + font-family: monospace; } label.aboutInputCondition { - display: block; - font-size: @fontSize - 10%; + display: block; + font-size: @fontSize - 10%; } fieldset { - border-radius: 20px; - border-width: 2px; - border-style: solid; - display: flex; - flex-direction: row; - justify-content: center; + border-radius: 20px; + border-width: 2px; + border-style: solid; + display: flex; + flex-direction: row; + justify-content: center; - @media @light { - border-color: @darkColor; - } + @media @light { + border-color: @darkColor; + } - @media @dark { - border-color: @lightColor; - } + @media @dark { + border-color: @lightColor; + } } diff --git a/less/main.less b/less/main.less index 2b491f2..dfd0b2c 100644 --- a/less/main.less +++ b/less/main.less @@ -4,89 +4,89 @@ @dark: ~"(prefers-color-scheme: dark)"; html { - margin: 0px; - line-height: @fontSize + 6%; + margin: 0px; + line-height: @fontSize + 6%; } h1 { - font-size: @fontSize + 25px; - line-height: @fontSize + 30px + font-size: @fontSize + 25px; + line-height: @fontSize + 30px } body { - margin: 0px; - font-family: system-ui, sans-serif; - font-size: @fontSize; + margin: 0px; + font-family: system-ui, sans-serif; + font-size: @fontSize; } header, main, footer { - margin-left: 20%; - margin-right: 20%; - @media (max-width: 500px) { - margin-left: 20px; - margin-right: 20px; - } + margin-left: 20%; + margin-right: 20%; + @media (max-width: 500px) { + margin-left: 20px; + margin-right: 20px; + } } code { - line-height: @fontSize + 6%; - font-size: @fontSize; + line-height: @fontSize + 6%; + font-size: @fontSize; } nav { - display: inline-block; - margin-left: 20px; - margin-right: 20px; + display: inline-block; + margin-left: 20px; + margin-right: 20px; } header { - text-align: center; - margin-top: 20px; + text-align: center; + margin-top: 20px; } p { - margin: 0px; - margin-bottom: 15px; + margin: 0px; + margin-bottom: 15px; } h2 { - margin: 0px; - padding: 0px; + margin: 0px; + padding: 0px; } .breakable { - word-break: break-all; + word-break: break-all; } @media @light { - html { - background-color: @lightColor; - color: @darkColor; - } + html { + background-color: @lightColor; + color: @darkColor; + } - ::selection { - background-color: @darkColor; - color: @lightColor; - } + ::selection { + background-color: @darkColor; + color: @lightColor; + } - a { - color: @darkColor; - } + a { + color: @darkColor; + } } @media @dark { - html { - background-color: @darkColor; - color: @lightColor; - } + html { + background-color: @darkColor; + color: @lightColor; + } - ::selection { - background-color: @lightColor; - color: @darkColor; - } + ::selection { + background-color: @lightColor; + color: @darkColor; + } - a { - color: @lightColor; - } + a { + color: @lightColor; + } } diff --git a/ns/caa.php b/ns/caa.php index 99f7111..2329e68 100644 --- a/ns/caa.php +++ b/ns/caa.php @@ -2,47 +2,47 @@
- + -
- -
- -
- -
- -
- -
- -
- +
+ +
+ +
+ +
+ +
+ +
+ +
+
= 0 AND $_POST['flag'] <= 255)) - exit("ERROR: Wrong value for flag"); + if (!($_POST['flag'] >= 0 AND $_POST['flag'] <= 255)) + exit("ERROR: Wrong value for flag"); - if (!(preg_match("/^[a-z]{1,127}$/", $_POST['tag']))) - exit("ERROR: Wrong value for tag"); + if (!(preg_match("/^[a-z]{1,127}$/", $_POST['tag']))) + exit("ERROR: Wrong value for tag"); - if (!(preg_match("/^[a-z0-9.-]{1,255}$/", $_POST['value']))) - exit("ERROR: Wrong value for value"); + if (!(preg_match("/^[a-z0-9.-]{1,255}$/", $_POST['value']))) + exit("ERROR: Wrong value for value"); - exec(KNOTC_PATH . " zone-begin " . $_POST['zone']); - exec(KNOTC_PATH . " zone-" . $values['action'] . "set " . $_POST['zone'] . " " . $values['domain'] . " " . $values['ttl'] . " IN CAA " . $_POST['flag'] . " " . $_POST['tag'] . " " . $_POST['value']); - exec(KNOTC_PATH . " zone-commit " . $_POST['zone']); - echo "Enregistrement ajouté"; + exec(KNOTC_PATH . " zone-begin " . $_POST['zone']); + exec(KNOTC_PATH . " zone-" . $values['action'] . "set " . $_POST['zone'] . " " . $values['domain'] . " " . $values['ttl'] . " IN CAA " . $_POST['flag'] . " " . $_POST['tag'] . " " . $_POST['value']); + exec(KNOTC_PATH . " zone-commit " . $_POST['zone']); + echo "Enregistrement ajouté"; } diff --git a/ns/dnssec.php b/ns/dnssec.php index 294df71..56d49f1 100644 --- a/ns/dnssec.php +++ b/ns/dnssec.php @@ -3,72 +3,72 @@ Afin d'activer DNSSEC, vous devez indiquer un enregistrement DS à la zone parente.
- + - " . $zone . ""; - } - } + if ($zones) { + foreach($zones as $zone) { + echo ""; + } + } - ?> - -
- + ?> + +
+
+ ?> -
+
-
Zone
-
- -
+
Zone
+
+ +
-
Tag
-
- -
+
Tag
+
+ +
-
Algorithme
-
- 15 (Ed25519) -
+
Algorithme
+
+ 15 (Ed25519) +
-
Condensat de type 2 (SHA-256)
-
- -
+
Condensat de type 2 (SHA-256)
+
+ +
-
Condensat de type 4 (SHA-384 ; optionnel)
-
- -
+
Condensat de type 4 (SHA-384 ; optionnel)
+
+ +
-
+
-
- Données brutes -
-
+
+ Données brutes +
+
diff --git a/ns/index.php b/ns/index.php index d9e27f0..a962cb6 100644 --- a/ns/index.php +++ b/ns/index.php @@ -1,61 +1,61 @@
-
Gérer ses zones
-
- Pour qu'elle soit gérée par le serveur de noms de Niver -
-
Obtenir les enregistrements DS
-
- À indiquer à la zone parente pour activer DNSSEC -
-
Enregistrement NS
-
- Indiquer le serveur de noms d'une zone -
-
Enregistrements A et AAAA
-
- Indiquer l'adresse IP d'un domaine -
-
Enregistrement TXT
-
- Associer du texte à un domaine -
+
Gérer ses zones
+
+ Pour qu'elle soit gérée par le serveur de noms de Niver +
+
Obtenir les enregistrements DS
+
+ À indiquer à la zone parente pour activer DNSSEC +
+
Enregistrement NS
+
+ Indiquer le serveur de noms d'une zone +
+
Enregistrements A et AAAA
+
+ Indiquer l'adresse IP d'un domaine +
+
Enregistrement TXT
+
+ Associer du texte à un domaine +
-
Enregistrement SRV
-
- Indiquer un serveur pour un domaine -
-
Enregistrement MX
-
- Indiquer le serveur mail pour un domaine -
-
Enregistrement CAA
-
- Indiquer les seules autorités de certifications autorisée à signer les domaines -
-
Enregistrement TLSA
-
- Mettre en place DANE en indiquant l'empreinte d'un certificat TLS -
-
Enregistrement SSHFP
-
- Indiquer les empreintes de clés SSH d'un domaine -
-
NOT DONE : Enregistrement LOC
-
- Indiquer des coordonnées géographiques -
+
Enregistrement SRV
+
+ Indiquer un serveur pour un domaine +
+
Enregistrement MX
+
+ Indiquer le serveur mail pour un domaine +
+
Enregistrement CAA
+
+ Indiquer les seules autorités de certifications autorisée à signer les domaines +
+
Enregistrement TLSA
+
+ Mettre en place DANE en indiquant l'empreinte d'un certificat TLS +
+
Enregistrement SSHFP
+
+ Indiquer les empreintes de clés SSH d'un domaine +
+
NOT DONE : Enregistrement LOC
+
+ Indiquer des coordonnées géographiques +
- +
diff --git a/ns/ip.php b/ns/ip.php index d783d11..bf34031 100644 --- a/ns/ip.php +++ b/ns/ip.php @@ -1,41 +1,41 @@

- Ici vous pouvez ajouter ou enlever des adresses IP dans une zone déjà enregistrée sur le serveur de noms de Niver -
Le format IPv4 (A) ou IPv6 (AAAA) sera détecté automatiquement. -
Si vous souhaitez utiliser un service d'hébergement hypertexte de Niver, voici les adresses à renseigner : -
IPv4 : -
IPv6 : + Ici vous pouvez ajouter ou enlever des adresses IP dans une zone déjà enregistrée sur le serveur de noms de Niver +
Le format IPv4 (A) ou IPv6 (AAAA) sera détecté automatiquement. +
Si vous souhaitez utiliser un service d'hébergement hypertexte de Niver, voici les adresses à renseigner : +
IPv4 : +
IPv6 :

- -
-
- + +
+
+
diff --git a/ns/loc.php b/ns/loc.php index 99f7111..2329e68 100644 --- a/ns/loc.php +++ b/ns/loc.php @@ -2,47 +2,47 @@
- + -
- -
- -
- -
- -
- -
- -
- +
+ +
+ +
+ +
+ +
+ +
+ +
+
= 0 AND $_POST['flag'] <= 255)) - exit("ERROR: Wrong value for flag"); + if (!($_POST['flag'] >= 0 AND $_POST['flag'] <= 255)) + exit("ERROR: Wrong value for flag"); - if (!(preg_match("/^[a-z]{1,127}$/", $_POST['tag']))) - exit("ERROR: Wrong value for tag"); + if (!(preg_match("/^[a-z]{1,127}$/", $_POST['tag']))) + exit("ERROR: Wrong value for tag"); - if (!(preg_match("/^[a-z0-9.-]{1,255}$/", $_POST['value']))) - exit("ERROR: Wrong value for value"); + if (!(preg_match("/^[a-z0-9.-]{1,255}$/", $_POST['value']))) + exit("ERROR: Wrong value for value"); - exec(KNOTC_PATH . " zone-begin " . $_POST['zone']); - exec(KNOTC_PATH . " zone-" . $values['action'] . "set " . $_POST['zone'] . " " . $values['domain'] . " " . $values['ttl'] . " IN CAA " . $_POST['flag'] . " " . $_POST['tag'] . " " . $_POST['value']); - exec(KNOTC_PATH . " zone-commit " . $_POST['zone']); - echo "Enregistrement ajouté"; + exec(KNOTC_PATH . " zone-begin " . $_POST['zone']); + exec(KNOTC_PATH . " zone-" . $values['action'] . "set " . $_POST['zone'] . " " . $values['domain'] . " " . $values['ttl'] . " IN CAA " . $_POST['flag'] . " " . $_POST['tag'] . " " . $_POST['value']); + exec(KNOTC_PATH . " zone-commit " . $_POST['zone']); + echo "Enregistrement ajouté"; } diff --git a/ns/mx.php b/ns/mx.php index 185098b..4ac7903 100644 --- a/ns/mx.php +++ b/ns/mx.php @@ -2,42 +2,42 @@
- + -
+
- -
- + +
+ -
+
- -
- + +
+ -
- +
+
= 0 AND $_POST['priority'] <= 255)) - exit("ERROR: Wrong value for priority"); + if (!($_POST['priority'] >= 0 AND $_POST['priority'] <= 255)) + exit("ERROR: Wrong value for priority"); - checkAbsoluteDomainFormat($_POST['host']); + checkAbsoluteDomainFormat($_POST['host']); - exec(KNOTC_PATH . " zone-begin " . $_POST['zone']); - exec(KNOTC_PATH . " zone-" . $values['action'] . "set " . $_POST['zone'] . " " . $values['domain'] . " " . $values['ttl'] . " IN MX " . $_POST['priority'] . " " . $_POST['host']); - exec(KNOTC_PATH . " zone-commit " . $_POST['zone']); - echo "Enregistrement ajouté"; + exec(KNOTC_PATH . " zone-begin " . $_POST['zone']); + exec(KNOTC_PATH . " zone-" . $values['action'] . "set " . $_POST['zone'] . " " . $values['domain'] . " " . $values['ttl'] . " IN MX " . $_POST['priority'] . " " . $_POST['host']); + exec(KNOTC_PATH . " zone-commit " . $_POST['zone']); + echo "Enregistrement ajouté"; } ?> diff --git a/ns/ns.php b/ns/ns.php index ea5be86..c5e805b 100644 --- a/ns/ns.php +++ b/ns/ns.php @@ -1,28 +1,28 @@
- -
- -
- -
- + +
+ +
+ +
+
diff --git a/ns/srv.php b/ns/srv.php index c14cbd0..589dc02 100644 --- a/ns/srv.php +++ b/ns/srv.php @@ -2,62 +2,62 @@
- + -
+
- -
- + +
+ -
+
- -
- + +
+ -
+
- -
- + +
+ -
+
- -
- + +
+ -
- +
+
= 0 AND $_POST['priority'] <= 65535)) - exit("ERROR: Wrong value for priority"); + if (!($_POST['priority'] >= 0 AND $_POST['priority'] <= 65535)) + exit("ERROR: Wrong value for priority"); - if (!($_POST['weight'] >= 0 AND $_POST['weight'] <= 65535)) - exit("ERROR: Wrong value for weight"); + if (!($_POST['weight'] >= 0 AND $_POST['weight'] <= 65535)) + exit("ERROR: Wrong value for weight"); - if (!($_POST['port'] >= 0 AND $_POST['port'] <= 65535)) - exit("ERROR: Wrong value for port"); + if (!($_POST['port'] >= 0 AND $_POST['port'] <= 65535)) + exit("ERROR: Wrong value for port"); - checkAbsoluteDomainFormat($_POST['target']); + checkAbsoluteDomainFormat($_POST['target']); - exec(KNOTC_PATH . " zone-begin " . $_POST['zone']); - exec(KNOTC_PATH . " zone-" . $values['action'] . "set " . $_POST['zone'] . " " . $values['domain'] . " " . $values['ttl'] . " IN SRV " . $_POST['priority'] . " " . $_POST['weight'] . " " . $_POST['port'] . " " . $_POST['target']); - exec(KNOTC_PATH . " zone-commit " . $_POST['zone']); - echo "Enregistrement ajouté"; + exec(KNOTC_PATH . " zone-begin " . $_POST['zone']); + exec(KNOTC_PATH . " zone-" . $values['action'] . "set " . $_POST['zone'] . " " . $values['domain'] . " " . $values['ttl'] . " IN SRV " . $_POST['priority'] . " " . $_POST['weight'] . " " . $_POST['port'] . " " . $_POST['target']); + exec(KNOTC_PATH . " zone-commit " . $_POST['zone']); + echo "Enregistrement ajouté"; } ?> diff --git a/ns/sshfp.php b/ns/sshfp.php index 27ff205..8efd84c 100644 --- a/ns/sshfp.php +++ b/ns/sshfp.php @@ -2,59 +2,59 @@
- + -
+
- -
- + +
+ -
+
- -
- -
+ +
+ +
- -
- + +
+ -
- +
+
diff --git a/ns/tlsa.php b/ns/tlsa.php index e120e46..dfe4e2f 100644 --- a/ns/tlsa.php +++ b/ns/tlsa.php @@ -2,73 +2,73 @@
- + -
- -
- -
+
+ +
+ +
- -
- -
+ +
+ +
- -
- -
+ +
+ +
- -
- -
- + +
+ +
+
= 0 AND $_POST['use'] <= 3)) - exit("ERROR: Wrong value for use"); + if (!($_POST['use'] >= 0 AND $_POST['use'] <= 3)) + exit("ERROR: Wrong value for use"); - if (!($_POST['selector'] === "0" OR $_POST['selector'] === "1")) - exit("ERROR: Wrong value for selector"); + if (!($_POST['selector'] === "0" OR $_POST['selector'] === "1")) + exit("ERROR: Wrong value for selector"); - if (!($_POST['type'] >= 0 OR $_POST['type'] <= 2)) - exit("ERROR: Wrong value for type"); + if (!($_POST['type'] >= 0 OR $_POST['type'] <= 2)) + exit("ERROR: Wrong value for type"); - if (!(preg_match("/^[a-zA-Z0-9.-]{1,1024}$/", $_POST['content']))) - exit("ERROR: Wrong value for content"); + if (!(preg_match("/^[a-zA-Z0-9.-]{1,1024}$/", $_POST['content']))) + exit("ERROR: Wrong value for content"); - exec(KNOTC_PATH . " zone-begin " . $_POST['zone']); - exec(KNOTC_PATH . " zone-" . $values['action'] . "set " . $_POST['zone'] . " " . $values['domain'] . " " . $values['ttl'] . " IN TLSA " . $_POST['use'] . " " . $_POST['selector'] . " " . $_POST['type'] . " " . $_POST['content']); - exec(KNOTC_PATH . " zone-commit " . $_POST['zone']); - echo "Enregistrement ajouté"; + exec(KNOTC_PATH . " zone-begin " . $_POST['zone']); + exec(KNOTC_PATH . " zone-" . $values['action'] . "set " . $_POST['zone'] . " " . $values['domain'] . " " . $values['ttl'] . " IN TLSA " . $_POST['use'] . " " . $_POST['selector'] . " " . $_POST['type'] . " " . $_POST['content']); + exec(KNOTC_PATH . " zone-commit " . $_POST['zone']); + echo "Enregistrement ajouté"; } diff --git a/ns/txt.php b/ns/txt.php index c834bdb..3329c6f 100644 --- a/ns/txt.php +++ b/ns/txt.php @@ -1,29 +1,29 @@
- -
- -
- -
- + +
+ +
+ +
+
diff --git a/ns/zone.php b/ns/zone.php index 55f768d..2bd9db0 100644 --- a/ns/zone.php +++ b/ns/zone.php @@ -1,89 +1,89 @@
-

Ajouter une zone

-
-
- +

Ajouter une zone

+
+
+
prepare("INSERT INTO zones(zone, username) VALUES(:zone, :username)"); + $db = new PDO('sqlite:' . DB_PATH); + $stmt = $db->prepare("INSERT INTO zones(zone, username) VALUES(:zone, :username)"); - $stmt->bindParam(':zone', $_POST['domain']); - $stmt->bindParam(':username', $_SESSION['username']); + $stmt->bindParam(':zone', $_POST['domain']); + $stmt->bindParam(':username', $_SESSION['username']); - $stmt->execute(); + $stmt->execute(); - $knotZonePath = KNOT_ZONES_PATH . "/" . $_POST['domain'] . "zone"; - $knotZone = file_get_contents(NIVER_TEMPLATE_PATH . "/knot.template"); - $knotZone = preg_replace("/DOMAIN/", $_POST['domain'], $knotZone); - file_put_contents($knotZonePath, $knotZone); - chmod($knotZonePath, 0660); + $knotZonePath = KNOT_ZONES_PATH . "/" . $_POST['domain'] . "zone"; + $knotZone = file_get_contents(NIVER_TEMPLATE_PATH . "/knot.template"); + $knotZone = preg_replace("/DOMAIN/", $_POST['domain'], $knotZone); + file_put_contents($knotZonePath, $knotZone); + chmod($knotZonePath, 0660); - exec(KNOTC_PATH . " conf-begin"); - exec(KNOTC_PATH . " conf-set 'zone[" . $_POST['domain'] . "]'"); - exec(KNOTC_PATH . " conf-set 'zone[" . $_POST['domain'] . "].template' 'niver'"); - exec(KNOTC_PATH . " conf-commit"); + exec(KNOTC_PATH . " conf-begin"); + exec(KNOTC_PATH . " conf-set 'zone[" . $_POST['domain'] . "]'"); + exec(KNOTC_PATH . " conf-set 'zone[" . $_POST['domain'] . "].template' 'niver'"); + exec(KNOTC_PATH . " conf-commit"); - echo "La requête a été traitée."; + echo "La requête a été traitée."; } ?>
-

Supprimer une zone

- - + " . $zone . ""; - } + if (!empty($zones)) { + foreach ($zones as $zone) + echo ""; + } ?> - -
- + +
+
prepare("DELETE FROM zones WHERE zone = :zone AND username = :username"); + // Remove from Niver's database + $db = new PDO('sqlite:' . DB_PATH); + $stmt = $db->prepare("DELETE FROM zones WHERE zone = :zone AND username = :username"); - $stmt->bindParam(':zone', $_POST['zone']); - $stmt->bindParam(':username', $_SESSION['username']); + $stmt->bindParam(':zone', $_POST['zone']); + $stmt->bindParam(':username', $_SESSION['username']); - $stmt->execute(); + $stmt->execute(); - echo "La requête a été traitée."; + echo "La requête a été traitée."; } ?> diff --git a/reg/ds.php b/reg/ds.php index b73a52e..01c30b1 100644 --- a/reg/ds.php +++ b/reg/ds.php @@ -1,104 +1,104 @@
- - -
- -
- + + + +
+ +
+ -
- -
- -
- -
- -
- -
- -
- -
- -
- + +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
= 1) OR !($_POST['keytag'] <= 65535)) - exit("Wrong value for keytag"); + $_POST['keytag'] = intval($_POST['keytag']); + if ((!preg_match("/^[0-9]{1,6}$/", $_POST['keytag'])) OR !($_POST['keytag'] >= 1) OR !($_POST['keytag'] <= 65535)) + exit("Wrong value for keytag"); - if (!$_POST['dt'] === "2" AND !$_POST['dt'] === "4") - exit("Wrong value for dt"); + if (!$_POST['dt'] === "2" AND !$_POST['dt'] === "4") + exit("Wrong value for dt"); - checkAbsoluteDomainFormat($_POST['zone']); - nsCheckZonePossession($_POST['zone']); - regCheckDomainPossession($_POST['zone']); + checkAbsoluteDomainFormat($_POST['zone']); + nsCheckZonePossession($_POST['zone']); + regCheckDomainPossession($_POST['zone']); - $action = checkAction($_POST['action']); + $action = checkAction($_POST['action']); - $suffix = regGetUpperDomain($_POST['zone']); + $suffix = regGetUpperDomain($_POST['zone']); - exec(KNOTC_PATH . " zone-begin " . $suffix); - exec(KNOTC_PATH . " zone-" . $action . "set " . $suffix . " " . $_POST['zone'] . " 86400 IN DS " . $_POST['keytag'] . " " . $_POST['algo'] . " " . $_POST['dt'] . " " . $_POST['key']); - exec(KNOTC_PATH . " zone-commit " . $suffix); - echo "La requête a été envoyée à Knot"; + exec(KNOTC_PATH . " zone-begin " . $suffix); + exec(KNOTC_PATH . " zone-" . $action . "set " . $suffix . " " . $_POST['zone'] . " 86400 IN DS " . $_POST['keytag'] . " " . $_POST['algo'] . " " . $_POST['dt'] . " " . $_POST['key']); + exec(KNOTC_PATH . " zone-commit " . $suffix); + echo "La requête a été envoyée à Knot"; } diff --git a/reg/glue.php b/reg/glue.php index de3b7a9..67aaa04 100644 --- a/reg/glue.php +++ b/reg/glue.php @@ -1,77 +1,77 @@
- - -
- Domaine -
- -
- -
-
- -
- + + + +
+ Domaine +
+ +
+ +
+
+ +
+ -
-
-
- -
- + ?> + +
+
+
+ +
+
diff --git a/reg/index.php b/reg/index.php index dda4860..f3a8e40 100644 --- a/reg/index.php +++ b/reg/index.php @@ -1,22 +1,22 @@
-
Enregistrer un nouveau domaine
-
- Prendre possession d'un sous-domaine de -
-
Enregistrement NS
-
- Indiquer les serveurs de noms de son sous-domaine de -
-
Enregistrement DS
-
- Déléguer la confiance DNSSEC -
-
Glue Record
-
- Indiquer les IP de ses serveurs de noms de son sous-domaine de dont les adresses se trouvent sur ce même sous-domaine -
+
Enregistrer un nouveau domaine
+
+ Prendre possession d'un sous-domaine de +
+
Enregistrement NS
+
+ Indiquer les serveurs de noms de son sous-domaine de +
+
Enregistrement DS
+
+ Déléguer la confiance DNSSEC +
+
Glue Record
+
+ Indiquer les IP de ses serveurs de noms de son sous-domaine de dont les adresses se trouvent sur ce même sous-domaine +
diff --git a/reg/ns.php b/reg/ns.php index 897fcb0..ccab3b7 100644 --- a/reg/ns.php +++ b/reg/ns.php @@ -1,64 +1,64 @@
- - -
- -
- + + + +
+ +
+ -
- -
- -
- + ?> + +
+ +
+ +
+
diff --git a/reg/register.php b/reg/register.php index 1d74964..2744d90 100644 --- a/reg/register.php +++ b/reg/register.php @@ -5,61 +5,61 @@ Ce domaine doit être composé uniquement d'au moins 4 lettres latines non accen

-
- Domaine -
- -
- -
-
- -
- -
-
-
- +
+ Domaine +
+ +
+ +
+
+ +
+ +
+
+
+
prepare("INSERT INTO registry(domain, username, last_renewal) VALUES(:domain, :username, :last_renewal)"); - $username = $_SESSION['username']; + if (regIsFree($domain)) { + $db = new PDO('sqlite:' . DB_PATH); + $stmt = $db->prepare("INSERT INTO registry(domain, username, last_renewal) VALUES(:domain, :username, :last_renewal)"); + $username = $_SESSION['username']; - $time = date("Y-m-d H:i:s"); + $time = date("Y-m-d H:i:s"); - $stmt->bindParam(':domain', $domain); - $stmt->bindParam(':username', $username); - $stmt->bindParam(':last_renewal', $time); + $stmt->bindParam(':domain', $domain); + $stmt->bindParam(':username', $username); + $stmt->bindParam(':last_renewal', $time); - $stmt->execute(); + $stmt->execute(); - echo "Nouveau domaine enregistré"; + echo "Nouveau domaine enregistré"; - } else { - echo "Le domaine " . $domain . " n'est pas disponible à l'enregistrement. Il est réservé ou déjà enregistré."; - } - } else { - echo "Erreur : Le nom de domaine doit être composé uniquement d'entre 4 et 63 lettres minuscules (a-z)"; - } + } else { + echo "Le domaine " . $domain . " n'est pas disponible à l'enregistrement. Il est réservé ou déjà enregistré."; + } + } else { + echo "Erreur : Le nom de domaine doit être composé uniquement d'entre 4 et 63 lettres minuscules (a-z)"; + } } ?> diff --git a/top.inc.php b/top.inc.php index 8779d4a..d9fcff1 100644 --- a/top.inc.php +++ b/top.inc.php @@ -1,6 +1,6 @@ 'niver', - 'sid_length' => 64, - 'sid_bits_per_character' => 6, - 'cookie_secure' => true, - 'cookie_httponly' => true, - 'cookie_samesite' => 'Strict', - 'cookie_path' => PREFIX . '/', - 'cookie_lifetime' => 432000, // = 60*60*24*5 = 5 days - 'gc_maxlifetime' => 10800, - 'use_strict_mode' => true, - 'use_cookies' => true, - 'use_only_cookies' => true, - ]); + isset($_COOKIE['niver']) // Resume session + OR + (SERVICE === "auth" // Create new session + AND PAGE === "login" + AND isset($_POST['username'])) + ) { + session_start([ + 'name' => 'niver', + 'sid_length' => 64, + 'sid_bits_per_character' => 6, + 'cookie_secure' => true, + 'cookie_httponly' => true, + 'cookie_samesite' => 'Strict', + 'cookie_path' => PREFIX . '/', + 'cookie_lifetime' => 432000, // = 60*60*24*5 = 5 days + 'gc_maxlifetime' => 10800, + 'use_strict_mode' => true, + 'use_cookies' => true, + 'use_only_cookies' => true, + ]); } // Remove .php from URL (if any) if (substr($_SERVER['REQUEST_URI'], -4) == ".php") { - header("Location: " . PREFIX . "/" . SERVICE . "/" . PAGE, true, 301); // 301 Moved Permanently - exit; + header("Location: " . PREFIX . "/" . SERVICE . "/" . PAGE, true, 301); // 301 Moved Permanently + exit; } // Less > CSS compilation @@ -56,47 +56,47 @@ $relativeLessFiles = array_flip($relativeLessFiles); // Change relative paths into absolute paths foreach ($relativeLessFiles as $relativeLessFile => $nothing) { - $absoluteLessFiles[ROOT_PATH . "/less/" . $relativeLessFile] = ""; + $absoluteLessFiles[ROOT_PATH . "/less/" . $relativeLessFile] = ""; } // Generate one minified CSS file into css/ from sources in less/ $options = array( - 'cache_dir' => ROOT_PATH . '/css/', - 'compress' => true + 'cache_dir' => ROOT_PATH . '/css/', + 'compress' => true ); $cssFileName = Less_Cache::Get($absoluteLessFiles, $options, THEME); ?> - - - <?php - if (isset($page['title']) AND $page['title'] != "Accueil") - echo $page['title'] . " · "; - if (isset($page['service'])) { - echo $page['service'] . " · "; - } ?>Niver - - - + + + <?php + if (isset($page['title']) AND $page['title'] != "Accueil") + echo $page['title'] . " · "; + if (isset($page['service'])) { + echo $page['service'] . " · "; + } ?>Niver + + + - -
+ +
- + - -

- + +

+ -
-
+
+