diff --git a/README.md b/README.md index f72024d..30d39b5 100644 --- a/README.md +++ b/README.md @@ -1,125 +1,22 @@ # KISS Libre Hosting Panel Welcome in an actively developed keep-it-simple-and-stupid hosting panel designed for GNU/Linux operating systems. This software can be useful to serve everyday shared hosting services. This panel is designed to **respect the freedom** of its users. It works **without proprietary JavaScript**. To be honest, without **any line of JavaScript** in any form. This panel is designed to work without **any external dependency** not written by me. This allow fine-grained control over the software. It integrates with well-known and ultra-secure software packaged inside every GNU/Linux distribution in the world and used by millions of devices. -I would like to thank Giorgio Maone for his project NoScript, for the moral incentive, and Richard Stallman, for _The JavaScript Trap_ paper. +## More information -* https://www.gnu.org/philosophy/javascript-trap.html -* https://noscript.net/ - -## Disclaimer - -Do not try to become a system administrator if you do not like responsibilities, if you do not want to understand your infrastructure, if you do not want to have information security paranoia, etc. - -## Preamble - -An hosting panel is just the iceberg summit of a lot of technologies and protocols involved. Do not try to implement such project in production if you do not know what you are doing. You must gain confidence with the technologies involved. - -Papers: -* RFC 5321 - Simple Mail Transfer Protocol -* RFC 7208 - Sender Policy Framework (SPF) -* RFC 6376 - DomainKeys Identified Mail (DKIM) Signatures -* RFC 7489 - Domain-based Message Authentication, Reporting, and Conformance (DMARC) - -Software involved: -* Debian GNU/Linux stable (currently buster) -* MariaDB / MySQL -* Postfix -* Dovecot -* PureFTPd -* OpenDKIM -* Apache HTTP server / nginx -* PHP - -## Features - -Let me say that I love listening to the whishlist of my costumers. Here are the most important features/TODOs: - -- administration of own mailboxes (thanks to Postfix and Dovecot over MariaDB) - - [X] list - - [X] password reset - - [X] add - - [X] IMAP/SMTP documentation - - [ ] remove - - [ ] view quota -- administration of own mail aliases (thanks to Postfix and Dovecot over MariaDB) - - [X] list - - [X] change forward destination(s) - - [X] add - - [X] remove -- administration of own FTP accounts (thanks to Pure-FTPd over MariaDB) - - [X] list - - [X] add - - [X] remove - - [X] password reset -- [ ] administration of own MariaDB databases - - [ ] list own databases - - [ ] list own users - - [ ] change user password -- [ ] administration of User(s) - - [X] create - - [X] password reset - - [X] create a Domain for that User - - [ ] change login - - [ ] change e-mail -- plans - - [X] limit number of mailboxes per domain - - [X] limit number of mail forwardings -- action log - -## Installation - -Web interface: - -``` -git clone https://gitpull.it/source/boz-libre-hosting-panel.git -git clone https://gitpull.it/source/suckless-php.git -``` - -``` -# database -apt install mariadb-server - -# web server -apt install apache2 libjs-bootstrap certbot - -# FTP server -apt install pure-ftpd-mysql - -# mailserver -apt install postfix-mysql postfix-policyd-spf-python dovecot-mysql dovecot-imapd dovecot-pop3d spamassassin -``` - -## Why PHP7 - -This project is writted in PHP7 because: - -* Node.js is not an hypertext preprocessor -* Python is not an hypertext preprocessor -* Ruby is not an hypertext preprocessor -* Java is not an hypertext preprocessor. Well, Java JSP is an hypertext preprocessor but it's footprint is heavy as hell - -This PHP7 application is stateless. Does not have sessions. It's well-designed. It scales. It has a minimal memory footprint. If you do not like it, you are free to implement such project with your favorite programming language, with your 200MB of dependencies and crap. - -## Report a bug - -https://gitpull.it/tag/kiss_libre_hosting_panel/ - -## Report a feature - -https://gitpull.it/tag/kiss_libre_hosting_panel/ +https://gitpull.it/w/kiss_libre_hosting_panel/ ## License Copyright (C) 2018, 2019, 2020 [Valerio Bozzolan](https://boz.reyboz.it/) - KISS Libre Hosting Panel This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . diff --git a/cli/database-upgrade.php b/cli/database-upgrade.php index 640dc7a..4c09467 100755 --- a/cli/database-upgrade.php +++ b/cli/database-upgrade.php @@ -1,149 +1,149 @@ #!/usr/bin/php . /** * This is the script to upgrade the database * * It will execute the available database patches until the database * is to its latest version. * * To be honest, it also create the database schema if missing. */ require __DIR__ . '/../load.php'; echo <<limit( 1 ) ->queryRow(); } catch( Exception $e ) { $database_exists = false; } if( !$database_exists ) { // database schema installation echo "important tables are missing! assuming no database.\n"; echo "importing the schema for the first time\n"; execute_queries_from_file( "$documentation_path/schema.sql" ); // if we have not imported any database version, just set the latest one $version_exists = get_option( 'database_version', 0 ); if( !$version_exists ) { set_option( 'database_version', DATABASE_VERSION ); } } // get the current database version $current_database_version = get_option( 'database_version', 0 ); // notify about the current status printf( "current database version: %d\n", $current_database_version ); printf( "last database version: %d\n", DATABASE_VERSION ); // update to next database versions once at time while( $current_database_version < DATABASE_VERSION ) { $current_database_version++; // note that the patch name can have a name such as 0001-foo.sql $patch_name = sprintf( 'patch-%04d-*.sql', $current_database_version ); // path to the expected patch $patch_path = "$patch_directory/$patch_name"; // check if there is a database patch to be applied echo "looking for patch $patch_path\n"; $found = false; foreach( glob( $patch_path ) as $filename ) { execute_queries_from_file( $filename ); $found = true; } // actually the unexistence of a patch is good if( !$found ) { echo "\t skipped unexisting patch\n"; } // update the database version echo "\t increment database version to $current_database_version\n"; set_option( 'database_version', $current_database_version ); } echo "database upgrade end. good for you!\n"; /** * Execute some queries from a file * * @param string $file */ function execute_queries_from_file( $file ) { echo "\t executing queries from $file\n"; // get the patch content $queries = file_get_contents( $file ); // replace the database prefix with the current one $database_prefix = DB::instance()->getPrefix(); $queries = str_replace( '{$prefix}', $database_prefix, $queries ); // execute the patch queries (it will die in case of error) try { multiquery( $queries ); } catch( Exception $e ) { echo "\n"; printf( "ERROR:\n%s\n\n", $e->getMessage() ); printf( "DEBUG QUERIES:\n%s\n", $queries ); exit( 1 ); } } diff --git a/load-example.php b/load-example.php index 7fac38f..eed1217 100644 --- a/load-example.php +++ b/load-example.php @@ -1,67 +1,74 @@ . /* * This is an example configuration file * * Please fill this file and save as 'load.php'! */ -// database credentials -$username = 'insert here database username'; -$password = 'insert here database password'; -$database = 'insert here database name'; +// change these MySQL/MariaDB database credentials +$username = 'libre_hosting_panel'; +$database = 'libre_hosting_panel'; +$password = 'insert here a password'; + $location = 'localhost'; // database prefix (if any) -$prefix = ''; - -// your contact e-mail -define( 'CONTACT_EMAIL', 'services@example.org' ); +$prefix = 'librehost_'; // your SMTP credentials define( 'MAIL_FROM', 'noreply@example.org' ); define( 'SMTP_USERNAME', 'noreply@example.org' ); define( 'SMTP_PASSWORD', 'insert here smtp password' ); define( 'SMTP_AUTH', 'PLAIN' ); define( 'SMTP_TLS', true ); define( 'SMTP_SERVER', 'mail.example.org' ); define( 'SMTP_PORT', 465 ); -// absolute path to the project directory without trailing slash -define( 'ABSPATH', __DIR__ ); +// your contact e-mail +define( 'CONTACT_EMAIL', 'services@example.org' ); // absolute web directory without trailing slash +// if your URL is http://asd.org/hosting/ then set '/hosting' +// if your URL is http://asd.org/ then set '' define( 'ROOT', '' ); +// absolute path to the project directory without trailing slash +// this is rarely changed +define( 'ABSPATH', __DIR__ ); + // other specific configuration about your hosting environments $HOSTING_CONFIG = new stdClass(); -// Mailbox password encryption custom mechanism (you can leave this commented for the default) +// Mailbox password encryption custom mechanism +// you can leave this commented for the default- this is just an example. # $HOSTING_CONFIG->MAILBOX_ENCRYPT_PWD = function ( $password ) { # $salt = bin2hex( openssl_random_pseudo_bytes( 3 ) ); # return '{SHA512-CRYPT}' . crypt( $password, "$6$$salt" ); # }; -// FTP password encryption custom mechanism (you can leave this commented for the default) +// FTP password encryption custom mechanism +// you can leave this commented for the default. this is just an example. # $HOSTING_CONFIG->FTP_ENCRYPT_PWD = function ( $password ) { # $salt = bin2hex( openssl_random_pseudo_bytes( 3 ) ); # return '{SHA512-CRYPT}' . crypt( $password, "$6$$salt" ); # }; -// path to the boz-php framework -require '/usr/share/php/suckless-php/load.php'; +// customize your path to the suckess-php framework +// https://gitpull.it/source/suckless-php/ +require __DIR__ . '/../suckless-php/load.php';