?, remove too much indentation

This commit is contained in:
Miraty 2021-02-17 22:48:49 +01:00
parent ade9c31b74
commit 64f1ec1a25
33 changed files with 1123 additions and 950 deletions

1
.gitignore vendored
View file

@ -1,2 +1,3 @@
css/
niver.log
db/niver.db

148
admin/reg.php Normal file
View file

@ -0,0 +1,148 @@
<?php
define("PREFIX", "/malaxe");
define("ROOT_PATH", "/var/www/niver" . PREFIX);
define("DB_PATH", ROOT_PATH . "/db/auth.db");
$suffixes = array(
"atope.art.",
"asso.atope.art.",
"org.atope.art.",
"perso.atope.art.",
"blog.atope.art.",
"me.atope.art.",
"edu.atope.art.",
"info.atope.art.",
"wiki.atope.art.",
"sci.atope.art.",
"pol.atope.art.",
"libre.atope.art.",
"fem.atope.art.",
"eco.atope.art.",
"veg.atope.art.",
"bio.atope.art.",
"anar.atope.art.",
"ancom.atope.art.",
"acab.atope.art.",
"handi.atope.art.",
"queer.atope.art.",
"gay.atope.art.",
"enby.atope.art.",
"trans.atope.art.",
"net.atope.art.",
"tech.atope.art.",
"io.atope.art.",
"sec.atope.art.",
"cyber.atope.art.",
"dev.atope.art.",
"geek.atope.art.",
"fs.atope.art.",
"ht.atope.art.",
"hyper.atope.art.",
"git.atope.art.",
"forge.atope.art.",
"code.atope.art.",
"lab.atope.art.",
"labs.atope.art.",
"gemini.atope.art.",
"gmi.atope.art.",
"gemlog.atope.art.",
"mail.atope.art.",
"ynh.atope.art.",
"yuno.atope.art.",
"sys.atope.art.",
"fed.atope.art.",
"fedi.atope.art.",
"soc.atope.art.",
"masto.atope.art.",
"plero.atope.art.",
"pix.atope.art.",
"mobi.atope.art.",
"art.atope.art.",
"music.atope.art.",
"video.atope.art.",
"draw.atope.art.",
"audio.atope.art.",
"ink.atope.art.",
"na.atope.art.",
"psy.atope.art.",
"neuro.atope.art.",
"auti.atope.art.",
"plur.atope.art.",
"blue.atope.art.",
"red.atope.art.",
"pink.atope.art.",
"green.atope.art.",
"black.atope.art.",
"city.atope.art.",
"town.atope.art.",
"cafe.atope.art.",
"home.atope.art.",
"forum.atope.art.",
"dream.atope.art.",
"space.atope.art.",
"forest.atope.art.",
"rain.atope.art.",
"snow.atope.art.",
"sun.atope.art.",
"earth.atope.art.",
"world.atope.art.",
"soft.atope.art.",
"cute.atope.art.",
"cutie.atope.art.",
"fun.atope.art.",
"play.atope.art.",
"game.atope.art.",
);
foreach ($suffixes as $extension) {
$db = new PDO('sqlite:' . DB_PATH);
$stmt = $db->prepare("INSERT INTO registry(domain, username, last_renewal) VALUES(:domain, :username, :last_renewal)");
$time = date("Y-m-d H:i:s");
$username = "niver";
$stmt->bindParam(':domain', $extension);
$stmt->bindParam(':username', $username);
$stmt->bindParam(':last_renewal', $time);
$stmt->execute();
/*
echo $extension . "\n";
exec("cp /var/lib/knot/zones/template /var/lib/knot/zones/" . $extension . "zone");
exec("sed -i 's/maison.atope.art./" . $extension . "/g' /var/lib/knot/zones/" . $extension . "zone");
exec("knotc zone-begin atope.art.");
exec("knotc zone-set atope.art. " . $extension . " 86400 IN NS ns1.atope.art.");
exec("knotc zone-set atope.art. " . $extension . " 86400 IN NS ns6.gandi.net.");
exec("knotc zone-commit atope.art.");
exec("knotc conf-begin");
exec("knotc conf-set 'zone[" . $extension . "]'");
exec("knotc conf-set 'zone[" . $extension . "].file' '" . $extension . "zone'");
exec("knotc conf-commit");
exec("knotc zone-begin " . $extension);
exec("knotc zone-set " . $extension . " " . $extension . " 86400 IN NS ns1.atope.art.");
exec("knotc zone-set " . $extension . " " . $extension . " 86400 IN NS ns6.gandi.net.");
exec("knotc zone-commit " . $extension);
unset($output);
exec("/usr/sbin/keymgr " . $extension . " ds", $output);
$dsRecord = preg_replace("/DS/", "86400 DS", $output[0]);
exec("knotc zone-begin " . $extension);
exec("knotc zone-set " . $extension . " " . $dsRecord);
exec("knotc zone-commit " . $extension);
*/
}

View file

@ -1,22 +0,0 @@
a,b
c,d
e,f
40,41
40,41
40,41
40,41
40,41
a,b
a,b
a,b
a,b
a,b
a,b
gergez,$2y$10$eozUhORVi31KoYcAfeV6R.dcT79GbJF4pWSFC1SPrUSuTmFbFOSXq
hrteheryt,$2y$10$b1KPV/WdDxLxgBhfyYZaGOOcxeZ.a7kO0oogjIwIxxLL3XbGIDrx6
loiloiulilui,$2y$10$nmsmh1hqTKDSVKQyIBw34eLHiU7qGADQk8BMY6SYW7mydtmTVEST.
luiluylitlyuk,$2y$10$AD2X7Pd0KPrVHAxX3Xij.O5JwNnfOHKWx02yxqeZfFxqWOmsCOsea
grgreg,$2y$10$PKUsl.OvHQjc2BbDdjoJMea8/nW28EipJhrOaOx4XytIuJcpLQFkW
,$2y$10$xO..USSsDDfJm8El13gu/esh1tV/3NJG4kOypfKn48iQyYXkmXJvW
ab,$2y$10$/I1TZ2D59588b5j1xx6qZ.gZtOhUQ9L5/vgOfL5ovJtUDARf3LUu2
azerty,$2y$10$fSTFx1sZEgzN2DcD9lWbKO8ee/QBRR3Ph83vRvZD8169/z/hvhk3S
1 a b
2 c d
3 e f
4 40 41
5 40 41
6 40 41
7 40 41
8 40 41
9 a b
10 a b
11 a b
12 a b
13 a b
14 a b
15 gergez $2y$10$eozUhORVi31KoYcAfeV6R.dcT79GbJF4pWSFC1SPrUSuTmFbFOSXq
16 hrteheryt $2y$10$b1KPV/WdDxLxgBhfyYZaGOOcxeZ.a7kO0oogjIwIxxLL3XbGIDrx6
17 loiloiulilui $2y$10$nmsmh1hqTKDSVKQyIBw34eLHiU7qGADQk8BMY6SYW7mydtmTVEST.
18 luiluylitlyuk $2y$10$AD2X7Pd0KPrVHAxX3Xij.O5JwNnfOHKWx02yxqeZfFxqWOmsCOsea
19 grgreg $2y$10$PKUsl.OvHQjc2BbDdjoJMea8/nW28EipJhrOaOx4XytIuJcpLQFkW
20 $2y$10$xO..USSsDDfJm8El13gu/esh1tV/3NJG4kOypfKn48iQyYXkmXJvW
21 ab $2y$10$/I1TZ2D59588b5j1xx6qZ.gZtOhUQ9L5/vgOfL5ovJtUDARf3LUu2
22 azerty $2y$10$fSTFx1sZEgzN2DcD9lWbKO8ee/QBRR3Ph83vRvZD8169/z/hvhk3S

View file

@ -1,53 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Connexion au compte Hypertopie</title>
</head>
<body>
<header>
<h1>Serveur de nom ns1.atope.art</h1>
</header>
<p>
Connexion à votre compte Hypertopie
</p>
<form action="login-csv.php" method="post">
<label for="username">Identifiant :</label><br>
<input id="username" name="username" type="text"/><br>
<label for="password">Mot de passe :</label><br>
<input id="password" name="password" type="password"/><br>
<input type="submit"/>
</form>
<?php
if (isset($_POST['password'])) {
if (($file = fopen("acc.csv", "r")) !== FALSE) {
while (($ligne = fgetcsv($file, 1000, ",")) !== FALSE) {
if ($_POST['username'] == $ligne[0]) {
if (password_verify($_POST['password'], $ligne[1])) {
echo "Connexion réussie";
} else {
echo "Connexion échouée";
}
exit();
}
}
fclose($file);
}
echo "Formulaire traité !!";
} else {
echo "Rien n'a été reçu lors du dernière chargement";
}
?>
</body>
</html>
<?php

View file

@ -1,45 +1,47 @@
<?php require "../top.inc.php"; ?>
<form method="post">
<label for="username">Identifiant</label><br>
<input required="" minlength="4" maxlength="32" pattern="<?= USERNAME_REGEX ?>" id="username" name="username" type="text" placeholder="proudhon"><br>
<form method="post">
<label for="username">Identifiant</label><br>
<input required="" minlength="4" maxlength="32" pattern="<?= USERNAME_REGEX ?>" id="username" name="username" type="text" placeholder="proudhon">
<br>
<label for="password">Mot de passe</label><br>
<input required="" minlength="8" maxlength="1024" pattern="<?= PASSWORD_REGEX ?>" id="password" name="password" type="password" placeholder="************"><br>
<label for="password">Mot de passe</label><br>
<input required="" minlength="8" maxlength="1024" pattern="<?= PASSWORD_REGEX ?>" id="password" name="password" type="password" placeholder="************">
<br>
<input type="submit">
</form>
<input type="submit">
</form>
Pas de compte ? <a class="authButton" href="register">En créer un</a>
Pas de compte ? <a class="authButton" href="register">En créer un</a>
<?php
<?php
if (isset($_POST['username']) AND isset($_POST['password'])) {
if (isset($_POST['username']) AND isset($_POST['password'])) {
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 (checkPassword($_POST['username'], $_POST['password'])) {
$_SESSION['username'] = htmlspecialchars($_POST['username']);
$_SESSION['sftp_enabled'] = sftpStatus($_SESSION['username']);
if (isset($_GET['redir'])) {
if (preg_match("/^[0-9a-z\/-]+$/", $_GET['redir']))
header('Location: ' . PREFIX . "/" . $_GET['redir']);
else
exit("ERROR : Wrong caracter in redir argument");
} else {
header('Location: ' . PREFIX);
}
exit;
} else {
echo "<br>Connexion impossible : mot de passe invalide";
}
if (!checkUsernameFormat($_POST['username']))
exit("Le format du nom du compte n'est pas valide !");
if (checkPassword($_POST['username'], $_POST['password'])) {
$_SESSION['username'] = htmlspecialchars($_POST['username']);
$_SESSION['sftp_enabled'] = sftpStatus($_SESSION['username']);
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 "<br>Connexion impossible : mot de passe invalide";
}
?>
}
?>
<?php require "../bottom.inc.php"; ?>

View file

@ -1,48 +1,46 @@
<?php require "../top.inc.php"; ?>
<p>
Vous pouvez ici changer le mot de passe permettant d'accéder à votre compte Niver.
</p>
<p>
Vous pouvez ici changer le mot de passe permettant d'accéder à votre compte Niver.
</p>
<form method="post">
<label for="currentPassword">Mot de passe actuel</label><br>
<input required="" minlength="8" maxlength="1024" pattern="<?= PASSWORD_REGEX ?>" id="currentPassword" name="currentPassword" type="password" placeholder="************"><br>
<form method="post">
<label for="currentPassword">Mot de passe actuel</label><br>
<input required="" minlength="8" maxlength="1024" pattern="<?= PASSWORD_REGEX ?>" id="currentPassword" name="currentPassword" type="password" placeholder="************"><br>
<label for="newPassword">Nouveau mot de passe</label><br>
<input required="" minlength="8" maxlength="1024" pattern="<?= PASSWORD_REGEX ?>" id="newPassword" name="newPassword" type="password" placeholder="************"><br>
<label for="newPassword">Nouveau mot de passe</label><br>
<input required="" minlength="8" maxlength="1024" pattern="<?= PASSWORD_REGEX ?>" id="newPassword" name="newPassword" type="password" placeholder="************"><br>
<input type="submit">
</form>
<input type="submit">
</form>
<?php
<?php
if (isset($_SESSION['username']) AND isset($_POST['newPassword']) AND isset($_POST['currentPassword'])) {
if (isset($_SESSION['username']) AND isset($_POST['newPassword']) AND isset($_POST['currentPassword'])) {
if (checkPassword($_SESSION['username'], $_POST['currentPassword'])) {
if (checkPassword($_SESSION['username'], $_POST['currentPassword'])) {
if (!checkPasswordFormat($_POST['newPassword']))
exit("Erreur : Le format du mot de passe n'est pas bon !");
if (!checkPasswordFormat($_POST['newPassword']))
exit("Erreur : Le format du nouveau mot de passe n'est pas bon !");
$username = $_SESSION['username'];
$newPassword = password_hash($_POST['newPassword'], PASSWORD_DEFAULT);
$username = $_SESSION['username'];
$newPassword = password_hash($_POST['newPassword'], PASSWORD_DEFAULT);
$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', $newPassword);
$stmt->bindParam(':username', $username);
$stmt->bindParam(':password', $newPassword);
$stmt->execute();
$stmt->execute();
} else {
echo "<br>Le mot de passe actuel n'est pas bon !";
}
} else {
echo "<br>Le mot de passe actuel n'est pas bon !";
}
}
}
?>
?>
<?php require "../bottom.inc.php"; ?>

View file

@ -1,32 +0,0 @@
<?php include "../top.inc.php"; ?>
<p>
Ici vous pouvez ajouter ou enlever des IPv4 dans une zone déjà enregistrée sur le serveur ns1.atope.art
</p>
<form action="register-csv.php" method="post">
<label for="username">Identifiant :</label><br>
<input id="username" name="username" type="text"/><br>
<label for="password">Mot de passe</label><br>
<input id="password" name="password" type="password"/><br>
<input type="submit"/>
</form>
<?php
if (isset($_POST['password'])) {
// Register the user to the CSV file
file_put_contents("acc.csv", $_POST['username'] . "," . password_hash($_POST['password'], PASSWORD_DEFAULT) . "\n", FILE_APPEND);
// Adds user to the system
echo "Formulaire traité !!";
} else {
echo "Rien n'a été reçu lors du dernière chargement";
}
?>
<?php include "../bottom.inc.php"; ?>

View file

@ -2,8 +2,6 @@
if (strpos($_SERVER['PHP_SELF'], "inc.php") !== false)
exit("This file is meant to be included.");
?>
<br>
<br>
<footer>
<small>
<?php if (isset($_SESSION['username'])) {
@ -13,7 +11,5 @@ if (strpos($_SERVER['PHP_SELF'], "inc.php") !== false)
<?php } ?>
</small>
</footer>
</body>
</html>

View file

@ -1,11 +0,0 @@
<?php
if (strpos($_SERVER['PHP_SELF'], "inc.php") !== false)
exit("This file is meant to be included.");
function setupDB() {
try {
$db = new PDO('sqlite:/var/www/nic/db/auth.db');
} catch(Exception $e) {
die('Erreur SQLite : ' . $e->getMessage());
}
}

Binary file not shown.

128
db/structure.sql Normal file
View file

@ -0,0 +1,128 @@
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE IF NOT EXISTS "registry" (
"id" INTEGER NOT NULL UNIQUE,
"domain" TEXT,
"username" TEXT,
"last_renewal" INTEGER,
PRIMARY KEY("id" AUTOINCREMENT)
);
INSERT INTO registry VALUES(23,'atope.art.','niver','2021-02-16 22:33:52');
INSERT INTO registry VALUES(24,'asso.atope.art.','niver','2021-02-16 22:33:52');
INSERT INTO registry VALUES(25,'org.atope.art.','niver','2021-02-16 22:33:52');
INSERT INTO registry VALUES(26,'perso.atope.art.','niver','2021-02-16 22:33:52');
INSERT INTO registry VALUES(27,'blog.atope.art.','niver','2021-02-16 22:33:52');
INSERT INTO registry VALUES(28,'me.atope.art.','niver','2021-02-16 22:33:52');
INSERT INTO registry VALUES(29,'edu.atope.art.','niver','2021-02-16 22:33:53');
INSERT INTO registry VALUES(30,'info.atope.art.','niver','2021-02-16 22:33:53');
INSERT INTO registry VALUES(31,'wiki.atope.art.','niver','2021-02-16 22:33:53');
INSERT INTO registry VALUES(32,'sci.atope.art.','niver','2021-02-16 22:33:53');
INSERT INTO registry VALUES(33,'pol.atope.art.','niver','2021-02-16 22:33:53');
INSERT INTO registry VALUES(34,'libre.atope.art.','niver','2021-02-16 22:33:53');
INSERT INTO registry VALUES(35,'fem.atope.art.','niver','2021-02-16 22:33:53');
INSERT INTO registry VALUES(36,'eco.atope.art.','niver','2021-02-16 22:33:53');
INSERT INTO registry VALUES(37,'veg.atope.art.','niver','2021-02-16 22:33:53');
INSERT INTO registry VALUES(38,'bio.atope.art.','niver','2021-02-16 22:33:53');
INSERT INTO registry VALUES(39,'anar.atope.art.','niver','2021-02-16 22:33:53');
INSERT INTO registry VALUES(40,'ancom.atope.art.','niver','2021-02-16 22:33:53');
INSERT INTO registry VALUES(41,'acab.atope.art.','niver','2021-02-16 22:33:53');
INSERT INTO registry VALUES(42,'handi.atope.art.','niver','2021-02-16 22:33:53');
INSERT INTO registry VALUES(43,'queer.atope.art.','niver','2021-02-16 22:33:53');
INSERT INTO registry VALUES(44,'gay.atope.art.','niver','2021-02-16 22:33:54');
INSERT INTO registry VALUES(45,'enby.atope.art.','niver','2021-02-16 22:33:54');
INSERT INTO registry VALUES(46,'trans.atope.art.','niver','2021-02-16 22:33:54');
INSERT INTO registry VALUES(47,'net.atope.art.','niver','2021-02-16 22:33:54');
INSERT INTO registry VALUES(48,'tech.atope.art.','niver','2021-02-16 22:33:54');
INSERT INTO registry VALUES(49,'io.atope.art.','niver','2021-02-16 22:33:54');
INSERT INTO registry VALUES(50,'sec.atope.art.','niver','2021-02-16 22:33:54');
INSERT INTO registry VALUES(51,'cyber.atope.art.','niver','2021-02-16 22:33:54');
INSERT INTO registry VALUES(52,'dev.atope.art.','niver','2021-02-16 22:33:54');
INSERT INTO registry VALUES(53,'geek.atope.art.','niver','2021-02-16 22:33:54');
INSERT INTO registry VALUES(54,'fs.atope.art.','niver','2021-02-16 22:33:54');
INSERT INTO registry VALUES(55,'ht.atope.art.','niver','2021-02-16 22:33:54');
INSERT INTO registry VALUES(56,'hyper.atope.art.','niver','2021-02-16 22:33:54');
INSERT INTO registry VALUES(57,'git.atope.art.','niver','2021-02-16 22:33:54');
INSERT INTO registry VALUES(58,'forge.atope.art.','niver','2021-02-16 22:33:54');
INSERT INTO registry VALUES(59,'code.atope.art.','niver','2021-02-16 22:33:55');
INSERT INTO registry VALUES(60,'lab.atope.art.','niver','2021-02-16 22:33:55');
INSERT INTO registry VALUES(61,'labs.atope.art.','niver','2021-02-16 22:33:55');
INSERT INTO registry VALUES(62,'gemini.atope.art.','niver','2021-02-16 22:33:55');
INSERT INTO registry VALUES(63,'gmi.atope.art.','niver','2021-02-16 22:33:55');
INSERT INTO registry VALUES(64,'gemlog.atope.art.','niver','2021-02-16 22:33:55');
INSERT INTO registry VALUES(65,'mail.atope.art.','niver','2021-02-16 22:33:55');
INSERT INTO registry VALUES(66,'ynh.atope.art.','niver','2021-02-16 22:33:55');
INSERT INTO registry VALUES(67,'yuno.atope.art.','niver','2021-02-16 22:33:55');
INSERT INTO registry VALUES(68,'sys.atope.art.','niver','2021-02-16 22:33:55');
INSERT INTO registry VALUES(69,'fed.atope.art.','niver','2021-02-16 22:33:55');
INSERT INTO registry VALUES(70,'fedi.atope.art.','niver','2021-02-16 22:33:55');
INSERT INTO registry VALUES(71,'soc.atope.art.','niver','2021-02-16 22:33:55');
INSERT INTO registry VALUES(72,'masto.atope.art.','niver','2021-02-16 22:33:55');
INSERT INTO registry VALUES(73,'plero.atope.art.','niver','2021-02-16 22:33:55');
INSERT INTO registry VALUES(74,'pix.atope.art.','niver','2021-02-16 22:33:55');
INSERT INTO registry VALUES(75,'mobi.atope.art.','niver','2021-02-16 22:33:56');
INSERT INTO registry VALUES(76,'art.atope.art.','niver','2021-02-16 22:33:56');
INSERT INTO registry VALUES(77,'music.atope.art.','niver','2021-02-16 22:33:56');
INSERT INTO registry VALUES(78,'video.atope.art.','niver','2021-02-16 22:33:56');
INSERT INTO registry VALUES(79,'draw.atope.art.','niver','2021-02-16 22:33:56');
INSERT INTO registry VALUES(80,'audio.atope.art.','niver','2021-02-16 22:33:56');
INSERT INTO registry VALUES(81,'ink.atope.art.','niver','2021-02-16 22:33:56');
INSERT INTO registry VALUES(82,'na.atope.art.','niver','2021-02-16 22:33:56');
INSERT INTO registry VALUES(83,'psy.atope.art.','niver','2021-02-16 22:33:56');
INSERT INTO registry VALUES(84,'neuro.atope.art.','niver','2021-02-16 22:33:56');
INSERT INTO registry VALUES(85,'auti.atope.art.','niver','2021-02-16 22:33:56');
INSERT INTO registry VALUES(86,'plur.atope.art.','niver','2021-02-16 22:33:56');
INSERT INTO registry VALUES(87,'blue.atope.art.','niver','2021-02-16 22:33:56');
INSERT INTO registry VALUES(88,'red.atope.art.','niver','2021-02-16 22:33:56');
INSERT INTO registry VALUES(89,'pink.atope.art.','niver','2021-02-16 22:33:56');
INSERT INTO registry VALUES(90,'green.atope.art.','niver','2021-02-16 22:33:57');
INSERT INTO registry VALUES(91,'black.atope.art.','niver','2021-02-16 22:33:57');
INSERT INTO registry VALUES(92,'city.atope.art.','niver','2021-02-16 22:33:57');
INSERT INTO registry VALUES(93,'town.atope.art.','niver','2021-02-16 22:33:57');
INSERT INTO registry VALUES(94,'cafe.atope.art.','niver','2021-02-16 22:33:57');
INSERT INTO registry VALUES(95,'home.atope.art.','niver','2021-02-16 22:33:57');
INSERT INTO registry VALUES(96,'forum.atope.art.','niver','2021-02-16 22:33:57');
INSERT INTO registry VALUES(97,'dream.atope.art.','niver','2021-02-16 22:33:57');
INSERT INTO registry VALUES(98,'space.atope.art.','niver','2021-02-16 22:33:57');
INSERT INTO registry VALUES(99,'forest.atope.art.','niver','2021-02-16 22:33:57');
INSERT INTO registry VALUES(100,'rain.atope.art.','niver','2021-02-16 22:33:57');
INSERT INTO registry VALUES(101,'snow.atope.art.','niver','2021-02-16 22:33:57');
INSERT INTO registry VALUES(102,'sun.atope.art.','niver','2021-02-16 22:33:57');
INSERT INTO registry VALUES(103,'earth.atope.art.','niver','2021-02-16 22:33:57');
INSERT INTO registry VALUES(104,'world.atope.art.','niver','2021-02-16 22:33:58');
INSERT INTO registry VALUES(105,'soft.atope.art.','niver','2021-02-16 22:33:58');
INSERT INTO registry VALUES(106,'cute.atope.art.','niver','2021-02-16 22:33:58');
INSERT INTO registry VALUES(107,'cutie.atope.art.','niver','2021-02-16 22:33:58');
INSERT INTO registry VALUES(108,'fun.atope.art.','niver','2021-02-16 22:33:58');
INSERT INTO registry VALUES(109,'play.atope.art.','niver','2021-02-16 22:33:58');
INSERT INTO registry VALUES(110,'game.atope.art.','niver','2021-02-16 22:33:58');
CREATE TABLE IF NOT EXISTS "zones" (
"id" INTEGER NOT NULL UNIQUE,
"zone" TEXT NOT NULL,
"username" TEXT NOT NULL,
PRIMARY KEY("id" AUTOINCREMENT)
);
CREATE TABLE IF NOT EXISTS "users" (
"id" INTEGER NOT NULL UNIQUE,
"username" TEXT NOT NULL,
"password" TEXT NOT NULL,
"sftp_enabled" INTEGER NOT NULL,
"registration_date" INTEGER NOT NULL,
PRIMARY KEY("id" AUTOINCREMENT)
);
CREATE TABLE IF NOT EXISTS "sites" (
"id" INTEGER NOT NULL UNIQUE,
"username" TEXT NOT NULL,
"site_dir" TEXT NOT NULL,
"domain" TEXT NOT NULL,
"domain_type" TEXT NOT NULL,
"protocol" TEXT NOT NULL,
"creation_date" INTEGER NOT NULL,
PRIMARY KEY("id" AUTOINCREMENT)
);
DELETE FROM sqlite_sequence;
INSERT INTO sqlite_sequence VALUES(NULL,NULL);
INSERT INTO sqlite_sequence VALUES('registry',111);
INSERT INTO sqlite_sequence VALUES('zones',13);
INSERT INTO sqlite_sequence VALUES('users',46);
INSERT INTO sqlite_sequence VALUES('sites',0);
COMMIT;

22
dom.php
View file

@ -1,22 +0,0 @@
<form method="post">
<label for="domain">Domaine</label><br>
<input placeholder="niver.atope.art" id="domain" name="domain" type="text"/><br>
<input type="submit"/>
</form>
<?php
if (isset($_POST['domain'])) {
if (filter_var($_POST['domain'], FILTER_VALIDATE_DOMAIN)) {
echo htmlspecialchars(filter_var($_POST['domain'], FILTER_VALIDATE_DOMAIN));
} else {
echo "<br>Pas un domaine !!<br>";
}
echo "<br>Formulaire traité !!";
} else {
echo "<br>Rien n'a été reçu lors du dernière chargement";
}
?>

View file

@ -66,9 +66,7 @@ if (isset($_POST['domain']) AND isset($_POST['dir']) AND isset($_SESSION['userna
file_put_contents("/etc/nginx/hyper.d/" . $_POST['domain'] . ".conf", $conf);
exec("sudo /root/maniver/target/debug/maniver reload-nginx");
//certbot certonly --nginx -d testcrabe.atope.art
echo "Formulaire traité !!";
} else {
echo "Rien n'a été reçu lors du dernier chargement";
echo "Accès par domaine ajouté sur ce dossier !";
}
?>

View file

@ -1,34 +1,34 @@
<?php require "../top.inc.php"; ?>
<p>
Installer un certificat Let's Encrypt
</p>
<p>
Installer un certificat Let's Encrypt
</p>
<form method="post">
<label for="domain">Domaine sur lequel installer le certificat</label><br>
<input required="" placeholder="site.atope.art" id="domain" name="domain" type="text"><br>
<form method="post">
<label for="domain">Domaine sur lequel installer le certificat</label><br>
<input required="" placeholder="site.atope.art" id="domain" name="domain" type="text"><br>
<input value="Valider" type="submit">
</form>
<input value="Valider" type="submit">
</form>
<?php
<?php
if (isset($_POST['domain'])) {
if (isset($_POST['domain'])) {
exec("sudo /root/maniver/target/debug/maniver le-install " . $_POST['domain'], $output);
echo "<pre>";
print_r($output);
echo "</pre>";
$conf = file_get_contents("/etc/nginx/hyper.d/" . $_POST['domain'] . ".conf");
$conf = preg_replace("#host\.atope\.art#", $_POST['domain'], $conf);
file_put_contents("/etc/nginx/hyper.d/" . $_POST['domain'] . ".conf", $conf);
exec("sudo /root/maniver/target/debug/maniver le-install " . $_POST['domain'], $output);
echo "<pre>";
print_r($output);
echo "</pre>";
$conf = file_get_contents("/etc/nginx/hyper.d/" . $_POST['domain'] . ".conf");
$conf = preg_replace("#host\.atope\.art#", $_POST['domain'], $conf);
file_put_contents("/etc/nginx/hyper.d/" . $_POST['domain'] . ".conf", $conf);
exec("sudo /root/maniver/target/debug/maniver reload-nginx");
exec("sudo /root/maniver/target/debug/maniver reload-nginx");
echo "Formulaire traité !!";
} else {
echo "Rien n'a été reçu lors du dernier chargement";
}
echo "Formulaire traité !!";
} else {
echo "Rien n'a été reçu lors du dernier chargement";
}
?>
?>
<?php require "../bottom.inc.php"; ?>

View file

@ -1,27 +0,0 @@
<?php require "../top.inc.php"; ?>
<p>
Ici vous pouvez héberger des contenus hypertexte
</p>
<form method="post">
<label for="dir">Nom du dossier à créer :</label><br>
<input id="dir" name="dir" type="text"/><br>
<input value="Valider" type="submit">
</form>
<?php
if (isset($_SESSION['username']) AND isset($_POST['dir'])) {
// Setup SFTP access
exec("mkdir /srv/hyper/" . $_SESSION['username'] . "/" . $_POST['dir']);
echo "Formulaire traité !!";
} else {
echo "Rien n'a été reçu lors du dernier chargement";
}
?>
<?php require "../bottom.inc.php"; ?>

View file

@ -2,51 +2,50 @@
<?php
if ($_SESSION['sftp_enabled'] == false) { ?>
<p>
Pour que vous puissiez mettre en ligne votre site via SFTP, veuillez définir un mot de passe.
<br>Il ne pourra pas être modifié.
</p>
<p>
Pour que vous puissiez mettre en ligne votre site via <abbr title="SSH File Transfert Protocol">SFTP</abbr>, veuillez définir un mot de passe.
<br>Il ne pourra pas être modifié.
</p>
<form method="post">
<form method="post">
<label for="password">Créer le mot de passe</label><br>
<input required="" placeholder="**********" pattern="^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])[a-zA-Z0-9]{8,}|.{10,1024}$" id="password" name="password" type="password"><br>
<label for="password">Créer le mot de passe</label><br>
<input required="" placeholder="**********" pattern="^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])[a-zA-Z0-9]{8,}|.{10,1024}$" id="password" name="password" type="password"><br>
<input value="Activer" type="submit">
</form>
<input value="Activer" type="submit">
</form>
<?php
<?php
if (isset($_SESSION['username']) AND isset($_POST['password'])) {
// Setup SFTP access
exec("sudo /root/maniver/target/debug/maniver setup-user " . $_SESSION['username'] . " " . $_POST['password']);
enableSftp($_SESSION['username']);
$_SESSION['sftp_enabled'] = true;
}
if (isset($_SESSION['username']) AND isset($_POST['password'])) {
// Setup SFTP access
exec("sudo /root/maniver/target/debug/maniver setup-user " . $_SESSION['username'] . " " . $_POST['password']);
enableSftp($_SESSION['username']);
$_SESSION['sftp_enabled'] = true;
}
} else if ($_SESSION['sftp_enabled'] == true) { ?>
<br>
Indiquez les données ci-dessous à votre client SFPT pour accéder à vos sites.
<br><br>
Utilisateurice : <code><?= $_SESSION['username'] ?></code>
<br>
Mot de passe : celui que vous avez définit lors de l'activation de l'accès SFTP
<br>
Serveur : <code>sftp.niver.atope.art</code>
<br>
Port : <code>22</code>
<br>
Dossier : <code>/</code>
<br><br>
<a href="sftp://<?= $_SESSION['username'] ?>@sftp.niver.atope.art/">sftp://<?= $_SESSION['username'] ?>@sftp.niver.atope.art/</a>
<br><br>
SHA-256 des clés du serveur :
<br>Ed25519 : <code>MHwU49oafgq4jY6whUy2INWHMrs+uz4A0j+gsQEgho8</code>
<br>RSA : <code>6wWSPLxqns4ZKtnqzv7ch3k/R2ztPgDiCr4c0B/I/mw</code>
<br>ECDSA : <code>XMwGgdngT+MZPlndX7rB9CchjPRiJD3SPHKj18qYcPA</code>
<br>N'acceptez la connexion que si votre client vous montre les mêmes !
<br>
<br>
Indiquez les données ci-dessous à votre client <abbr title="SSH File Transfert Protocol">SFTP</abbr> pour accéder à vos sites.
<br><br>
Utilisateurice : <code><?= $_SESSION['username'] ?></code>
<br>
Mot de passe : celui que vous avez définit lors de l'activation de l'accès <abbr title="SSH File Transfert Protocol">SFTP</abbr>
<br>
Serveur : <code>sftp.niver.atope.art</code>
<br>
Port : <code>22</code>
<br>
Dossier : <code>/</code>
<br><br>
<a href="sftp://<?= $_SESSION['username'] ?>@sftp.niver.atope.art/">sftp://<?= $_SESSION['username'] ?>@sftp.niver.atope.art/</a>
<br><br>
SHA-256 des clés du serveur :
<br>Ed25519 : <code>MHwU49oafgq4jY6whUy2INWHMrs+uz4A0j+gsQEgho8</code>
<br>RSA : <code>6wWSPLxqns4ZKtnqzv7ch3k/R2ztPgDiCr4c0B/I/mw</code>
<br>ECDSA : <code>XMwGgdngT+MZPlndX7rB9CchjPRiJD3SPHKj18qYcPA</code>
<br>N'acceptez la connexion que si votre client vous montre les mêmes !
<br>
<?php
} else {
exit("Wrong value for sftp_enabled");

View file

@ -10,34 +10,6 @@ function addNiverLog($message, $outputLines) {
file_put_contents(ROOT_PATH . "/niver.log", $logs, FILE_APPEND);
}
function sftpStatus($username) {
$db = new PDO('sqlite:' . DB_PATH);
$usernameArr[0] = $username;
$op = $db->prepare('SELECT sftp_enabled FROM users WHERE username = ?');
$op->execute($usernameArr);
$status = $op->fetch()['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);
$op = $db->prepare("UPDATE users SET sftp_enabled = 1 WHERE username = :username");
$op->bindParam(':username', $username);
$op->execute();
}
function listUserZones($username) {
$db = new PDO('sqlite:' . DB_PATH);
$usernameArray[0] = $username;
@ -58,20 +30,8 @@ function listUserZones($username) {
return $zones;
}
function checkAbsoluteDomainFormat($domain) {
// If the domain must end with a dot
if (!filter_var($domain, FILTER_VALIDATE_DOMAIN) OR !preg_match("/^([a-z]{1,63}\.){2,127}$/", $domain))
exit("Erreur : ce domaine n'est pas valide !");
}
function checkDomainFormat($domain) {
// If the domain must end without a dot
if (!filter_var($domain, FILTER_VALIDATE_DOMAIN) OR !preg_match("/^([a-z]{1,63}\.){1,126}[a-z]{1,63}$/", $domain))
exit("Erreur : ce domaine n'est pas valide !");
}
function nsCheckZonePossession($zone) {
checkDomainValidity($zone);
checkAbsoluteDomainFormat($zone);
$db = new PDO('sqlite:' . DB_PATH);
$username[0] = $_SESSION['username'];
@ -94,8 +54,8 @@ function nsCheckZonePossession($zone) {
}
function nicCheckDomainPossession($submittedDomain) {
checkDomainValidity($submittedDomain);
function nicCheckDomainPossession($domain) {
checkAbsoluteDomainFormat($domain);
$db = new PDO('sqlite:' . DB_PATH);
$username[0] = $_SESSION['username'];
@ -107,14 +67,14 @@ function nicCheckDomainPossession($submittedDomain) {
$owned = false;
while ($dbDomain != NULL) {
if ($dbDomain == $submittedDomain) {
if ($dbDomain == $domain) {
$owned = true;
break;
}
$dbDomain = $op->fetch()['domain'];
}
if (!$owned)
if (!($owned === true))
exit("Erreur : Vous ne possédez pas ce domaine sur le registre !");
}
@ -148,11 +108,3 @@ function userExist($username) {
return false;
}
}
function checkPasswordFormat($password) {
return preg_match("/" . PASSWORD_REGEX . "/", $password);
}
function checkUsernameFormat($username) {
return preg_match("/" . USERNAME_REGEX . "/", $username);
}

32
inc/format.inc.php Normal file
View file

@ -0,0 +1,32 @@
<?php
if (strpos($_SERVER['PHP_SELF'], "inc.php") !== false)
exit("This file is meant to be included.");
function checkIpFormat($ip) {
if (!filter_var($ip, FILTER_VALIDATE_IP))
exit("Erreur : l'adresse IP n'est pas valide");
if (!filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE))
exit("Erreur : l'adresse IP est dans une plage privée");
if (!filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE))
exit("Erreur : l'adresse IP est dans une plage réservée");
}
function checkAbsoluteDomainFormat($domain) {
// If the domain must end with a dot
if (!filter_var($domain, FILTER_VALIDATE_DOMAIN) OR !preg_match("/^([a-z0-9]{1,63}\.){2,127}$/", $domain))
exit("Erreur : ce domaine n'est pas valide !");
}
function checkDomainFormat($domain) {
// If the domain must end without a dot
if (!filter_var($domain, FILTER_VALIDATE_DOMAIN) OR !preg_match("/^([a-z0-9]{1,63}\.){1,126}[a-z0-9]{1,63}$/", $domain))
exit("Erreur : ce domaine n'est pas valide !");
}
function checkPasswordFormat($password) {
return preg_match("/" . PASSWORD_REGEX . "/", $password);
}
function checkUsernameFormat($username) {
return preg_match("/" . USERNAME_REGEX . "/", $username);
}

View file

@ -52,3 +52,32 @@ function listDbDirs($username, $domainType, $protocol) {
else
return false;
}
function sftpStatus($username) {
$db = new PDO('sqlite:' . DB_PATH);
$usernameArr[0] = $username;
$op = $db->prepare('SELECT sftp_enabled FROM users WHERE username = ?');
$op->execute($usernameArr);
$status = $op->fetch()['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);
$op = $db->prepare("UPDATE users SET sftp_enabled = 1 WHERE username = :username");
$op->bindParam(':username', $username);
$op->execute();
}

124
inc/reg.inc.php Normal file
View file

@ -0,0 +1,124 @@
<?php
if (strpos($_SERVER['PHP_SELF'], "inc.php") !== false)
exit("This file is meant to be included.");
function isFree($domain) {
$domainArray[0] = $domain;
$db = new PDO('sqlite:' . DB_PATH);
$req = $db->prepare('SELECT domain FROM registry WHERE domain = ?');
$req->execute($domainArray);
$domainFound = $req->fetch()['domain'];
if (isset($domainFound)) {
return false;
} else {
return true;
}
}
$suffixes = array(
"atope.art.",
"asso.atope.art.",
"org.atope.art.",
"perso.atope.art.",
"blog.atope.art.",
"me.atope.art.",
"edu.atope.art.",
"info.atope.art.",
"wiki.atope.art.",
"sci.atope.art.",
"pol.atope.art.",
"libre.atope.art.",
"fem.atope.art.",
"eco.atope.art.",
"veg.atope.art.",
"bio.atope.art.",
"anar.atope.art.",
"ancom.atope.art.",
"acab.atope.art.",
"handi.atope.art.",
"queer.atope.art.",
"gay.atope.art.",
"enby.atope.art.",
"trans.atope.art.",
"net.atope.art.",
"tech.atope.art.",
"io.atope.art.",
"sec.atope.art.",
"cyber.atope.art.",
"dev.atope.art.",
"geek.atope.art.",
"fs.atope.art.",
"ht.atope.art.",
"hyper.atope.art.",
"git.atope.art.",
"forge.atope.art.",
"code.atope.art.",
"lab.atope.art.",
"labs.atope.art.",
"gemini.atope.art.",
"gmi.atope.art.",
"gemlog.atope.art.",
"mail.atope.art.",
"ynh.atope.art.",
"yuno.atope.art.",
"sys.atope.art.",
"fed.atope.art.",
"fedi.atope.art.",
"soc.atope.art.",
"masto.atope.art.",
"plero.atope.art.",
"pix.atope.art.",
"mobi.atope.art.",
"art.atope.art.",
"music.atope.art.",
"video.atope.art.",
"draw.atope.art.",
"audio.atope.art.",
"ink.atope.art.",
"na.atope.art.",
"psy.atope.art.",
"neuro.atope.art.",
"auti.atope.art.",
"plur.atope.art.",
"blue.atope.art.",
"red.atope.art.",
"pink.atope.art.",
"green.atope.art.",
"black.atope.art.",
"city.atope.art.",
"town.atope.art.",
"cafe.atope.art.",
"home.atope.art.",
"forum.atope.art.",
"dream.atope.art.",
"space.atope.art.",
"forest.atope.art.",
"rain.atope.art.",
"snow.atope.art.",
"sun.atope.art.",
"earth.atope.art.",
"world.atope.art.",
"soft.atope.art.",
"cute.atope.art.",
"cutie.atope.art.",
"fun.atope.art.",
"play.atope.art.",
"game.atope.art.",
);

View file

@ -1,122 +1,115 @@
<?php include "../top.inc.php"; ?>
<form method="post">
<label for="zone">Domaine</label>
<br>
<select required="" name="zone" id="zone">
<option value="" disabled="" selected="">---</option>
<?php
$db = new PDO('sqlite:' . $dbPath);
$username[0] = $_SESSION['username'];
var_dump($username);
$req = $db->prepare('SELECT zone FROM zones WHERE username = ?');
$req->execute($username);
$domain = $req->fetch()['zone'];
while ($domain != NULL) {
echo "<option value='" . $domain . "'>" . $domain . "</option>";
$domain = $req->fetch()['zone'];
}
?>
</select>
<br>
<label for="keytag">Tag de la clé</label>
<br>
<input required="" id="keytag" placeholder="32768" min="1" max="65535" name="keytag" type="number"><span></span>
<br>
<label for="algo">Algorithme</label>
<br>
<select required="" name="algo" id="algo">
<!-- RFC 8624 : Algorithm Implementation Requirements and Usage Guidance for DNSSEC > Algorithm Selection > DNSKEY Algorithms -->
<!-- https://tools.ietf.org/html/rfc8624.html#section-3.1 -->
<option value="1" disabled="">1 (RSAMD5)</option>
<option value="3" disabled="">3 (DSA)</option>
<option value="5" disabled="">5 (RSASHA1)</option>
<option value="6" disabled="">6 (DSA-NSEC3-SHA1)</option>
<option value="7" disabled="">7 (RSASHA1-NSEC3-SHA1)</option>
<option value="8">8 (RSASHA256)</option>
<option value="10" disabled="">10 (RSASHA512)</option>
<option value="12" disabled="">12 (ECC-GOST)</option>
<option value="13" selected="">13 (ECDSAP256SHA256)</option>
<option value="14">14 (ECDSAP384SHA384)</option>
<option value="15">15 (ED25519)</option>
<option value="16">16 (ED448)</option>
</select>
<br>
<label for="dt">Digest Type</label>
<br>
<select required="" name="dt" id="dt">
<!-- RFC 8624 : Algorithm Implementation Requirements and Usage Guidance for DNSSEC > Algorithm Selection > DS and CDS Algorithms -->
<!-- https://tools.ietf.org/html/rfc8624.html#section-3.3 -->
<option value="1" disabled="">1 (SHA-1)</option>
<option value="2" selected="">2 (SHA-256)</option>
<option value="3" disabled="">3 (GOST R 34.11-94)</option>
<option value="4">4 (SHA-384)</option>
</select>
<br>
<label for="key">Delegation Signer</label>
<br>
<input id="key" required="" name="key" type="text" placeholder="018F25E4A022463478C9E30136EC53771A1704A0F0B3CE5B883AC9C8A6A55D16B638B4DE70662ACA5295D3669E7CADD9">
<br>
<input value="Valider" type="submit">
</form>
<form method="post">
<label for="zone">Domaine</label>
<br>
<select required="" name="zone" id="zone">
<option value="" disabled="" selected="">---</option>
<?php
$db = new PDO('sqlite:' . $dbPath);
$username[0] = $_SESSION['username'];
if (isset($_POST['zone']) AND isset($_POST['keytag']) AND isset($_POST['algo']) AND isset($_POST['key']) AND isset($_SESSION['username'])) {
var_dump($username);
if ($_POST['algo'] == "8"
OR $_POST['algo'] == "13"
OR $_POST['algo'] == "14"
OR $_POST['algo'] == "15"
OR $_POST['algo'] == "16"
) {
$req = $db->prepare('SELECT zone FROM zones WHERE username = ?');
$req->execute($username);
if (filter_var($_POST['keytag'], FILTER_VALIDATE_INT) AND $_POST['keytag'] >= 1 AND $_POST['keytag'] <= 65535) {
if ($_POST['dt'] == "2" OR $_POST['dt'] == "4") {
checkDomainValidity($_POST['zone']);
nsCheckZonePossession($_POST['zone']);
nicCheckDomainPossession($_POST['zone']);
$domain = $req->fetch()['zone'];
exec("knotc zone-begin atope.art");
exec("knotc zone-set atope.art " . $_POST['zone'] . " 3600 DS " . $_POST['keytag'] . " " . $_POST['algo'] . " " . $_POST['dt'] . " " . $_POST['key']);
exec("knotc zone-commit atope.art");
//secure.example. DS tag=12345 alg=3 digest_type=1 <foofoo>
echo "La requête a été envoyée à Knot";
} else {
exit("Incorrect value for dt");
}
} else {
exit("Incorrect value for keytag");
}
} else {
exit("Incorrect value for algo");
}
/*
moomin3.atope.art. 0 DS 11168 13 1 D39D6B1ED58ECE9FA8AB6B7DB53E78338D45E2FF
moomin3.atope.art. 0 DS 11168 13 2 DB7C3B76CF40C1F7C0BF278AB46284BFEA5E7D44B382992E32BB5B3DC50BA7AB
moomin3.atope.art. 0 DS 11168 13 4 018F25E4A022463478C9E30136EC53771A1704A0F0B3CE5B883AC9C8A6A55D16B638B4DE70662ACA5295D3669E7CADD9
from rfc : secure.example. DS tag=12345 alg=3 digest_type=1 <foofoo>
*/
//exec("knotc zone-begin atope.art");
//exec("knotc zone-set atope.art " . $_POST['subdomain'] . ".atope.art. DS " . $_POST['ns'] . ".");
//exec("knotc zone-commit atope.art");
//echo "Modifications appliquées";
} else {
echo "Rien n'a été appliqué lors du dernier chargement.";
while ($domain != NULL) {
echo "<option value='" . $domain . "'>" . $domain . "</option>";
$domain = $req->fetch()['zone'];
}
?>
?>
</select>
<br>
<label for="keytag">Tag de la clé</label>
<br>
<input required="" id="keytag" placeholder="32768" min="1" max="65535" name="keytag" type="number"><span></span>
<br>
<label for="algo">Algorithme</label>
<br>
<select required="" name="algo" id="algo">
<!-- RFC 8624 : Algorithm Implementation Requirements and Usage Guidance for DNSSEC > Algorithm Selection > DNSKEY Algorithms -->
<!-- https://tools.ietf.org/html/rfc8624.html#section-3.1 -->
<option value="1" disabled="">1 (RSAMD5)</option>
<option value="3" disabled="">3 (DSA)</option>
<option value="5" disabled="">5 (RSASHA1)</option>
<option value="6" disabled="">6 (DSA-NSEC3-SHA1)</option>
<option value="7" disabled="">7 (RSASHA1-NSEC3-SHA1)</option>
<option value="8">8 (RSASHA256)</option>
<option value="10" disabled="">10 (RSASHA512)</option>
<option value="12" disabled="">12 (ECC-GOST)</option>
<option value="13" selected="">13 (ECDSAP256SHA256)</option>
<option value="14">14 (ECDSAP384SHA384)</option>
<option value="15">15 (ED25519)</option>
<option value="16">16 (ED448)</option>
</select>
<br>
<label for="dt">Digest Type</label>
<br>
<select required="" name="dt" id="dt">
<!-- RFC 8624 : Algorithm Implementation Requirements and Usage Guidance for DNSSEC > Algorithm Selection > DS and CDS Algorithms -->
<!-- https://tools.ietf.org/html/rfc8624.html#section-3.3 -->
<option value="1" disabled="">1 (SHA-1)</option>
<option value="2" selected="">2 (SHA-256)</option>
<option value="3" disabled="">3 (GOST R 34.11-94)</option>
<option value="4">4 (SHA-384)</option>
</select>
<br>
<label for="key">Delegation Signer</label>
<br>
<input id="key" required="" name="key" type="text" placeholder="018F25E4A022463478C9E30136EC53771A1704A0F0B3CE5B883AC9C8A6A55D16B638B4DE70662ACA5295D3669E7CADD9">
<br>
<input value="Valider" type="submit">
</form>
<?php
if (isset($_POST['zone']) AND isset($_POST['keytag']) AND isset($_POST['algo']) AND isset($_POST['key']) AND isset($_SESSION['username'])) {
if (!($_POST['algo'] == "8")
AND !($_POST['algo'] == "13")
AND !($_POST['algo'] == "14")
AND !($_POST['algo'] == "15")
AND !($_POST['algo'] == "16")
)
exit("Incorrect value for algo");
$_POST['keytag'] = intval($_POST['keytag']);
if ((!preg_match("/^[0-9]{1,6}$/", $_POST['keytag'])) OR !($_POST['keytag'] >= 1) OR !($_POST['keytag'] <= 65535))
exit("Incorrect value for keytag");
if (!$_POST['dt'] == "2" AND !$_POST['dt'] == "4")
exit("Incorrect value for dt");
checkAbsoluteDomainFormat($_POST['zone']);
nsCheckZonePossession($_POST['zone']);
nicCheckDomainPossession($_POST['zone']);
exec("knotc zone-begin atope.art");
exec("knotc zone-set atope.art " . $_POST['zone'] . " 3600 DS " . $_POST['keytag'] . " " . $_POST['algo'] . " " . $_POST['dt'] . " " . $_POST['key']);
exec("knotc zone-commit atope.art");
//secure.example. DS tag=12345 alg=3 digest_type=1 <foofoo>
echo "La requête a été envoyée à Knot";
/*
moomin3.atope.art. 0 DS 11168 13 1 D39D6B1ED58ECE9FA8AB6B7DB53E78338D45E2FF
moomin3.atope.art. 0 DS 11168 13 2 DB7C3B76CF40C1F7C0BF278AB46284BFEA5E7D44B382992E32BB5B3DC50BA7AB
moomin3.atope.art. 0 DS 11168 13 4 018F25E4A022463478C9E30136EC53771A1704A0F0B3CE5B883AC9C8A6A55D16B638B4DE70662ACA5295D3669E7CADD9
from rfc : secure.example. DS tag=12345 alg=3 digest_type=1 <foofoo>
*/
//exec("knotc zone-begin atope.art");
//exec("knotc zone-set atope.art " . $_POST['subdomain'] . ".atope.art. DS " . $_POST['ns'] . ".");
//exec("knotc zone-commit atope.art");
//echo "Modifications appliquées";
}
?>
<?php include "../bottom.inc.php"; ?>

View file

@ -1,36 +1,49 @@
<?php require "../top.inc.php"; ?>
<form method="POST" action="glue.php">
<form method="post">
<label for="action">Action</label>
<select name="action" id="action">
<option value="add">Ajouter</option>
<option value="delete">Retirer</option>
</select>
<br>
<label for="ns">Serveur de nom</label><br>
<input required="" id="ns" placeholder="ns1.atope.art." name="ns" type="text">
<br>
<label for="ip">IP</label><br>
<input required="" pattern="^[a-f0-9:.]+$" id="ip" name="ip" minlength="7" maxlength="39" size="40" type="text" placeholder="2a0b:cbc0:1103:2::106f ou 45.13.104.169">
<br>
<input value="Valider" type="submit">
</form>
<br>
<label for="ns">Serveur de nom</label>
<br>
<input id="ns" placeholder="ns1.atope.art" name="ns" type="text">
<br>
<label for="ipv4">IPv4</label>
<br>
<input id="ipv4" placeholder="127.0.0.1" name="ipv4" type="text">
<br>
<label for="ipv6">IPv6</label>
<br>
<input id="ipv6" placeholder="::1" name="ipv6" type="text">
<br>
<input value="Valider" type="submit">
</form>
<?php
<?php
if (isset($_POST['action']) AND isset($_POST['ns']) AND isset($_POST['ip'])) {
if (isset($_POST['ipv4']) AND isset($_POST['ns'])) {
exec("knotc zone-begin atope.art");
exec("knotc zone-set atope.art " . $_POST['ns'] . ". 200 IN A " . $_POST['ipv4']);
//exec("knotc zone-set atope.art " . $_POST['ns'] . ". 200 IN AAAA " . $_POST['ipv6'] . ".");
exec("knotc zone-commit atope.art");
echo "Modifications appliquées";
} else {
echo "Rien n'a été appliqué lors du dernier chargement.";
}
checkAbsoluteDomainFormat($_POST['ns']);
checkIpFormat($_POST['ip']);
?>
if (filter_var($_POST['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4))
$record = "A";
else if (filter_var($_POST['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6))
$record = "AAAA";
else
exit("Unknown error about IP format");
if ($_POST['action'] == "delete")
$action = "un";
else if ($_POST['action'] == "add")
$action = "";
else
exit("ERROR : Wrong value for action");
exec(KNOTC_PATH . " zone-begin " . $suffix);
exec(KNOTC_PATH . " zone-" . $action . "set " . $suffix . " " . $_POST['ns'] . " 86400 " . $record . " " . $_POST['ip']);
exec(KNOTC_PATH . " zone-commit " . $suffix);
echo "Glue record ajouté";
}
?>
<?php require "../bottom.inc.php"; ?>

View file

@ -1,6 +1,6 @@
<?php include "../top.inc.php"; ?>
<h2><a class="nicButton" href="register">Enregitrer un nouveau nom de domaine</a></h2>
<h2><a class="nicButton" href="register">Enregistrer un nouveau nom de domaine</a></h2>
Prendre possession d'un sous-domaine d'atope.art
<br>
<h2><a class="nicButton" href="ns">NS (Name Server)</a></h2>

View file

@ -1,64 +1,63 @@
<?php include "../top.inc.php"; ?>
<form method="post">
<label for="action">Action</label>
<select name="action" id="action">
<option value="add">Ajouter</option>
<option value="delete">Retirer</option>
</select>
<br>
<label for="domain">Domaine</label>
<br>
<select required="" name="domain" id="domain">
<option value="" disabled="" selected="">---</option>
<?php
$db = new PDO('sqlite:' . DB_PATH);
$username[0] = $_SESSION['username'];
$req = $db->prepare('SELECT domain FROM registry WHERE username = ?');
$req->execute($username);
$domain = $req->fetch()['domain'];
while ($domain != NULL) {
echo "<option value='" . $domain . "'>" . $domain . "</option>";
$domain = $req->fetch()['domain'];
}
?>
</select>
<br>
<label for="ns">Serveur de nom</label>
<br>
<input id="ns" placeholder="ns1.atope.art." name="ns" type="text">
<br>
<input value="Valider" type="submit">
</form>
<form method="post">
<label for="action">Action</label>
<select name="action" id="action">
<option value="add">Ajouter</option>
<option value="delete">Retirer</option>
</select>
<br>
<label for="domain">Domaine</label>
<br>
<select required="" name="domain" id="domain">
<option value="" disabled="" selected="">---</option>
<?php
$db = new PDO('sqlite:' . DB_PATH);
$username[0] = $_SESSION['username'];
if (isset($_POST['domain']) AND isset($_POST['action']) AND isset($_POST['ns']) AND isset($_SESSION['username'])) {
$req = $db->prepare('SELECT domain FROM registry WHERE username = ?');
$req->execute($username);
nicCheckDomainPossession($_POST['domain']);
checkDomainValidity($_POST['ns']);
$domain = $req->fetch()['domain'];
if ($_POST['action'] == "delete")
$action = "un";
else if ($_POST['action'] == "add")
$action = "";
else
exit("Erreur : valeur invalide pour action");
exec("knotc zone-begin atope.art");
exec("knotc zone-" . $action . "set atope.art " . $_POST['domain'] . " 3600 IN NS " . $_POST['ns']);
exec("knotc zone-commit atope.art");
echo "Modifications appliquées";
} else {
echo "Rien n'a été appliqué lors du dernier chargement.";
while ($domain != NULL) {
echo "<option value='" . $domain . "'>" . $domain . "</option>";
$domain = $req->fetch()['domain'];
}
?>
</select>
<br>
<label for="ns">Serveur de nom</label>
<br>
<input id="ns" placeholder="ns1.atope.art." name="ns" type="text">
<br>
<input value="Valider" type="submit">
</form>
<?php
if (isset($_POST['domain']) AND isset($_POST['action']) AND isset($_POST['ns']) AND isset($_SESSION['username'])) {
nicCheckDomainPossession($_POST['domain']);
checkAbsoluteDomainFormat($_POST['ns']);
if ($_POST['action'] == "delete")
$action = "un";
else if ($_POST['action'] == "add")
$action = "";
else
exit("Erreur : valeur invalide pour action");
exec("knotc zone-begin atope.art");
exec("knotc zone-" . $action . "set atope.art " . $_POST['domain'] . " 3600 IN NS " . $_POST['ns']);
exec("knotc zone-commit atope.art");
echo "Modifications appliquées";
} else {
echo "Rien n'a été appliqué lors du dernier chargement.";
}
?>
<?php include "../bottom.inc.php"; ?>

View file

@ -1,178 +1,167 @@
<?php include "../top.inc.php"; ?>
Enregistrer la possession d'un domaine sur son compte
Enregistrer la possession d'un domaine sur son compte<br>
Doit être composé uniquement de lettres latines non accentuées, au moins 4
<br>
<br>
<form method="post">
<input id="subdomain" pattern="<?= SUBDOMAIN_REGEX ?>" required="" placeholder="niver" name="subdomain" type="text">
.
<select required="" id="label" name="suffix">
<option selected="" value="atope.art.">atope.art.</option>
<optgroup label="Organisations">
<option value="asso.atope.art.">asso.atope.art.</option>
<option value="org.atope.art.">org.atope.art.</option>
</optgroup>
<optgroup label="Personnels">
<option value="perso.atope.art.">perso.atope.art.</option>
<option value="blog.atope.art.">blog.atope.art.</option>
<option value="me.atope.art.">me.atope.art.</option>
</optgroup>
<optgroup label="Connaissance">
<option value="edu.atope.art.">edu.atope.art.</option>
<option value="info.atope.art.">info.atope.art.</option>
<option value="wiki.atope.art.">wiki.atope.art.</option>
<option value="sci.atope.art.">sci.atope.art.</option>
</optgroup>
<optgroup label="Politique">
<option value="pol.atope.art.">pol.atope.art.</option>
<option value="libre.atope.art.">libre.atope.art.</option>
<option value="fem.atope.art.">fem.atope.art.</option>
<option value="eco.atope.art.">eco.atope.art.</option>
<option value="veg.atope.art.">veg.atope.art.</option>
<option value="bio.atope.art.">bio.atope.art.</option>
<option value="anar.atope.art.">anar.atope.art.</option>
<option value="ancom.atope.art.">ancom.atope.art.</option>
<option value="acab.atope.art.">acab.atope.art.</option>
<option value="handi.atope.art.">handi.atope.art.</option>
</optgroup>
<optgroup label="LGBT+">
<option value="queer.atope.art.">queer.atope.art.</option>
<option value="gay.atope.art.">gay.atope.art.</option>
<option value="enby.atope.art.">enby.atope.art.</option>
<option value="trans.atope.art.">trans.atope.art.</option>
</optgroup>
<optgroup label="Technologie">
<option value="net.atope.art.">net.atope.art.</option>
<option value="tech.atope.art.">tech.atope.art.</option>
<option value="io.atope.art.">io.atope.art.</option>
<option value="sec.atope.art.">sec.atope.art.</option>
<option value="cyber.atope.art.">cyber.atope.art.</option>
<option value="dev.atope.art.">dev.atope.art.</option>
<option value="geek.atope.art.">geek.atope.art.</option>
<option value="fs.atope.art.">fs.atope.art.</option>
<option value="ht.atope.art.">ht.atope.art.</option>
<option value="hyper.atope.art.">hyper.atope.art.</option>
<option value="git.atope.art.">git.atope.art.</option>
<option value="forge.atope.art.">forge.atope.art.</option>
<option value="code.atope.art.">code.atope.art.</option>
<option value="lab.atope.art.">lab.atope.art.</option>
<option value="labs.atope.art.">labs.atope.art.</option>
<option value="gemini.atope.art.">gemini.atope.art.</option>
<option value="gmi.atope.art.">gmi.atope.art.</option>
<option value="gemlog.atope.art.">gemlog.atope.art.</option>
<option value="mail.atope.art.">mail.atope.art.</option>
<option value="ynh.atope.art.">ynh.atope.art.</option>
<option value="yuno.atope.art.">yuno.atope.art.</option>
<option value="sys.atope.art.">sys.atope.art.</option>
</optgroup>
<optgroup label="Fédiverse">
<option value="fed.atope.art.">fed.atope.art.</option>
<option value="fedi.atope.art.">fedi.atope.art.</option>
<option value="soc.atope.art.">soc.atope.art.</option>
<option value="masto.atope.art.">masto.atope.art.</option>
<option value="plero.atope.art.">plero.atope.art.</option>
<option value="pix.atope.art.">pix.atope.art.</option>
<option value="mobi.atope.art.">mobi.atope.art.</option>
</optgroup>
<optgroup label="Arts">
<option value="art.atope.art.">art.atope.art.</option>
<option value="music.atope.art.">music.atope.art.</option>
<option value="video.atope.art.">video.atope.art.</option>
<option value="draw.atope.art.">draw.atope.art.</option>
<option value="audio.atope.art.">audio.atope.art.</option>
<option value="ink.atope.art.">ink.atope.art.</option>
</optgroup>
<optgroup label="Neurodiversité">
<option value="na.atope.art.">na.atope.art.</option>
<option value="psy.atope.art.">psy.atope.art.</option>
<option value="neuro.atope.art.">neuro.atope.art.</option>
<option value="auti.atope.art.">auti.atope.art.</option>
<option value="plur.atope.art.">plur.atope.art.</option>
</optgroup>
<optgroup label="Couleurs">
<option value="blue.atope.art.">blue.atope.art.</option>
<option value="red.atope.art.">red.atope.art.</option>
<option value="pink.atope.art.">pink.atope.art.</option>
<option value="green.atope.art.">green.atope.art.</option>
<option value="black.atope.art.">black.atope.art.</option>
</optgroup>
<optgroup label="Communauté">
<option value="city.atope.art.">city.atope.art.</option>
<option value="town.atope.art.">town.atope.art.</option>
<option value="cafe.atope.art.">cafe.atope.art.</option>
<option value="home.atope.art.">home.atope.art.</option>
<option value="forum.atope.art.">forum.atope.art.</option>
</optgroup>
<optgroup label="Divers">
<option value="dream.atope.art.">dream.atope.art.</option>
<option value="space.atope.art.">space.atope.art.</option>
<option value="forest.atope.art.">forest.atope.art.</option>
<option value="rain.atope.art.">rain.atope.art.</option>
<option value="snow.atope.art.">snow.atope.art.</option>
<option value="sun.atope.art.">sun.atope.art.</option>
<option value="earth.atope.art.">earth.atope.art.</option>
<option value="world.atope.art.">world.atope.art.</option>
<option value="soft.atope.art.">soft.atope.art.</option>
<option value="cute.atope.art.">cute.atope.art.</option>
<option value="cutie.atope.art.">cutie.atope.art.</option>
<option value="fun.atope.art.">fun.atope.art.</option>
<option value="play.atope.art.">play.atope.art.</option>
<option value="game.atope.art.">game.atope.art.</option>
</optgroup>
<form method="post">
<label for="subdomain">Domaine</label>
<br>
<input id="subdomain" pattern="[a-z]{4,63}" required="" placeholder="nic" name="subdomain" type="text">.atope.art.
<!--
<select required="" name="suffix">
<option selected="" value=".atope.art.">.atope.art.</option>
</select>
<optgroup label="Organisations">
<option value=".asso.atope.art.">.asso.atope.art.</option>
<option value=".org.atope.art.">.org.atope.art.</option>
</optgroup>
<optgroup label="Personnels">
<option value=".perso.atope.art.">.perso.atope.art.</option>
<option value=".blog.atope.art.">.blog.atope.art.</option>
<option value=".gemlog.atope.art.">.gemlog.atope.art.</option>
<option value=".me.atope.art.">.me.atope.art.</option>
</optgroup>
<optgroup label="Connaissance">
<option value=".edu.atope.art.">.edu.atope.art.</option>
<option value=".info.atope.art.">.info.atope.art.</option>
<option value=".wiki.atope.art.">.wiki.atope.art.</option>
<option value=".sci.atope.art.">.sci.atope.art.</option>
</optgroup>
<optgroup label="Politique">
<option value=".pol.atope.art.">.pol.atope.art.</option>
<option value=".libre.atope.art.">.libre.atope.art.</option>
<option value=".fem.atope.art.">.fem.atope.art.</option>
<option value=".eco.atope.art.">.eco.atope.art.</option>
<option value=".veg.atope.art.">.veg.atope.art.</option>
<option value=".bio.atope.art.">.bio.atope.art.</option>
<option value=".anar.atope.art.">.anar.atope.art.</option>
<option value=".ancom.atope.art.">.ancom.atope.art.</option>
<option value=".acab.atope.art.">.acab.atope.art.</option>
<option value=".handi.atope.art.">.handi.atope.art.</option>
</optgroup>
<optgroup label="LGBT+">
<option value=".queer.atope.art.">.queer.atope.art.</option>
<option value=".gay.atope.art.">.gay.atope.art.</option>
<option value=".enby.atope.art.">.enby.atope.art.</option>
<option value=".trans.atope.art.">.trans.atope.art.</option>
</optgroup>
<optgroup label="Technologie">
<option value=".net.atope.art.">.net.atope.art.</option>
<option value=".tech.atope.art.">.tech.atope.art.</option>
<option value=".io.atope.art.">.io.atope.art.</option>
<option value=".sec.atope.art.">.sec.atope.art.</option>
<option value=".cyber.atope.art.">.cyber.atope.art.</option>
<option value=".dev.atope.art.">.dev.atope.art.</option>
<option value=".geek.atope.art.">.geek.atope.art.</option>
<option value=".fs.atope.art.">.fs.atope.art.</option>
<option value=".ht.atope.art.">.ht.atope.art.</option>
<option value=".hyper.atope.art.">.hyper.atope.art.</option>
<option value=".git.atope.art.">.git.atope.art.</option>
<option value=".forge.atope.art.">.forge.atope.art.</option>
<option value=".code.atope.art.">.code.atope.art.</option>
<option value=".lab.atope.art.">.lab.atope.art.</option>
<option value=".labs.atope.art.">.labs.atope.art.</option>
<option value=".gemini.atope.art.">.gemini.atope.art.</option>
<option value=".gmi.atope.art.">.gmi.atope.art.</option>
<option value=".mail.atope.art.">.mail.atope.art.</option>
<option value=".ynh.atope.art.">.ynh.atope.art.</option>
<option value=".yuno.atope.art.">.yuno.atope.art.</option>
</optgroup>
<optgroup label="Fédiverse">
<option value=".fed.atope.art.">.fed.atope.art.</option>
<option value=".fedi.atope.art.">.fedi.atope.art.</option>
<option value=".soc.atope.art.">.soc.atope.art.</option>
<option value=".masto.atope.art.">.masto.atope.art.</option>
<option value=".plero.atope.art.">.plero.atope.art.</option>
<option value=".pix.atope.art.">.pix.atope.art.</option>
<option value=".mobi.atope.art.">.mobi.atope.art.</option>
</optgroup>
<optgroup label="Arts">
<option value=".art.atope.art.">.art.atope.art.</option>
<option value=".music.atope.art.">.music.atope.art.</option>
<option value=".video.atope.art.">.video.atope.art.</option>
<option value=".draw.atope.art.">.draw.atope.art.</option>
<option value=".audio.atope.art.">.audio.atope.art.</option>
<option value=".ink.atope.art.">.ink.atope.art.</option>
</optgroup>
<optgroup label="Neurodiversité">
<option value=".na.atope.art.">.na.atope.art.</option>
<option value=".psy.atope.art.">.psy.atope.art.</option>
<option value=".neuro.atope.art.">.neuro.atope.art.</option>
<option value=".autism.atope.art.">.autism.atope.art.</option>
<option value=".plural.atope.art.">.plural.atope.art.</option>
</optgroup>
<optgroup label="Couleurs">
<option value=".blue.atope.art.">.blue.atope.art.</option>
<option value=".red.atope.art.">.red.atope.art.</option>
<option value=".pink.atope.art.">.pink.atope.art.</option>
<option value=".green.atope.art.">.green.atope.art.</option>
<option value=".black.atope.art.">.black.atope.art.</option>
</optgroup>
<optgroup label="Communauté">
<option value=".city.atope.art.">.city.atope.art.</option>
<option value=".town.atope.art.">.town.atope.art.</option>
<option value=".cafe.atope.art.">.cafe.atope.art.</option>
<option value=".home.atope.art.">.home.atope.art.</option>
<option value=".forum.atope.art.">.forum.atope.art.</option>
</optgroup>
<optgroup label="Divers">
<option value=".dream.atope.art.">.dream.atope.art.</option>
<option value=".space.atope.art.">.space.atope.art.</option>
<option value=".forest.atope.art.">.forest.atope.art.</option>
<option value=".rain.atope.art.">.rain.atope.art.</option>
<option value=".snow.atope.art.">.snow.atope.art.</option>
<option value=".sun.atope.art.">.sun.atope.art.</option>
<option value=".earth.atope.art.">.earth.atope.art.</option>
<option value=".world.atope.art.">.world.atope.art.</option>
<option value=".soft.atope.art.">.soft.atope.art.</option>
<option value=".cute.atope.art.">.cute.atope.art.</option>
<option value=".cutie.atope.art.">.cutie.atope.art.</option>
<option value=".fun.atope.art.">.fun.atope.art.</option>
<option value=".play.atope.art.">.play.atope.art.</option>
<option value=".game.atope.art.">.game.atope.art.</option>
</optgroup>
<br>
<input value="Valider" type="submit">
</form>
</select>
<?php
-->
<br>
<input value="Valider" type="submit">
</form>
if (isset($_POST['subdomain']) AND isset($_SESSION['username'])) {
if (preg_match("/" . SUBDOMAIN_REGEX . "/", $_POST['subdomain'])) {
<?php
if (!in_array($_POST['suffix'], $suffixes))
exit("Wrong value for suffix");
if (isset($_POST['subdomain']) AND isset($_SESSION['username'])) {
if (preg_match("#[a-z]{4,63}#", $_POST['subdomain'])) {
$domain = $_POST['subdomain'] . ".atope.art.";
if (filter_var($domain, FILTER_VALIDATE_DOMAIN)) {
$domain = $_POST['subdomain'] . "." . $_POST['suffix'];
$domainArray[0] = $domain;
checkAbsoluteDomainFormat($domain);
$db = new PDO('sqlite:' . $dbPath);
if (isFree($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'];
$req = $db->prepare('SELECT domain FROM registry WHERE domain = ?');
$req->execute($domainArray);
$time = date("Y-m-d H:i:s");
$domainFound = $req->fetch()['domain'];
$stmt->bindParam(':domain', $domain);
$stmt->bindParam(':username', $username);
$stmt->bindParam(':last_renewal', $time);
if (isset($domainFound)) {
echo "Le domaine " . $domainFound . " est déjà utilisé.";
} else {
$db = new PDO('sqlite:' . $dbPath);
$stmt = $db->prepare("INSERT INTO registry(domain, username, last_renewal) VALUES(:domain, :username, :last_renewal)");
$username = $_SESSION['username'];
$stmt->execute();
$time = time();
$stmt->bindParam(':domain', $domain);
$stmt->bindParam(':username', $username);
$stmt->bindParam(':last_renewal', $time);
$stmt->execute();
echo "Nouveau domaine enregistré";
}
} else {
echo "Erreur : Nom de domaine invalide";
}
} else {
echo "Erreur : Le nom de domaine doit être composé d'entre 4 et 63 lettres minuscules (a-z)";
}
echo "Nouveau domaine enregistré";
} else {
echo "Rien n'a été appliqué lors du dernier chargement.";
echo "Le domaine " . $domain . " est déjà utilisé.";
}
} else {
echo "Erreur : Le nom de domaine doit être composé d'entre 4 et 63 lettres minuscules (a-z)";
}
}
?>
?>
<?php include "../bottom.inc.php"; ?>

View file

@ -1,44 +1,41 @@
<?php require "../top.inc.php"; ?>
<form method="post">
<select required="" name="zone" id="zone">
<option value="" disabled="" selected="">---</option>
<?php
$db = new PDO('sqlite:' . $dbPath);
$username[0] = $_SESSION['username'];
var_dump($username);
$req = $db->prepare('SELECT zone FROM zones WHERE username = ?');
$req->execute($username);
$domain = $req->fetch()['zone'];
while ($domain != NULL) {
echo "<option value='" . $domain . "'>" . $domain . "</option>";
$domain = $req->fetch()['zone'];
}
?>
</select>
<br>
<input value="Valider" type="submit">
</form>
<form method="post">
<select required="" name="zone" id="zone">
<option value="" disabled="" selected="">---</option>
<?php
$db = new PDO('sqlite:' . $dbPath);
$username[0] = $_SESSION['username'];
if (isset($_POST['zone']) AND isset($_SESSION['username'])) {
$req = $db->prepare('SELECT zone FROM zones WHERE username = ?');
$req->execute($username);
exec("/usr/sbin/keymgr " . $_POST['zone'] . " ds", $output);
echo "Voici les enregistrements DNS à indiquer à la zone parente<br>";
echo "<code>" . $output[1] . "</code><br><code>" . $output[2] . "</code>";
$domain = $req->fetch()['zone'];
while ($domain != NULL) {
echo "<option value='" . $domain . "'>" . $domain . "</option>";
$domain = $req->fetch()['zone'];
}
?>
?>
</select>
<br>
<input value="Valider" type="submit">
</form>
<?php
if (isset($_POST['zone']) AND isset($_SESSION['username'])) {
exec("/usr/sbin/keymgr " . $_POST['zone'] . " ds", $output);
echo "Voici les enregistrements DNS à indiquer à la zone parente<br>";
echo "<code>" . $output[0] . "</code><br><code>" . $output[1] . "</code>";
}
?>
<?php require "../bottom.inc.php"; ?>

View file

@ -1,48 +0,0 @@
<?php require "../top.inc.php"; ?>
<p>
Ici vous pouvez ajouter des informations dans une zone déjà enregistrée sur le serveur ns1.atope.art
</p>
<form method="post">
<label for="domain">Domaine :</label>
<input type="text" name="domain" id="domain"/>
<select name="action">
<option value="add">Ajouter</option>
<option value="delete">Retirer</option>
</select>
<label for="ttl">TTL :</label>
<input type="number" name="ttl" id="ttl"/>
IN
<select name="type">
<option value="a">A</option>
<option value="aaaa">AAAA</option>
<option value="mx">MX</option>
<option value="txt">TXT</option>
<option value="txt">CNAME</option>
<option value="txt">SRV</option>
<option value="txt">NS</option>
</select>
<label for="value">Valeur :</label>
<input type="text" name="value" id="value"/>
</form>
<?php
if (isset($_POST['zone'])) {
exec("knotc zone-begin " . $_POST['zone']);
exec("knotc zone-set " . $_POST['zone'] . " " . $_POST['domain'] . ". 900 IN A " . $_POST['ip']);
exec("knotc zone-commit " . $_POST['zone']);
echo "Formulaire traité !!";
} else {
echo "Rien n'a été reçu lors du dernière chargement";
}
?>
<?php require "../bottom.inc.php"; ?>

View file

@ -1,14 +1,15 @@
<?php require "../top.inc.php"; ?>
<p>
Utiliser ns1.atope.art comme serveur de noms sur ses domaines
<br>
<a class="nsButton" href="zone">Ajouter une zone</a>
<br>
<a class="nsButton" href="dnssec">Obtenir les enregistrements DS d'une zone</a>
<br>
<a class="nsButton" href="ip">Ajouter un enregistrement A ou AAAA à une zone</a>
<br>
<a class="nsButton" href="ns">Ajouter un enregistrement NS à une zone</a>
</p>
<p>
Utiliser ns1.atope.art comme serveur de noms sur ses domaines
<br>
<a class="nsButton" href="zone">Ajouter une zone</a>
<br>
<a class="nsButton" href="dnssec">Obtenir les enregistrements DS d'une zone</a>
<br>
<a class="nsButton" href="ip">Ajouter un enregistrement A ou AAAA à une zone</a>
<br>
<a class="nsButton" href="ns">Ajouter un enregistrement NS à une zone</a>
</p>
<?php require "../bottom.inc.php"; ?>

153
ns/ip.php
View file

@ -1,95 +1,86 @@
<?php require "../top.inc.php"; ?>
<p>
Ici vous pouvez ajouter ou enlever des adresses IP dans une zone déjà enregistrée sur le serveur ns1.atope.art
<br>Le format IPv4 (A) ou IPv6 (AAAA) sera détecté automatiquement.
<br>Si vous souhaitez utiliser un service d'hébergement hypertexte de Niver, voici les adresses à renseigner :
<br>IPv4 : 45.13.104.169
<br>IPv6 : 2a0b:cbc0:1103:2::106f
</p>
<p>
Ici vous pouvez ajouter ou enlever des adresses IP dans une zone déjà enregistrée sur le serveur ns1.atope.art
<br>Le format IPv4 (A) ou IPv6 (AAAA) sera détecté automatiquement.
<br>Si vous souhaitez utiliser un service d'hébergement hypertexte de Niver, voici les adresses à renseigner :
<br>IPv4 : 45.13.104.169
<br>IPv6 : 2a0b:cbc0:1103:2::106f
</p>
<form method="post">
<label for="action">Action :</label>
<select name="action" id="action">
<option value="add">Ajouter</option>
<option value="delete">Retirer</option>
</select>
<br>
<label for="zone">Zone</label><br>
<select required="" name="zone" id="zone">
<option value="" disabled="" selected="">---</option>
<?php
$db = new PDO('sqlite:' . $dbPath);
$username[0] = $_SESSION['username'];
var_dump($username);
$req = $db->prepare('SELECT zone FROM zones WHERE username = ?');
$req->execute($username);
$domain = $req->fetch()['zone'];
while ($domain != NULL) {
echo "<option value='" . $domain . "'>" . $domain . "</option>";
$domain = $req->fetch()['zone'];
}
?>
</select>
<br>
<label for="domain">Domaine</label><br>
<input required="" id="domain" name="domain" type="text" placeholder="www.domaine."><br>
<label for="ttl"><abbr title="Time To Live">TTL</abbr></label><br>
<input id="ttl" list="ttls" name="ttl" size="10" type="number" min="600" max="604800" value="3600" placeholder="3600"><br>
<datalist id="ttls">
<option value="900">
<option value="3600">
<option value="10800">
<option value="86400">
<option value="604800">
</datalist>
<label for="ip">IP</label><br>
<input required="" pattern="^[a-f0-9:.]+$" id="ip" name="ip" minlength="7" maxlength="39" size="40" type="text" placeholder="2a0b:cbc0:1103:2::106f ou 45.13.104.169"><br>
<input value="Valider" type="submit">
</form>
<form method="post">
<label for="action">Action</label>
<select name="action" id="action">
<option value="add">Ajouter</option>
<option value="delete">Retirer</option>
</select>
<br>
<label for="zone">Zone</label><br>
<select required="" name="zone" id="zone">
<option value="" disabled="" selected="">---</option>
<?php
$db = new PDO('sqlite:' . DB_PATH);
$username[0] = $_SESSION['username'];
if (isset($_POST['domain']) AND isset($_POST['ip']) AND isset($_POST['zone']) AND isset($_POST['action'])) {
var_dump($username);
if (!filter_var($_POST['ip'], FILTER_VALIDATE_IP)) {
echo "Erreur : l'adresse IP n'est pas valide";
} else if (!filter_var($_POST['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE)) {
echo "Erreur : l'adresse IP est dans une plage privée";
} else if (!filter_var($_POST['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE)) {
echo "Erreur : l'adresse IP est dans une plage réservée";
} else {
if (filter_var($_POST['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
$record = "A";
} else if (filter_var($_POST['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
$record = "AAAA";
} else {
exit("Erreur inconnue sur le format de l'IP");
}
$req = $db->prepare('SELECT zone FROM zones WHERE username = ?');
$req->execute($username);
if ($_POST['action'] == "delete") {
$action = "un";
} else if ($_POST['action'] == "add") {
$action = "";
} else {
exit("Erreur : valeur invalide pour action");
}
$domain = $req->fetch()['zone'];
exec("knotc zone-begin " . $_POST['zone']);
exec("knotc zone-" . $action . "set " . $_POST['zone'] . " " . $_POST['domain'] . " 900 IN " . $record . " " . $_POST['ip']);
exec("knotc zone-commit " . $_POST['zone']);
echo "Opération effectuée";
}
while ($domain != NULL) {
echo "<option value='" . $domain . "'>" . $domain . "</option>";
$domain = $req->fetch()['zone'];
}
?>
</select>
<br>
<label for="domain">Domaine</label><br>
<input required="" id="domain" name="domain" type="text" placeholder="www.domaine."><br>
<label for="ttl"><abbr title="Time To Live">TTL</abbr></label><br>
<input required="" id="ttl" list="ttls" name="ttl" size="10" type="number" min="600" max="604800" value="3600" placeholder="3600"><br>
<datalist id="ttls">
<option value="900">
<option value="3600">
<option value="10800">
<option value="86400">
<option value="604800">
</datalist>
<label for="ip">IP</label><br>
<input required="" pattern="^[a-f0-9:.]+$" id="ip" name="ip" minlength="7" maxlength="39" size="40" type="text" placeholder="2a0b:cbc0:1103:2::106f ou 45.13.104.169"><br>
<input value="Valider" type="submit">
</form>
<?php
if (isset($_POST['domain']) AND isset($_POST['ip']) AND isset($_POST['zone']) AND isset($_POST['action'])) {
checkIpFormat($_POST['ip']);
if (filter_var($_POST['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4))
$record = "A";
else if (filter_var($_POST['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6))
$record = "AAAA";
else
exit("Erreur inconnue sur le format de l'IP");
if ($_POST['action'] == "delete")
$action = "un";
else if ($_POST['action'] == "add")
$action = "";
else
exit("ERROR : Wrong value for action");
exec(KNOTC_PATH . " zone-begin " . $_POST['zone']);
exec(KNOTC_PATH . " zone-" . $action . "set " . $_POST['zone'] . " " . $_POST['domain'] . " 3600 " . $record . " " . $_POST['ip']);
exec(KNOTC_PATH . " zone-commit " . $_POST['zone']);
echo "Enregistrement ajouté";
}
?>
<?php require "../bottom.inc.php"; ?>

View file

@ -1,59 +1,58 @@
<?php include "../top.inc.php"; ?>
<form method="post">
<label for="action">Action</label>
<select name="action" id="action">
<option value="add">Ajouter</option>
<option value="delete">Retirer</option>
</select>
<br>
<label for="zone">Zone</label>
<br>
<select required="" name="zone" id="zone">
<option value="" disabled="" selected="">---</option>
<?php
$zones = listUserZones($_SESSION['username']);
foreach ($zones as $zone) {
echo "<option value='" . $zone . "'>" . $zone . "</option>";
}
?>
</select>
<br>
<label for="domain">Domaine</label>
<br>
<input id="domain" placeholder="monsite.atope.art." name="domain" type="text">
<br>
<label for="ns">Serveur de nom</label>
<br>
<input id="ns" placeholder="ns1.atope.art." name="ns" type="text">
<br>
<input value="Valider" type="submit">
</form>
<form method="post">
<label for="action">Action</label>
<select name="action" id="action">
<option value="add">Ajouter</option>
<option value="delete">Retirer</option>
</select>
<br>
<label for="zone">Zone</label>
<br>
<select required="" name="zone" id="zone">
<option value="" disabled="" selected="">---</option>
<?php
$zones = listUserZones($_SESSION['username']);
if (isset($_POST['zone']) AND isset($_POST['domain']) AND isset($_POST['action']) AND isset($_POST['ns']) AND isset($_SESSION['username'])) {
nsCheckZonePossession($_POST['zone']);
checkDomainValidity($_POST['domain']);
checkDomainValidity($_POST['ns']);
if ($_POST['action'] == "delete")
$action = "un";
else if ($_POST['action'] == "add")
$action = "";
else
exit("Erreur : valeur invalide pour action");
exec("knotc zone-begin " . $_POST['zone']);
exec("knotc zone-" . $action . "set " . $_POST['zone'] . " " . $_POST['domain'] . " 3600 IN NS " . $_POST['ns']);
exec("knotc zone-commit " . $_POST['zone']);
foreach ($zones as $zone) {
echo "<option value='" . $zone . "'>" . $zone . "</option>";
}
?>
</select>
<br>
<label for="domain">Domaine</label>
<br>
<input id="domain" placeholder="monsite.atope.art." name="domain" type="text">
<br>
<label for="ns">Serveur de nom</label>
<br>
<input id="ns" placeholder="ns1.atope.art." name="ns" type="text">
<br>
<input value="Valider" type="submit">
</form>
<?php
if (isset($_POST['zone']) AND isset($_POST['domain']) AND isset($_POST['action']) AND isset($_POST['ns']) AND isset($_SESSION['username'])) {
nsCheckZonePossession($_POST['zone']);
checkAbsoluteDomainFormat($_POST['domain']);
checkAbsoluteDomainFormat($_POST['ns']);
if ($_POST['action'] == "delete")
$action = "un";
else if ($_POST['action'] == "add")
$action = "";
else
exit("Erreur : valeur invalide pour action");
exec("knotc zone-begin " . $_POST['zone']);
exec("knotc zone-" . $action . "set " . $_POST['zone'] . " " . $_POST['domain'] . " 3600 IN NS " . $_POST['ns']);
exec("knotc zone-commit " . $_POST['zone']);
echo "Enregistrement ajouté";
}
?>
<?php include "../bottom.inc.php"; ?>

View file

@ -1,40 +1,36 @@
<?php require "../top.inc.php"; ?>
<p>
Ici vous pouvez ajouter une zone sur le serveur ns1.atope.art.
</p>
<form method="post">
<label for="domain">Domaine</label><br>
<input required="" placeholder="niver.atope.art." id="domain" name="domain" type="text"><br>
<input value="Valider" type="submit">
</form>
<form method="post">
<label for="domain">Domaine</label><br>
<input required="" placeholder="niver.atope.art." id="domain" name="domain" type="text"><br>
<input value="Valider" type="submit">
</form>
<?php
<?php
if (isset($_POST['domain']) AND isset($_SESSION['username'])) {
if (isset($_POST['domain']) AND isset($_SESSION['username'])) {
checkDomainValidity($_POST['domain']);
checkAbsoluteDomainFormat($_POST['domain']);
$db = new PDO('sqlite:' . DB_PATH);
$stmt = $db->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();
exec("cp /var/lib/knot/zones/template /var/lib/knot/zones/" . $_POST['domain'] . "zone");
exec("sed -i 's/maison.atope.art./" . $_POST['domain'] . "/g' /var/lib/knot/zones/" . $_POST['domain'] . "zone");
exec("cp /var/lib/knot/zones/template /var/lib/knot/zones/" . $_POST['domain'] . "zone");
exec("sed -i 's/maison.atope.art./" . $_POST['domain'] . "/g' /var/lib/knot/zones/" . $_POST['domain'] . "zone");
exec("knotc conf-begin");
exec("knotc conf-set 'zone[" . $_POST['domain'] . "]'");
exec("knotc conf-set 'zone[" . $_POST['domain'] . "].file' '" . $_POST['domain'] . "zone'");
exec("knotc conf-commit");
echo "La requête a été traitée.";
exec("knotc conf-begin");
exec("knotc conf-set 'zone[" . $_POST['domain'] . "]'");
exec("knotc conf-set 'zone[" . $_POST['domain'] . "].file' '" . $_POST['domain'] . "zone'");
exec("knotc conf-commit");
echo "La requête a été traitée.";
}
}
?>
?>
<?php require "../bottom.inc.php"; ?>

View file

@ -17,19 +17,20 @@ session_start([
define("USERNAME_REGEX", "^[a-z]{4,32}$");
define("PASSWORD_REGEX", "^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])[a-zA-Z0-9]{8,1024}|.{10,1024}$");
define("SUBDOMAIN_REGEX", "^[a-z]{4,63}$");
define("PREFIX", "/malaxe");
define("SERVICE", substr(dirname($_SERVER['PHP_SELF']), strlen(PREFIX) + 1));
define("ROOT_PATH", "/var/www/niver" . PREFIX);
define("PAGE", basename($_SERVER['PHP_SELF'], '.php'));
define("DB_PATH", ROOT_PATH . "/db/niver.db");
define("KNOTC_PATH", "/usr/sbin/knotc");
if (SERVICE != "auth" AND !isset($_SESSION['username'])) {
header('Location: ' . PREFIX . '/auth/login?redir=' . SERVICE . "/" . PAGE);
exit;
}
define("DB_PATH", ROOT_PATH . "/db/auth.db");
$dbPath = DB_PATH;
$theme = array(
'htColor' => "#FF0000",
@ -42,7 +43,6 @@ $theme = array(
switch (SERVICE) {
case "ht":
require "ht/ht.fn.inc.php";
$theme = array('mainColor' => $theme['htColor']) + $theme;
break;
case "nic":
@ -59,8 +59,11 @@ switch (SERVICE) {
break;
}
require "pages.inc.php";
require "fn.inc.php";
require "inc/all.inc.php";
require "inc/format.inc.php";
require "inc/ht.inc.php";
require "inc/pages.inc.php";
require "inc/reg.inc.php";
require_once 'lessphp/lib/Less/Autoloader.php';
Less_Autoloader::register();
@ -72,7 +75,7 @@ foreach ($relativeLessFiles as $relativeLessFile => $nothing) {
$absoluteLessFiles[ROOT_PATH . "/less/" . $relativeLessFile] = "";
}
$options = array('cache_dir' => ROOT_PATH . '/css/'); //, 'compress' => true
$options = array('cache_dir' => ROOT_PATH . '/css/', 'compress' => true);
$cssFileName = Less_Cache::Get($absoluteLessFiles, $options, $theme);
?>