servnest/inc/const.inc.php

79 lines
2.8 KiB
PHP

<?php
if (strpos($_SERVER['PHP_SELF'], "inc.php") !== false)
exit("This file is meant to be included.");
// --- Constants definitions ---
// Public IP adresses (shown on the interface)
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("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
define("PREFIX", ""); // Prefix in URL, if any
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 (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
define("NGINX_CONFIG_PATH", "/etc/nginx/ht"); // Nginx configuration directory
// Tor
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", "/srv/ns"); // Knot zones directory
// Executable files (you can get the full path of a command with $ which <command>)
define("KNOTC_PATH", "/usr/sbin/knotc");
define("KEYMGR_PATH", "/usr/sbin/keymgr");
define("SUDO_PATH", "/usr/bin/sudo");
define("LS_PATH", "/usr/bin/ls");
// Both frontend and backend regexes
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}$");
// Password storage security
define("ALGO_PASSWORD", PASSWORD_ARGON2ID);
define("OPTIONS_PASSWORD", array(
"memory_cost" => 65536,
"time_cost" => 24,
"threads" => 64,
));
// Color scheme
define("THEME", array(
// Displayed on light theme
'darkRegColor' => "#D100D1",
'darkNsColor' => "#006DFF",
'darkHtColor' => "#008768",
'darkAuthColor' => "#EE0000",
// Displayed on dark theme
'lightRegColor' => "#FF50FF",
'lightNsColor' => "#00FFFF",
'lightHtColor' => "#FFFF00",
'lightAuthColor' => "#00FF00",
'lightColor' => '#FFFFFF',
'darkColor' => '#000000',
));
// Public suffixes
define("SUFFIXES", array(
REGISTRY,
));