Add options to disable each service
This commit is contained in:
parent
c7fba71721
commit
6c7cc99abd
4 changed files with 14 additions and 2 deletions
|
@ -64,6 +64,9 @@ echo (PAGE != "index") ? '<a class="niver" href="..">Niver</a><ul><li> <a href="
|
||||||
<main>
|
<main>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
if (in_array(SERVICE, ['reg', 'ns', 'ht']) AND CONF[SERVICE]['enabled'] !== true)
|
||||||
|
userError("Ce service est désactivé.");
|
||||||
|
|
||||||
// Protect against cross-site request forgery if a POST request is received
|
// Protect against cross-site request forgery if a POST request is received
|
||||||
if (empty($_POST) === false AND (isset($_SERVER['HTTP_SEC_FETCH_SITE']) !== true OR $_SERVER['HTTP_SEC_FETCH_SITE'] !== "same-origin"))
|
if (empty($_POST) === false AND (isset($_SERVER['HTTP_SEC_FETCH_SITE']) !== true OR $_SERVER['HTTP_SEC_FETCH_SITE'] !== "same-origin"))
|
||||||
userError("Anti-<abbr title='Cross-Site Request Forgery'>CSRF</abbr> verification failed ! (Wrong or unset <code>Sec-Fetch-Site</code> HTTP header)");
|
userError("Anti-<abbr title='Cross-Site Request Forgery'>CSRF</abbr> verification failed ! (Wrong or unset <code>Sec-Fetch-Site</code> HTTP header)");
|
||||||
|
|
|
@ -7,15 +7,18 @@ prefix =
|
||||||
knotc_path = "/usr/sbin/knotc"
|
knotc_path = "/usr/sbin/knotc"
|
||||||
|
|
||||||
[reg]
|
[reg]
|
||||||
|
enabled = true
|
||||||
registry = niver.test.
|
registry = niver.test.
|
||||||
registry_file = "/srv/ns/niver.test.zone"
|
registry_file = "/srv/ns/niver.test.zone"
|
||||||
ttl = 86400
|
ttl = 86400
|
||||||
subdomain_regex = "^[a-z0-9]{4,63}$"
|
subdomain_regex = "^[a-z0-9]{4,63}$"
|
||||||
|
|
||||||
[ns]
|
[ns]
|
||||||
|
enabled = true
|
||||||
knot_zones_path = "/srv/ns"
|
knot_zones_path = "/srv/ns"
|
||||||
|
|
||||||
[ht]
|
[ht]
|
||||||
|
enabled = true
|
||||||
; Path were user's sites will be stored
|
; Path were user's sites will be stored
|
||||||
ht_path = "/srv/ht"
|
ht_path = "/srv/ht"
|
||||||
; Nginx configuration directory
|
; Nginx configuration directory
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
// When the user requests something unexpected
|
// When the user requests something unexpected
|
||||||
function userError($msg) {
|
function userError($msg) {
|
||||||
http_response_code(403);
|
http_response_code(403);
|
||||||
echo "<p><strong>Erreur utilisataire</strong> : <em>" . $msg . "</em></p>";
|
echo "<p><strong>Erreur utilisataire</strong> : <em>" . $msg . "</em></p>\n";
|
||||||
closeHTML();
|
closeHTML();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ function userError($msg) {
|
||||||
function serverError($msg) {
|
function serverError($msg) {
|
||||||
http_response_code(500);
|
http_response_code(500);
|
||||||
error_log("Niver internal error: " . strip_tags($msg));
|
error_log("Niver internal error: " . strip_tags($msg));
|
||||||
echo "<p><strong>Server error</strong>: The server encountered an error: <em>" . $msg . "</em></p>";
|
echo "<p><strong>Server error</strong>: The server encountered an error: <em>" . $msg . "</em></p>\n";
|
||||||
closeHTML();
|
closeHTML();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,18 +5,24 @@
|
||||||
<dd>
|
<dd>
|
||||||
Gérer son compte Niver
|
Gérer son compte Niver
|
||||||
</dd>
|
</dd>
|
||||||
|
<?php if(CONF['reg']['enabled'] === true) { ?>
|
||||||
<dt><a class="reg" href="reg/">Registre</code></a></dt>
|
<dt><a class="reg" href="reg/">Registre</code></a></dt>
|
||||||
<dd>
|
<dd>
|
||||||
Demander l'attribution d'un sous-domaine</code>
|
Demander l'attribution d'un sous-domaine</code>
|
||||||
</dd>
|
</dd>
|
||||||
|
<?php } ?>
|
||||||
|
<?php if(CONF['ns']['enabled'] === true) { ?>
|
||||||
<dt><a class="ns" href="ns/">Serveurs de noms</a></dt>
|
<dt><a class="ns" href="ns/">Serveurs de noms</a></dt>
|
||||||
<dd>
|
<dd>
|
||||||
Utiliser le serveur de noms de Niver pour héberger ses zones
|
Utiliser le serveur de noms de Niver pour héberger ses zones
|
||||||
</dd>
|
</dd>
|
||||||
|
<?php } ?>
|
||||||
|
<?php if(CONF['ht']['enabled'] === true) { ?>
|
||||||
<dt><a class="ht" href="ht/">Hypertexte</a></dt>
|
<dt><a class="ht" href="ht/">Hypertexte</a></dt>
|
||||||
<dd>
|
<dd>
|
||||||
Mettre en ligne son site statique sur un espace <abbr title="SSH File Transfert Protocol">SFTP</abbr>, et le faire répondre en <abbr title="HyperText Transfert Protocol">HTTP</abbr> par DNS ou Tor
|
Mettre en ligne son site statique sur un espace <abbr title="SSH File Transfert Protocol">SFTP</abbr>, et le faire répondre en <abbr title="HyperText Transfert Protocol">HTTP</abbr> par DNS ou Tor
|
||||||
</dd>
|
</dd>
|
||||||
|
<?php } ?>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<?php closeHTML(); ?>
|
<?php closeHTML(); ?>
|
||||||
|
|
Loading…
Reference in a new issue