Add TXT record form
This commit is contained in:
parent
f294a90cf1
commit
300efe4a04
8 changed files with 113 additions and 33 deletions
|
@ -2,9 +2,8 @@
|
|||
define("PREFIX", "/malaxe");
|
||||
define("ROOT_PATH", "/var/www/niver" . PREFIX);
|
||||
define("DB_PATH", ROOT_PATH . "/db/auth.db");
|
||||
|
||||
$suffixes = array(
|
||||
"atope.art.",
|
||||
/* "atope.art.", */
|
||||
|
||||
"asso.atope.art.",
|
||||
"org.atope.art.",
|
||||
|
@ -106,6 +105,7 @@ $suffixes = array(
|
|||
);
|
||||
|
||||
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)");
|
||||
|
||||
|
@ -116,7 +116,7 @@ foreach ($suffixes as $extension) {
|
|||
$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");
|
||||
|
@ -135,14 +135,14 @@ foreach ($suffixes as $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);
|
||||
*/
|
||||
exec("knotc zone-begin atope.art.");
|
||||
exec("knotc zone-set atope.art. " . $dsRecord);
|
||||
exec("knotc zone-commit atope.art.");
|
||||
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ if (strpos($_SERVER['PHP_SELF'], "inc.php") !== false)
|
|||
switch (SERVICE) {
|
||||
|
||||
case "ns":
|
||||
$page['service'] = "Serveur de noms";
|
||||
$page['service'] = "Serveurs de noms";
|
||||
switch (PAGE) {
|
||||
case "index":
|
||||
$page['title'] = "Accueil";
|
||||
|
@ -14,16 +14,13 @@ switch (SERVICE) {
|
|||
$page['title'] = "Obtenir les enregistrements DS";
|
||||
break;
|
||||
case "ip":
|
||||
$page['title'] = "Ajouter un enregistrement A ou AAAA";
|
||||
break;
|
||||
case "a":
|
||||
$page['title'] = "Ajouter un enregistrement A";
|
||||
break;
|
||||
case "aaaa":
|
||||
$page['title'] = "Ajouter un enregistrement AAAA";
|
||||
$page['title'] = "Enregistrements A ou AAAA";
|
||||
break;
|
||||
case "ns":
|
||||
$page['title'] = "Ajouter un enregistrement NS";
|
||||
$page['title'] = "Enregistrement NS";
|
||||
break;
|
||||
case "txt":
|
||||
$page['title'] = "Enregistrement TXT";
|
||||
break;
|
||||
case "zone":
|
||||
$page['title'] = "Ajouter une zone";
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<option value="" disabled="" selected="">---</option>
|
||||
|
||||
<?php
|
||||
$db = new PDO('sqlite:' . $dbPath);
|
||||
$db = new PDO('sqlite:' . DB_PATH);
|
||||
$username[0] = $_SESSION['username'];
|
||||
|
||||
$req = $db->prepare('SELECT zone FROM zones WHERE username = ?');
|
||||
|
@ -18,7 +18,7 @@
|
|||
$domain = $req->fetch()['zone'];
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
</select>
|
||||
<br>
|
||||
<input value="Valider" type="submit">
|
||||
|
|
28
ns/index.php
28
ns/index.php
|
@ -2,11 +2,29 @@
|
|||
|
||||
<h2><a class="nsButton" href="zone">Ajouter une zone</a></h2>
|
||||
Pour qu'elle soit gérée par le serveur de noms ns1.atope.art
|
||||
<h2><a class="nsButton" href="dnssec">Obtenir les enregistrements <abbr title="Delegation Signer">DS</abbr></a></h2>
|
||||
À indiquer à la zone parente pour activer <abbr title="Domain Name System Security Extensions">DNSSEC</abbr>
|
||||
<h2><a class="nsButton" href="ns">Enregistrement <abbr title="Name Server">NS</abbr></a></h2>
|
||||
Indiquer le serveur de noms d'une zone
|
||||
<h2><a class="nsButton" href="ip">Enregistrements A ou AAAA</a></h2>
|
||||
Pour indiquer l'adresse IP d'un domaine
|
||||
<h2><a class="nsButton" href="ns">Enregistremenst NS</a></h2>
|
||||
Pour indiquer le serveur de noms d'une zone
|
||||
<h2><a class="nsButton" href="dnssec">Obtenir les enregistrements DS d'une zone</a></h2>
|
||||
À indiquer à la zone parente pour activer DNSSEC
|
||||
Indiquer l'adresse IP d'un domaine
|
||||
<h2><a class="nsButton" href="txt">Enregistrement TXT</a></h2>
|
||||
Associer du texte à un domaine
|
||||
<h2><a class="nsButton" href="tlsa">Enregistrement <abbr title="Transport Layer Security Association">TLSA</abbr></a></h2>
|
||||
Mettre en place <abbr title="DNS-based Authentication of Named Entities">DANE</abbr> en indiquant l'empreinte d'un certificat <abbr title="Transport Layer Security">TLS</abbr>
|
||||
<h2><a class="nsButton" href="caa">Enregistrement <abbr title="Certification Authority Authorization">CAA</abbr></a></h2>
|
||||
Indiquer les seules autorités de certifications autorisée à signer les domaines
|
||||
<h2><a class="nsButton" href="srv">Enregistrement SRV</a></h2>
|
||||
Indiquer un serveur pour un domaine
|
||||
<h2><a class="nsButton" href="mx">Enregistrement <abbr title="Mail eXchange">MX</abbr></a></h2>
|
||||
Indiquer le serveur mail pour un domaine
|
||||
<h2><a class="nsButton" href="loc">Enregistrement LOC</a></h2>
|
||||
Indiquer la localisation physique d'un domaine
|
||||
<h2><a class="nsButton" href="sshfp">Enregistrement <abbr title="Secure SHell FingerPrint">SSHFP</abbr></a></h2>
|
||||
Indiquer les empreintes de clés <abbr title="Secure SHell">SSH</abbr> d'un domaine
|
||||
<h2><a class="nsButton" href="cname">Enregistrement <abbr title="Canonical NAME">CNAME</abbr></a></h2>
|
||||
Définir un domaine comme étant l'alias d'un autre
|
||||
<h2><a class="nsButton" href="dname">Enregistrement <abbr title="Delegation NAME">DNAME</abbr></a></h2>
|
||||
Définir les sous-domains d'un domaine comme étant les alias des sous-domaines d'un autre domaine
|
||||
|
||||
<?php require "../bottom.inc.php"; ?>
|
||||
|
|
63
ns/txt.php
Normal file
63
ns/txt.php
Normal file
|
@ -0,0 +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="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="txt">Texte</label>
|
||||
<br>
|
||||
<input id="txt" minlenght="5" maxlength="8192" pattern="^[a-zA-Z0-9 =:!%$+/\()[\]_-]{5,8192}$" placeholder="Du texte..." name="txt" 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['txt']) AND isset($_SESSION['username'])) {
|
||||
|
||||
if (!(preg_match("¤^[a-zA-Z0-9 =:!%$+/\()[\]_-]{5,8192}$¤", $_POST['txt'])))
|
||||
exit("ERROR : Wrong caracter or wrong caracter quantity");
|
||||
|
||||
nsCheckZonePossession($_POST['zone']);
|
||||
checkAbsoluteDomainFormat($_POST['domain']);
|
||||
|
||||
if ($_POST['action'] == "delete")
|
||||
$action = "un";
|
||||
else if ($_POST['action'] == "add")
|
||||
$action = "";
|
||||
else
|
||||
exit("Erreur : valeur invalide pour action");
|
||||
|
||||
$test = ' 3600 IN TXT \"' . $_POST['txt'] . '\"';
|
||||
echo $test;
|
||||
|
||||
exec(KNOTC_PATH . " zone-begin " . $_POST['zone']);
|
||||
exec(KNOTC_PATH . " zone-" . $action . "set " . $_POST['zone'] . " " . $_POST['domain'] . ' 3600 IN TXT \"' . $_POST['txt'] . '\"');
|
||||
exec(KNOTC_PATH . " zone-commit " . $_POST['zone']);
|
||||
echo "Enregistrement ajouté";
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<?php include "../bottom.inc.php"; ?>
|
10
reg/ds.php
10
reg/ds.php
|
@ -88,11 +88,13 @@ if (isset($_POST['zone']) AND isset($_POST['keytag']) AND isset($_POST['algo'])
|
|||
|
||||
checkAbsoluteDomainFormat($_POST['zone']);
|
||||
nsCheckZonePossession($_POST['zone']);
|
||||
nicCheckDomainPossession($_POST['zone']);
|
||||
regCheckDomainPossession($_POST['zone']);
|
||||
|
||||
exec(KNOTC_PATH . " zone-begin atope.art");
|
||||
exec(KNOTC_PATH . " zone-set atope.art " . $_POST['zone'] . " 3600 DS " . $_POST['keytag'] . " " . $_POST['algo'] . " " . $_POST['dt'] . " " . $_POST['key']);
|
||||
exec(KNOTC_PATH . " zone-commit atope.art");
|
||||
$suffix = regGetSuffix($_POST['zone']);
|
||||
|
||||
exec(KNOTC_PATH . " zone-begin " . $suffix);
|
||||
exec(KNOTC_PATH . " zone-set " . $suffix . " " . $_POST['zone'] . " 86400 DS " . $_POST['keytag'] . " " . $_POST['algo'] . " " . $_POST['dt'] . " " . $_POST['key']);
|
||||
exec(KNOTC_PATH . " zone-commit " . $suffix);
|
||||
//secure.example. DS tag=12345 alg=3 digest_type=1 <foofoo>
|
||||
echo "La requête a été envoyée à Knot";
|
||||
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
<h2><a class="nicButton" href="register">Enregistrer un nouveau nom de domaine</a></h2>
|
||||
Prendre possession d'un sous-domaine d'atope.art
|
||||
<h2><a class="nicButton" href="ns">NS (Name Server)</a></h2>
|
||||
<h2><a class="nicButton" href="ns">Enregistrement <abbr title="Name Server">NS</abbr></a></h2>
|
||||
Indiquer les serveurs de noms de son sous-domaine d'atope.art
|
||||
<h2><a class="nicButton" href="ds">Enregistrement <abbr title="Delegation Signer">DS</abbr></a></h2>
|
||||
Déléguer la confiance <abbr title="Domain Name System Security Extensions">DNSSEC</abbr>
|
||||
<h2><a class="nicButton" href="glue">Glue Record</a></h2>
|
||||
Indiquer les IP de ses serveurs de noms de son sous-domaine d'atope.art dont les adresses se trouvent sur ce même sous-domaine
|
||||
<h2><a class="nicButton" href="ds">DS (Delegation Signer)</a></h2>
|
||||
Déléguer la confiance DNSSEC
|
||||
|
||||
<?php include "../bottom.inc.php"; ?>
|
||||
|
|
|
@ -48,9 +48,9 @@ if (isset($_POST['domain']) AND isset($_POST['action']) AND isset($_POST['ns'])
|
|||
|
||||
$suffix = regGetSuffix($_POST['domain']);
|
||||
|
||||
exec(KNOTC_PATH . " zone-begin atope.art");
|
||||
exec(KNOTC_PATH . " zone-begin " . $suffix);
|
||||
exec(KNOTC_PATH . " zone-" . $action . "set " . $suffix . " " . $_POST['domain'] . " 86400 NS " . $_POST['ns']);
|
||||
exec(KNOTC_PATH . " zone-commit atope.art");
|
||||
exec(KNOTC_PATH . " zone-commit " . $suffix);
|
||||
echo "Enregistrement NS ajouté";
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue