From dedce71154de408a52ff2c62a5f7b023c52b4cc8 Mon Sep 17 00:00:00 2001 From: Miraty Date: Mon, 18 Apr 2022 19:44:58 +0200 Subject: [PATCH] Remove Gemini references --- README.md | 53 +--------------------- ht/gemini-domain.php | 89 ------------------------------------- ht/gemini-onion.php | 103 ------------------------------------------- ht/http-onion.php | 10 +++-- ht/https-domain.php | 12 ++--- ht/index.php | 8 ---- inc/const.inc.php | 11 +++-- inc/pages.inc.php | 6 --- index.php | 2 +- 9 files changed, 22 insertions(+), 272 deletions(-) delete mode 100644 ht/gemini-domain.php delete mode 100644 ht/gemini-onion.php diff --git a/README.md b/README.md index 4752348..7de85bd 100644 --- a/README.md +++ b/README.md @@ -8,55 +8,4 @@ This PHP Web interface allow it's users to manage 3 services, that can be used t * A domain registry * A nameserver -* An hypertext service, that allow a directory containing hypertext documents to be accessed with the choice of the protocol and the routing method : -* HTTP(S) or Gemini -* DNS access or Onion (the Tor's system) - - -On the client: -``` -$ ssh-keygen -a 100 -t ed25519 -``` - -## Nginx mimetypes association - -``` -text/plain txt; -text/gemini gmi; -text/markdown md; -text/html html; -text/css css; -text/xml xml; -text/csv csv; -text/javascript js; - -application/xhtml+xml xhtml; -application/atom+xml atom; -application/rss+xml rss; - -application/json json; -application/gzip gz; -application/zip zip; -application/epub+zip epub; -application/pdf pdf; - -font/woff woff; -font/woff2 woff2; - -image/png png; -image/tiff tif tiff; -image/gif gif; -image/jpeg jpeg jpg; -image/svg+xml svg svgz; -image/webp webp; - -audio/mpeg mp3; -audio/ogg ogg oga opus spx; -audio/webm weba; -audio/flac flac; - -video/webm webm; -video/mp4 mp4; -video/ogg ogv; - -``` +* An HTTP service diff --git a/ht/gemini-domain.php b/ht/gemini-domain.php deleted file mode 100644 index 0c88808..0000000 --- a/ht/gemini-domain.php +++ /dev/null @@ -1,89 +0,0 @@ - - -

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

- -
-
-
-
- -
- -
- - - - diff --git a/ht/gemini-onion.php b/ht/gemini-onion.php deleted file mode 100644 index 7cb8f03..0000000 --- a/ht/gemini-onion.php +++ /dev/null @@ -1,103 +0,0 @@ - -

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

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

"; - -} - -?> - - diff --git a/ht/http-onion.php b/ht/http-onion.php index 42122a8..105c1dd 100644 --- a/ht/http-onion.php +++ b/ht/http-onion.php @@ -56,7 +56,7 @@ if (isset($_POST['dir']) AND isset($_SESSION['username'])) { // Generate a .onion address $torConf = file_get_contents(TOR_CONFIG_PATH); - $torConf = $torConf . "\nHiddenServiceDir " . TOR_KEYS_PATH . "/" . $_POST['dir'] . "/\nHiddenServicePort 80 [::1]:80"; + $torConf = $torConf . "\nHiddenServiceDir " . TOR_KEYS_PATH . "/" . $_POST['dir'] . "/\nHiddenServicePort 80 [::1]:" . INTERNAL_ONION_HTTP_PORT; file_put_contents(TOR_CONFIG_PATH, $torConf); exec(SUDO_PATH . " " . MANIVER_PATH . " reload-tor", $output); @@ -78,9 +78,11 @@ if (isset($_POST['dir']) AND isset($_SESSION['username'])) { // Add it to Nginx $nginxConf = file_get_contents(NIVER_TEMPLATE_PATH . "/nginx/onion.template"); - $nginxConf = preg_replace("#DOMAIN#", $onion, $nginxConf); - $nginxConf = preg_replace("#DIR#", $_POST['dir'], $nginxConf); - $nginxConf = preg_replace("#USER#", $_SESSION['username'], $nginxConf); + $nginxConf = str_replace("{{INTERNAL_ONION_HTTP_PORT}}", INTERNAL_ONION_HTTP_PORT, $nginxConf); + $nginxConf = str_replace("{{DOMAIN}}", $onion, $nginxConf); + $nginxConf = str_replace("{{HT_PATH}}", HT_PATH, $nginxConf); + $nginxConf = str_replace("{{USERNAME}}", $_SESSION['username'], $nginxConf); + $nginxConf = str_replace("{{DIR}}", $_POST['dir'], $nginxConf); file_put_contents(NGINX_CONFIG_PATH . "/" . $_POST['dir'] . ".conf", $nginxConf); // Reload Nginx diff --git a/ht/https-domain.php b/ht/https-domain.php index c5f1af0..21696eb 100644 --- a/ht/https-domain.php +++ b/ht/https-domain.php @@ -65,11 +65,13 @@ if (isset($_POST['domain']) AND isset($_POST['dir']) AND isset($_SESSION['userna addSite($_SESSION['username'], $_POST['dir'], $_POST['domain'], "dns", "http"); - $conf = file_get_contents(NIVER_TEMPLATE_PATH . "/nginx/dns.template"); - $conf = preg_replace("#DOMAIN#", $_POST['domain'], $conf); - $conf = preg_replace("#DIR#", $_POST['dir'], $conf); - $conf = preg_replace("#USER#", $_SESSION['username'], $conf); - file_put_contents(NGINX_CONFIG_PATH . "/" . $_POST['domain'] . ".conf", $conf); + $nginxConf = file_get_contents(NIVER_TEMPLATE_PATH . "/nginx/dns.template"); + $nginxConf = str_replace("{{HTTPS_PORT}}", HTTPS_PORT, $nginxConf); + $nginxConf = str_replace("{{DOMAIN}}", $_POST['domain'], $nginxConf); + $nginxConf = str_replace("{{HT_PATH}}", HT_PATH, $nginxConf); + $nginxConf = str_replace("{{USERNAME}}", $_SESSION['username'], $nginxConf); + $nginxConf = str_replace("{{DIR}}", $_POST['dir'], $nginxConf); + file_put_contents(NGINX_CONFIG_PATH . "/" . $_POST['domain'] . ".conf", $nginxConf); // Reload Nginx exec(SUDO_PATH . " " . MANIVER_PATH . " reload-nginx"); diff --git a/ht/index.php b/ht/index.php index e6eefb6..4253679 100644 --- a/ht/index.php +++ b/ht/index.php @@ -13,14 +13,6 @@
Un site HTML, accessible directement, par un nom de domaine
-
Accès Gemini en Onion
-
- Une capsule Gemini, accessible par Tor, avec une adresse en .onion -
-
Accès Gemini par DNS
-
- Une capsule Gemini, accessible directement, par un nom de domaine -
Let's Encrypt
Installer un certificat Let's Encrypt sur un domaine diff --git a/inc/const.inc.php b/inc/const.inc.php index a517b54..3a5bb24 100644 --- a/inc/const.inc.php +++ b/inc/const.inc.php @@ -5,15 +5,18 @@ if (strpos($_SERVER['PHP_SELF'], "inc.php") !== false) // --- Constants definitions --- // Public IP adresses (shown on the interface) -define("IPV4_ADDRESS", "127.0.0.1"); define("IPV6_ADDRESS", "::1"); +define("IPV4_ADDRESS", "127.0.0.1"); + +define("HTTPS_PORT", "42443"); +define("INTERNAL_ONION_HTTP_PORT", "9080"); define("ORIGIN", "https://niver.test:42443"); define("REGISTRY", "niver.test."); // Example IP adresses (for placeholders) -define("IPV4_EXAMPLE", "203.0.113.42"); // See RFC5737: IPv4 Address Blocks Reserved for Documentation define("IPV6_EXAMPLE", "2001:db8::3"); // See RFC3849: IPv6 Address Prefix Reserved for Documentation +define("IPV4_EXAMPLE", "203.0.113.42"); // See RFC5737: IPv4 Address Blocks Reserved for Documentation define("DOMAIN_EXAMPLE", "example"); // From RFC2606: Reserved Top Level DNS Names > 2. TLDs for Testing, & Documentation Examples // Custom Niver paths @@ -22,7 +25,7 @@ define("ROOT_PATH", "/var/www/niver" . PREFIX); // Niver's directory define("SERVICE", substr(dirname($_SERVER['PHP_SELF']), strlen(PREFIX) + 1)); define("PAGE", basename($_SERVER['PHP_SELF'], '.php')); define("DB_PATH", ROOT_PATH . "/db/niver.db"); // Niver's SQLite database -define("NIVER_TEMPLATE_PATH", "/usr/local/share/niver"); // Templates directory (skel, nginx, knot...) +define("NIVER_TEMPLATE_PATH", "/usr/local/share/niver"); // Templates directory (nginx, knot...) define("MANIVER_PATH", "/usr/local/bin/maniver"); // Executable file define("HT_PATH", "/srv/ht"); // The mountpoint of the hypertext storage partition (that will be accessed over SFTP) // Nginx @@ -31,7 +34,7 @@ define("NGINX_CONFIG_PATH", "/etc/nginx/ht"); // Nginx configuration directory define("TOR_CONFIG_PATH", "/etc/tor/instances/niver/torrc"); // Tor configuration file define("TOR_KEYS_PATH", "/var/lib/tor-instances/niver/keys"); // Tor keys directory // Knot -define("KNOT_ZONES_PATH", "/var/lib/knot/zones"); // Knot zones directory +define("KNOT_ZONES_PATH", "/srv/ns"); // Knot zones directory // Executable files (you can get the full path of a command with $ which ) define("KNOTC_PATH", "/usr/sbin/knotc"); define("KEYMGR_PATH", "/usr/sbin/keymgr"); diff --git a/inc/pages.inc.php b/inc/pages.inc.php index 2d05f12..ebd4b68 100644 --- a/inc/pages.inc.php +++ b/inc/pages.inc.php @@ -91,12 +91,6 @@ switch (SERVICE) { case "mkdir": $page['title'] = "Créer un dossier de site"; break; - case "gemini-onion": - $page['title'] = "Accès Gemini en Onion"; - break; - case "gemini-domain": - $page['title'] = "Accès Gemini par domaine"; - break; case "http-onion": $page['title'] = "Accès HTTP en Onion"; break; diff --git a/index.php b/index.php index 72cad63..d01609e 100644 --- a/index.php +++ b/index.php @@ -11,7 +11,7 @@
Hypertexte
- Mettre en ligne son site statique sur un espace SFTP, et le faire répondre en HTTP ou Gemini par le DNS ou Tor + Mettre en ligne son site statique sur un espace SFTP, et le faire répondre en HTTP par DNS ou Tor
Authentification