Use KNOTC_PATH everywhere

This commit is contained in:
Miraty 2021-02-19 13:29:04 +01:00
parent b024503f3f
commit f294a90cf1
5 changed files with 12 additions and 11 deletions

View file

@ -28,7 +28,7 @@
if (isset($_POST['zone']) AND isset($_SESSION['username'])) {
exec("/usr/sbin/keymgr " . $_POST['zone'] . " ds", $output);
exec(KEYMGR_PATH . " " . $_POST['zone'] . " ds", $output);
echo "Voici les enregistrements DNS à indiquer à la zone parente<br>";

View file

@ -47,9 +47,9 @@ if (isset($_POST['zone']) AND isset($_POST['domain']) AND isset($_POST['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']);
exec(KNOTC_PATH . " zone-begin " . $_POST['zone']);
exec(KNOTC_PATH . " zone-" . $action . "set " . $_POST['zone'] . " " . $_POST['domain'] . " 3600 IN NS " . $_POST['ns']);
exec(KNOTC_PATH . " zone-commit " . $_POST['zone']);
echo "Enregistrement ajouté";
}

View file

@ -23,10 +23,10 @@ if (isset($_POST['domain']) AND isset($_SESSION['username'])) {
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");
exec(KNOTC_PATH . " conf-begin");
exec(KNOTC_PATH . " conf-set 'zone[" . $_POST['domain'] . "]'");
exec(KNOTC_PATH . " conf-set 'zone[" . $_POST['domain'] . "].file' '" . $_POST['domain'] . "zone'");
exec(KNOTC_PATH . " conf-commit");
echo "La requête a été traitée.";
}

View file

@ -90,9 +90,9 @@ if (isset($_POST['zone']) AND isset($_POST['keytag']) AND isset($_POST['algo'])
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");
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");
//secure.example. DS tag=12345 alg=3 digest_type=1 <foofoo>
echo "La requête a été envoyée à Knot";

View file

@ -25,6 +25,7 @@ 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");
define("KEYMGR_PATH", "/usr/sbin/keymgr");
if (SERVICE != "auth" AND !isset($_SESSION['username'])) {
header('Location: ' . PREFIX . '/auth/login?redir=' . SERVICE . "/" . PAGE, true, 302);