const.php 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. // --- Constants definitions ---
  3. // Public IP adresses (shown on the interface)
  4. define("IPV6_ADDRESS", "::1");
  5. define("IPV4_ADDRESS", "127.0.0.1");
  6. define("HTTPS_PORT", "42443");
  7. define("INTERNAL_ONION_HTTP_PORT", "9080");
  8. define("ORIGIN", "https://niver.test:42443");
  9. define("REGISTRY", "niver.test.");
  10. // Example IP adresses (for placeholders)
  11. define("IPV6_EXAMPLE", "2001:db8::3"); // See RFC3849: IPv6 Address Prefix Reserved for Documentation
  12. define("IPV4_EXAMPLE", "203.0.113.42"); // See RFC5737: IPv4 Address Blocks Reserved for Documentation
  13. define("DOMAIN_EXAMPLE", "example"); // From RFC2606: Reserved Top Level DNS Names > 2. TLDs for Testing, & Documentation Examples
  14. // Custom Niver paths
  15. define("PREFIX", ""); // Prefix in URL, if any
  16. define("ROOT_PATH", "/srv/php/niver" . PREFIX); // Niver's directory
  17. define("SERVICE", substr(dirname($_SERVER['PHP_SELF']), strlen(PREFIX) + 1));
  18. define("PAGE", basename($_SERVER['PHP_SELF'], '.php'));
  19. define("DB_PATH", ROOT_PATH . "/db/niver.db"); // Niver's SQLite database
  20. define("NIVER_TEMPLATE_PATH", "/usr/local/share/niver"); // Templates directory (nginx, knot...)
  21. define("MANIVER_PATH", "/usr/local/bin/maniver"); // Executable file
  22. define("HT_PATH", "/srv/ht"); // The mountpoint of the hypertext storage partition (that will be accessed over SFTP)
  23. // Nginx
  24. define("NGINX_CONFIG_PATH", "/etc/nginx/ht"); // Nginx configuration directory
  25. // Tor
  26. define("TOR_CONFIG_PATH", "/etc/tor/instances/niver/torrc"); // Tor configuration file
  27. define("TOR_KEYS_PATH", "/var/lib/tor-instances/niver/keys"); // Tor keys directory
  28. // Knot
  29. define("KNOT_ZONES_PATH", "/srv/ns"); // Knot zones directory
  30. // Executable files (you can get the full path of a command with $ which <command>)
  31. define("KNOTC_PATH", "/usr/sbin/knotc");
  32. define("KEYMGR_PATH", "/usr/sbin/keymgr");
  33. define("SUDO_PATH", "/usr/bin/sudo");
  34. define("LS_PATH", "/usr/bin/ls");
  35. // Both frontend and backend regexes
  36. define("USERNAME_REGEX", "^[a-z]{4,32}$");
  37. define("PASSWORD_REGEX", "^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])[a-zA-Z0-9]{8,1024}|.{10,1024}$");
  38. define("SUBDOMAIN_REGEX", "^[a-z]{4,63}$");
  39. // Password storage security
  40. define("ALGO_PASSWORD", PASSWORD_ARGON2ID);
  41. define("OPTIONS_PASSWORD", array(
  42. "memory_cost" => 65536,
  43. "time_cost" => 24,
  44. "threads" => 64,
  45. ));
  46. // Color scheme
  47. define("THEME", array(
  48. // Displayed on light theme
  49. 'darkRegColor' => "#D100D1",
  50. 'darkNsColor' => "#006DFF",
  51. 'darkHtColor' => "#008768",
  52. 'darkAuthColor' => "#EE0000",
  53. // Displayed on dark theme
  54. 'lightRegColor' => "#FF50FF",
  55. 'lightNsColor' => "#00FFFF",
  56. 'lightHtColor' => "#FFFF00",
  57. 'lightAuthColor' => "#00FF00",
  58. 'lightColor' => '#FFFFFF',
  59. 'darkColor' => '#000000',
  60. ));
  61. // Public suffixes
  62. define("SUFFIXES", array(
  63. REGISTRY,
  64. ));