This page provides an overview of setting up and configuring various servers including LAMP, Email, NNTP, SVN, Git, and VPN. These servers can be integrated together to provide a full suite of services for web hosting, email communication, version control, and secure remote access.
The LAMP stack provides a robust environment for hosting dynamic websites and web applications. It includes:
To set up LAMP, install Apache, MariaDB or MySQL, and PHP on your server. Once configured, Apache will serve PHP-based websites, and MariaDB/MySQL will manage the database backend.
The Email server includes components like Postfix (for sending and receiving emails) and Dovecot (for retrieving emails). Together, these create a complete mail server. The setup will handle:
By configuring Postfix and Dovecot, you can create a reliable email system with authentication linked to an SQL database (such as MariaDB) to manage users and permissions.
The NNTP server allows you to provide newsgroups for users to access news articles. INN (InterNetNews) is a common NNTP server software. It is configured to use an SQL-based authentication system for managing access.
Using INN, you can provide a reliable NNTP service with news access and integrate authentication with a centralized SQL database.
SVN (Subversion) is a version control system that allows you to track changes to your codebase. An SVN server is typically used in collaborative software development environments.
The server is configured with Apache and integrates with a SQL database for user authentication. Users can commit changes, track versions, and roll back if needed, with full access control based on SQL table records.
Git is a distributed version control system widely used in modern software development. The Git server allows you to host repositories and collaborate on development projects.
To configure a Git server, you install Git on your server and configure repositories. User authentication and access control are managed through an SQL database, allowing fine-grained control over who can access and modify each repository.
A VPN (Virtual Private Network) allows secure remote access to a private network. OpenVPN and WireGuard are popular choices for setting up a VPN server.
Both VPN solutions provide secure access to internal resources and can be integrated with SQL-based user authentication for access control, ensuring only authorized users can connect to the network securely.
The services mentioned above can be integrated with a common SQL database (like MariaDB) to handle user authentication. This provides a unified and efficient method for managing user access across:
By setting up the LAMP stack, Email server, NNTP, SVN, Git, and VPN servers, you can create a comprehensive system for web hosting, communication, and secure access. Integrating these services with a central SQL database allows for consistent and manageable authentication across all services, ensuring a seamless user experience.
The LAMP stack consists of Linux, Apache, MySQL, and PHP. Follow the steps below to install each component:
sudo apt update
sudo apt install apache2
Enable Apache to start on boot:
sudo systemctl enable apache2
sudo apt install mysql-server
Secure MySQL installation:
sudo mysql_secure_installation
sudo apt install php libapache2-mod-php php-mysql
sudo systemctl restart apache2
Create a PHP info file to test if PHP is working:
echo "<?php phpinfo(); ?>" | sudo tee /var/www/html/info.php
Navigate to http://localhost/info.php to check the PHP info page.
sudo apt update
sudo apt install apache2
sudo apt install mysql-server
Secure MySQL installation:
sudo mysql_secure_installation
sudo apt install php libapache2-mod-php php-mysql
sudo systemctl restart apache2
echo "<?php phpinfo(); ?>" | sudo tee /var/www/html/info.php
Navigate to http://localhost/info.php to check the PHP info page.
In this setup, we'll configure access to the web page, email, SVN, and Git based on a single `users` table in MariaDB. Apache will use SQL to control access via `.htaccess`.
We will add a new column, `web_access`, to the `users` table to control web page access:
ALTER TABLE users
ADD COLUMN web_access BOOLEAN DEFAULT 1;
This new column will store a boolean value to allow or deny web page access for each user. The default value is set to `1` (access granted). To disable access, set it to `0`.
We need to configure Apache to use SQL for authentication. This will check the `web_access` field in the `users` table to determine if the user can access the web page.
First, ensure you have the necessary modules enabled in Apache:
sudo a2enmod auth_mysql
Now, edit the Apache configuration for your site:
sudo nano /etc/apache2/sites-available/000-default.conf
In the `
<Directory /var/www/html>
AuthType Basic
AuthName "Restricted Access"
AuthMySQLUser dbuser
AuthMySQLPassword dbpassword
AuthMySQLDB dbname
AuthMySQLUserTable users
AuthMySQLNameField username
AuthMySQLPasswordField password
AuthMySQLCryptMethod SHA-256
AuthMySQLCheckField web_access # Check web access field in the DB
Require valid-user
</Directory>
This configuration ensures that Apache uses the `web_access` field in the `users` table to allow or deny access to the web page. If `web_access` is `0`, access is denied.
Apache will use the following SQL query to check the `web_access` field:
# Create the necessary .htaccess authentication using MySQL
# /etc/apache2/apache2.conf or specific site configuration
AuthType Basic
AuthName "Restricted Area"
AuthMySQLUser dbuser
AuthMySQLPassword dbpassword
AuthMySQLDB dbname
AuthMySQLUserTable users
AuthMySQLNameField username
AuthMySQLPasswordField password
AuthMySQLCryptMethod SHA-256
AuthMySQLCheckField web_access
Require valid-user
This code will allow only users with `web_access` set to `1` in the database to log in. Users with `web_access` set to `0` will be denied access to the web page.
The following table structure will be used to manage user authentication and access control:
CREATE TABLE users (
username VARCHAR(50) PRIMARY KEY,
password VARCHAR(255),
full_name VARCHAR(100),
email VARCHAR(100),
physical_address TEXT,
web_access BOOLEAN DEFAULT 1, # New column to control web page access
mail_access BOOLEAN DEFAULT 1,
svn_access BOOLEAN DEFAULT 1,
git_access BOOLEAN DEFAULT 1
);
Make sure that user passwords are hashed using `SHA-256` or another secure hashing method. For example, you can hash the password in PHP:
$hashed_password = hash('sha256', 'password');
Once you've configured Apache and MariaDB, test the setup by trying to access your web page. If the user has `web_access` set to `1`, they will be prompted for authentication. If the user has `web_access` set to `0`, access will be denied.
This method can be applied to mail (Postfix/Dovecot), SVN, and Git access by modifying their respective configuration files (as shown in previous sections) to check the `mail_access`, `svn_access`, and `git_access` fields in the database before granting access. Apache will handle web page access, while the other services will handle mail, SVN, and Git access individually based on the same structure.
In this setup, we'll configure access to the web page, email, SVN, and Git based on a single `users` table in MariaDB. Apache will use SQL to control access via `.htaccess`.
We need to configure Apache to use SQL for authentication. This will check the `web_access` field in the `users` table to determine if the user can access the web page.
First, ensure you have the necessary modules enabled in Apache:
sudo a2enmod auth_mysql
Now, edit the Apache configuration for your site:
sudo nano /etc/apache2/sites-available/000-default.conf
In the <Directory> section, add the following configuration to enable SQL-based authentication:
<Directory /var/www/html>
AuthType Basic
AuthName "Restricted Access"
AuthMySQLUser dbuser
AuthMySQLPassword dbpassword
AuthMySQLDB dbname
AuthMySQLUserTable users
AuthMySQLNameField username
AuthMySQLPasswordField password
AuthMySQLCryptMethod SHA-256
AuthMySQLCheckField web_access # Check web access field in the DB
Require valid-user
</Directory>
This configuration ensures that Apache uses the `web_access` field in the `users` table to allow or deny access to the web page. If `web_access` is `0`, access is denied.
Apache will use the following SQL query to check the `web_access` field:
# Create the necessary .htaccess authentication using MySQL
# /etc/apache2/apache2.conf or specific site configuration
<Location "/">
AuthType Basic
AuthName "Restricted Area"
AuthMySQLUser dbuser
AuthMySQLPassword dbpassword
AuthMySQLDB dbname
AuthMySQLUserTable users
AuthMySQLNameField username
AuthMySQLPasswordField password
AuthMySQLCryptMethod SHA-256
AuthMySQLCheckField web_access
Require valid-user
</Location>
This code will allow only users with `web_access` set to `1` in the database to log in. Users with `web_access` set to `0` will be denied access to the web page.
The following table structure will be used to manage user authentication and access control:
CREATE TABLE users (
username VARCHAR(50) PRIMARY KEY,
password VARCHAR(255),
full_name VARCHAR(100),
email VARCHAR(100),
physical_address TEXT,
web_access BOOLEAN DEFAULT 1, # New column to control web page access
mail_access BOOLEAN DEFAULT 1,
svn_access BOOLEAN DEFAULT 1,
git_access BOOLEAN DEFAULT 1
);
Make sure that user passwords are hashed using `SHA-256` or another secure hashing method. For example, you can hash the password in PHP:
$hashed_password = hash('sha256', 'password');
Once you've configured Apache and MariaDB, test the setup by trying to access your web page. If the user has `web_access` set to `1`, they will be prompted for authentication. If the user has `web_access` set to `0`, access will be denied.
This method can be applied to mail (Postfix/Dovecot), SVN, and Git access by modifying their respective configuration files (as shown in previous sections) to check the `mail_access`, `svn_access`, and `git_access` fields in the database before granting access. Apache will handle web page access, while the other services will handle mail, SVN, and Git access individually based on the same structure.
To install Postfix on your system, run the following commands:
sudo apt-get update
sudo apt-get install postfix mysql-server postfix-mysql
During the installation, choose "Internet Site" for the type of mail server. Configure your system's mail name as necessary.
To install Dovecot, use the following commands:
sudo apt-get install dovecot-core dovecot-imapd dovecot-mysql
Postfix uses MySQL for authentication. To configure Postfix for SQL-based user authentication, follow these steps:
First, edit the main Postfix configuration file:
sudo nano /etc/postfix/main.cf
Then, add the following lines to configure Postfix to use MySQL for both sender and recipient checks:
smtpd_sender_login_maps = mysql:/etc/postfix/mysql-virtual-sender-login-maps.cf
smtpd_recipient_login_maps = mysql:/etc/postfix/mysql-virtual-recipient-login-maps.cf
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias-maps.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf
Now, create the following MySQL configuration files in the `/etc/postfix/` directory:
# /etc/postfix/mysql-virtual-sender-login-maps.cf
user = dbuser
password = dbpassword
hosts = 127.0.0.1
dbname = dbname
query = SELECT username FROM users WHERE username = '%s' AND mail_access = 1
# /etc/postfix/mysql-virtual-recipient-login-maps.cf
user = dbuser
password = dbpassword
hosts = 127.0.0.1
dbname = dbname
query = SELECT username FROM users WHERE username = '%s' AND mail_access = 1
# /etc/postfix/mysql-virtual-alias-maps.cf
user = dbuser
password = dbpassword
hosts = 127.0.0.1
dbname = dbname
query = SELECT destination FROM alias WHERE source = '%s'
# /etc/postfix/mysql-virtual-mailbox-maps.cf
user = dbuser
password = dbpassword
hosts = 127.0.0.1
dbname = dbname
query = SELECT email FROM users WHERE email = '%s' AND mail_access = 1
# /etc/postfix/mysql-virtual-mailbox-domains.cf
user = dbuser
password = dbpassword
hosts = 127.0.0.1
dbname = dbname
query = SELECT domain FROM domains WHERE domain = '%s'
After configuring these files, restart Postfix to apply the changes:
sudo systemctl restart postfix
Dovecot will use SQL for user authentication based on the users' email addresses stored in the database. Follow these steps to configure Dovecot:
Edit the Dovecot configuration file:
sudo nano /etc/dovecot/dovecot.conf
Add or ensure that the following lines are present in the configuration:
auth_sql {
user = dbuser
password = dbpassword
hosts = 127.0.0.1
dbname = dbname
query = SELECT password FROM users WHERE username = '%u' AND mail_access = 1
}
This configuration tells Dovecot to authenticate users using SQL by querying the `users` table. It will only authenticate users whose `mail_access` is set to `1` in the database.
Next, configure the Dovecot Mail Location for mail storage:
mail_location = maildir:/var/mail/vhosts/%d/%n/Maildir
Make sure to replace `/var/mail/vhosts/%d/%n/Maildir` with your desired mail storage path if different.
Finally, restart Dovecot to apply the changes:
sudo systemctl restart dovecot
To verify that the SQL-based authentication is working, test email access by attempting to send and receive mail for a user with `mail_access = 1`. Users with `mail_access = 0` should not be able to authenticate or use the mail system.
Test Postfix by sending a mail:
echo "Test message" | mail -s "Test Subject" testuser@example.com
Test Dovecot by connecting to the server using an IMAP client, logging in with a valid user (one with `mail_access = 1`), and confirming access.
First, install Roundcube, the webmail interface:
sudo apt-get update
sudo apt-get install roundcube roundcube-core roundcube-mysql roundcube-plugins
This will install Roundcube along with the necessary plugins and the MySQL backend.
We will configure Roundcube to use the **same MariaDB database** used by Dovecot and Postfix. This ensures that the same user authentication (username/password) is used for webmail access.
Edit the Roundcube configuration file:
sudo nano /etc/roundcube/config.inc.php
Now, modify the database connection settings to use the existing Dovecot/Postfix database. Replace `
// Database connection settings
$config['db_dsnw'] = 'mysql://:@localhost/';
// Authentication settings
$config['auth_type'] = 'sql';
$config['auth_sql_host'] = 'localhost';
$config['auth_sql_user'] = '';
$config['auth_sql_pass'] = '';
$config['auth_sql_db'] = '';
$config['auth_sql_user_table'] = 'users'; // The table storing user credentials
$config['auth_sql_username_field'] = 'username';
$config['auth_sql_password_field'] = 'password';
$config['auth_sql_check_password_query'] = 'SELECT password FROM users WHERE username = %u AND active = 1';
$config['auth_sql_host_field'] = 'localhost';
$config['auth_sql_active_field'] = 'active';
$config['auth_sql_default_host'] = 'localhost';
$config['auth_sql_default_port'] = 143;
In this configuration, Roundcube will use the **same users table** as Dovecot/Postfix for authentication. The `active` field is also checked to ensure the user is enabled for webmail access.
Ensure that Roundcube is configured to interact with Dovecot and Postfix for IMAP (mail retrieval) and SMTP (mail sending). In the same configuration file, check or modify the following settings:
$config['default_host'] = 'localhost'; // Dovecot IMAP server
$config['default_port'] = 143; // IMAP port
$config['imap_ssl'] = false; // Set to true if using SSL/TLS for IMAP
$config['smtp_server'] = 'localhost'; // Postfix SMTP server
$config['smtp_port'] = 25; // Postfix SMTP port
$config['smtp_ssl'] = false; // Set to true if using SSL/TLS for SMTP
$config['smtp_user'] = '%u'; // Use the same username for SMTP
$config['smtp_pass'] = '%p'; // Use the same password for SMTP
After updating the configuration file, restart Apache to apply the changes:
sudo systemctl restart apache2
Test the Roundcube installation by navigating to the webmail URL:
http://yourdomain.com/roundcube
Log in with the same credentials that are used for Dovecot and Postfix. You should be able to access the inbox, send, and receive emails via Roundcube.
If you haven't already, add users to the **same** database used by Dovecot/Postfix (e.g., MariaDB). Use the following SQL command to add users:
sudo mysql -u root -p
USE ;
INSERT INTO users (username, password, email, full_name, active)
VALUES ('newuser', PASSWORD('userpassword'), 'newuser@example.com', 'New User', 1);
FLUSH PRIVILEGES;
EXIT;
Make sure to populate the user information including email, full name, and set the `active` field to `1` to enable the user.
To disable access for a user, set the `active` field in the `users` table to `0`:
sudo mysql -u root -p
USE ;
UPDATE users SET active = 0 WHERE username = 'newuser';
FLUSH PRIVILEGES;
EXIT;
To enable the user again, set the `active` field to `1`.
To install Git and necessary components on your system, run the following commands:
sudo apt-get update
sudo apt-get install git-core apache2 libapache2-mod-auth-mysql mysql-server
This installs Git, Apache, and MySQL, which will be used to store user data for authentication.
Create a table to manage user access to Git repositories. The table should include `git_access`, `username`, and `password` fields to manage access:
CREATE TABLE git_users (
id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(255) NOT NULL,
password VARCHAR(255) NOT NULL,
git_access TINYINT(1) NOT NULL DEFAULT 0
);
The `git_access` field controls access, where `1` means access is allowed and `0` means no access.
Now, configure Apache to authenticate Git users via MySQL. Edit the Apache configuration file:
sudo nano /etc/apache2/sites-available/git.conf
Add the following configuration to enable MySQL authentication for Git access:
AuthType Basic
AuthName "Git Repository Access"
AuthBasicProvider mysql
AuthMySQLHost 127.0.0.1
AuthMySQLUser dbuser
AuthMySQLPassword dbpassword
AuthMySQLDB dbname
AuthMySQLUserTable git_users
AuthMySQLNameField username
AuthMySQLPasswordField password
Require valid-user
# Allow access only to users with git_access = 1
Require mysql_query "SELECT git_access FROM git_users WHERE username = '%{REMOTE_USER}' AND git_access = 1"
This configuration will check the `git_access` field in the database, and only users with `git_access = 1` will be able to authenticate and access the Git repository.
Next, create the Git repository directory and initialize it:
sudo mkdir -p /var/git/repositories/myrepo.git
sudo git init --bare /var/git/repositories/myrepo.git
Set the appropriate file and directory permissions:
sudo chown -R www-data:www-data /var/git/repositories/myrepo.git
Enable the necessary Apache modules and restart Apache to apply the changes:
sudo a2enmod auth_mysql
sudo a2ensite git.conf
sudo systemctl restart apache2
To test the SQL-based authentication for Git, attempt to clone the repository via HTTP:
git clone http://yourserver.com/git/repositories/myrepo.git
When prompted for a username and password, use credentials stored in the `git_users` table. Only users with `git_access = 1` will be able to authenticate and access the Git repository.
Ensure you have Git and GitWeb installed on your server:
sudo apt-get install gitweb apache2
Enable the necessary Apache modules:
sudo a2enmod cgi
Create an Apache configuration file for GitWeb:
sudo nano /etc/apache2/sites-available/gitweb.conf
In the configuration file, add the following to enable access to Git repositories via GitWeb:
<VirtualHost *:80>
ServerName git.example.com
DocumentRoot /usr/share/gitweb
# Enable authentication using the SQL database
AuthType Basic
AuthName "Git Repository"
AuthBasicProvider dbd
AuthDBDUserPWQuery "SELECT password FROM users WHERE username = %s AND active = 1"
Require valid-user
# Other optional settings
<Directory /usr/share/gitweb>
Options FollowSymLinks
AllowOverride None
</Directory>
# Enable CGI for GitWeb
ScriptAlias /cgi-bin/ /usr/lib/git-core/gitweb.cgi
</VirtualHost>
Once the configuration file is set up, enable the site and restart Apache:
sudo a2ensite gitweb.conf
sudo systemctl restart apache2
Now, you need to set up your Git repositories. You can create a directory to store the repositories:
sudo mkdir -p /var/www/git/repositories
Create a Git repository (replace <repo_name> with the desired name for your repository):
cd /var/www/git/repositories
sudo git init --bare <repo_name>.git
Change the ownership of the repository directory to the Apache user:
sudo chown -R www-data:www-data /var/www/git/repositories
To ensure that authentication can be handled via the SQL database, we need to make sure that PHP DBD module is enabled:
sudo apt-get install php-pdo php-sqlite php-mysqli
Ensure the DBD module for Apache is enabled as well:
sudo a2enmod dbd
Now, you can access the Git repository from the web browser. Open your browser and navigate to:
http://git.example.com
You should be prompted for a username and password. Enter the credentials stored in your SQL database. If the user exists and is active (with the `active` field set to `1`), the login should be successful, and you will be granted access to the Git repository.
To manage users, use the same SQL table that was used for Postfix, Dovecot, SVN, and others. To add a new user or disable a user’s access to Git, you can update the database:
sudo mysql -u root -p
USE <database_name>;
INSERT INTO users (username, password, email, full_name, active)
VALUES ('gituser', PASSWORD('gitpassword'), 'gituser@example.com', 'Git User', 1);
FLUSH PRIVILEGES;
EXIT;
To disable access for a user:
sudo mysql -u root -p
USE <database_name>;
UPDATE users SET active = 0 WHERE username = 'gituser';
FLUSH PRIVILEGES;
EXIT;
Ensure the `active` field is `1` to enable access and `0` to disable access to Git.
To install SVN on your system, run the following commands:
sudo apt-get update
sudo apt-get install subversion libapache2-mod-svn apache2 mysql-server libapache2-mod-auth-mysql
This installs the necessary SVN packages and the Apache module to serve the SVN repository over HTTP.
We will set up SVN authentication through MySQL. The user database should include a `svn_access` field that indicates whether a user has access to the SVN repository.
Create a table to manage user access to SVN. This SQL example assumes the `users` table already has `username`, `password`, and `svn_access` fields:
CREATE TABLE svn_users (
id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(255) NOT NULL,
password VARCHAR(255) NOT NULL,
svn_access TINYINT(1) NOT NULL DEFAULT 0
);
The `svn_access` field controls access, with `1` indicating access is granted and `0` meaning no access.
Now, we need to configure Apache to use MySQL for authentication. Edit the SVN Apache configuration file:
sudo nano /etc/apache2/mods-available/dav_svn.conf
Add the following configuration lines to enable MySQL authentication for SVN access:
AuthType Basic
AuthName "Subversion Repository"
AuthBasicProvider mysql
AuthMySQLHost 127.0.0.1
AuthMySQLUser dbuser
AuthMySQLPassword dbpassword
AuthMySQLDB dbname
AuthMySQLUserTable svn_users
AuthMySQLNameField username
AuthMySQLPasswordField password
Require valid-user
# Allow access only to users with svn_access = 1
Require mysql_query "SELECT svn_access FROM svn_users WHERE username = '%{REMOTE_USER}' AND svn_access = 1"
This configuration uses MySQL authentication and only allows users with `svn_access = 1` to authenticate.
Next, create your SVN repository directory and initialize it:
sudo svnadmin create /var/svn/repository
Ensure proper file and directory permissions:
sudo chown -R www-data:www-data /var/svn/repository
Enable the necessary Apache modules and restart Apache to apply the changes:
sudo a2enmod dav_svn
sudo a2enmod auth_mysql
sudo systemctl restart apache2
To verify that the SQL-based authentication is working, try accessing the SVN repository through a web browser or SVN client. When prompted for a username and password, provide credentials that are stored in the `svn_users` table.
For example, run the following SVN command:
svn checkout http://yourserver.com/svn/repository /path/to/checkout
Users with `svn_access = 1` will be granted access, while users with `svn_access = 0` will be denied access.
To install NNTP (using the `inn` package) and necessary components, run the following commands:
sudo apt-get update
sudo apt-get install inn2 apache2 mysql-server libapache2-mod-auth-mysql
This installs the NNTP server (INN), Apache, MySQL, and the MySQL authentication module for Apache.
Create a table to manage user access to NNTP. The table will store `nntp_access`, `username`, and `password` fields to control access:
CREATE TABLE nntp_users (
id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(255) NOT NULL,
password VARCHAR(255) NOT NULL,
nntp_access TINYINT(1) NOT NULL DEFAULT 0
);
The `nntp_access` field controls access, with `1` meaning access is allowed and `0` meaning no access.
Now, configure Apache to authenticate NNTP users via MySQL. Edit the Apache configuration file:
sudo nano /etc/apache2/sites-available/nntp.conf
Add the following configuration to enable MySQL authentication for NNTP access:
AuthType Basic
AuthName "NNTP News Server"
AuthBasicProvider mysql
AuthMySQLHost 127.0.0.1
AuthMySQLUser dbuser
AuthMySQLPassword dbpassword
AuthMySQLDB dbname
AuthMySQLUserTable nntp_users
AuthMySQLNameField username
AuthMySQLPasswordField password
Require valid-user
# Allow access only to users with nntp_access = 1
Require mysql_query "SELECT nntp_access FROM nntp_users WHERE username = '%{REMOTE_USER}' AND nntp_access = 1"
This configuration checks the `nntp_access` field in the database, and only users with `nntp_access = 1` will be able to access the NNTP server.
Next, configure the INN (NNTP) server. Edit the configuration file for INN:
sudo nano /etc/news/inn.conf
Ensure that the INN server is configured to use the appropriate directories for articles, and enable necessary modules for authentication:
# Set the path to the news articles directory
path_to_articles "/var/spool/news"
# Enable MySQL authentication for NNTP
auth_method "authmysql"
auth_mysql_host "127.0.0.1"
auth_mysql_user "dbuser"
auth_mysql_password "dbpassword"
auth_mysql_db "dbname"
auth_mysql_user_table "nntp_users"
auth_mysql_name_field "username"
auth_mysql_password_field "password"
auth_mysql_access_field "nntp_access"
This configures INN to authenticate users via MySQL and to check the `nntp_access` field to allow or deny access.
Enable the necessary Apache modules and restart Apache to apply the changes:
sudo a2enmod auth_mysql
sudo a2ensite nntp.conf
sudo systemctl restart apache2
Also, restart the INN (NNTP) service to apply the configuration:
sudo systemctl restart inn2
To test the SQL-based authentication for NNTP, try connecting to the server using an NNTP client or using telnet:
telnet yourserver.com 119
You should be prompted for a username and password. Only users with `nntp_access = 1` in the `nntp_users` table will be able to access the NNTP server.
Install a **web-based NNTP client** such as **phpNNTP** for accessing the NNTP server via a browser:
sudo apt-get install php-phpnntp
sudo apt-get install apache2
Enable the necessary Apache modules:
sudo a2enmod cgi
Now configure Apache for web-based NNTP access:
sudo nano /etc/apache2/sites-available/nntp.conf
In the configuration file, add the following to allow access to the NNTP service:
ServerName nntp.example.com
DocumentRoot /usr/share/phpnntp
# Enable authentication using the SQL database
AuthType Basic
AuthName "NNTP Access"
AuthBasicProvider dbd
AuthDBDUserPWQuery "SELECT password FROM users WHERE username = %s AND active = 1"
Require valid-user
# Other optional settings
Options FollowSymLinks
AllowOverride None
Replace `
Enable the Apache site configuration and restart Apache to apply the changes:
sudo a2ensite nntp.conf
sudo systemctl restart apache2
Now, you can test the web-based NNTP access. Open your browser and navigate to:
http://nntp.example.com
You should be prompted for a username and password. Enter the credentials stored in your SQL database. If the user exists and is active (with the `active` field set to `1`), the login should be successful and you will be granted access to the NNTP service.
To manage users, use the same **SQL table** that was used for **Postfix**, **Dovecot**, **SVN**, **Git**, and other services. To add a new user or disable a user’s access to NNTP, you can update the database:
sudo mysql -u root -p
USE ;
INSERT INTO users (username, password, email, full_name, active)
VALUES ('nntpuser', PASSWORD('nntppassword'), 'nntpuser@example.com', 'NNTP User', 1);
FLUSH PRIVILEGES;
EXIT;
To disable access for a user:
sudo mysql -u root -p
USE ;
UPDATE users SET active = 0 WHERE username = 'nntpuser';
FLUSH PRIVILEGES;
EXIT;
Ensure the `active` field is `1` to enable access and `0` to disable access to NNTP.
This guide walks you through the installation of Mail2News and News2Mail, which provide the ability to relay emails to newsgroups (via Mail2News) and newsgroup posts to email (via News2Mail). These tools are useful for syncing emails with newsgroups for easier access.
Mail2News is used to forward emails to an NNTP (Newsgroup) server. It takes incoming emails and posts them to newsgroups.
sudo apt-get install perl libmail-sendmail-perl libnet-nntp-perlwget http://example.com/mail2news.tar.gzReplace `http://example.com/mail2news.tar.gz` with the actual URL for the Mail2News package.tar -xvzf mail2news.tar.gzcd mail2news
nano mail2news.confUpdate the configuration file with the following details:
crontab -e
*/5 * * * * /path/to/mail2news/mail2news.plNews2Mail is used to forward newsgroup posts to an email address. If News2Mail exists and is available for installation, follow the steps below.
sudo apt-get install perl libmail-sendmail-perl libnet-nntp-perlwget http://example.com/news2mail.tar.gzReplace `http://example.com/news2mail.tar.gz` with the actual download URL for News2Mail.tar -xvzf news2mail.tar.gzcd news2mail
nano news2mail.confUpdate the configuration file with the following details:
crontab -e
*/5 * * * * /path/to/news2mail/news2mail.plAfter completing the installation and configuration for Mail2News and News2Mail, you should test the system to ensure that emails are successfully forwarded to newsgroups and newsgroup posts are forwarded to email addresses.
Both Mail2News and News2Mail are powerful tools for bridging the gap between email systems and newsgroups. With correct configuration, they can enable easy communication between users across both systems.
This guide walks you through the process of setting up an IRC (Internet Relay Chat) server and an IRC-to-News bridge, which enables communication between IRC and newsgroups. This bridge allows users to post messages on IRC and have them appear in newsgroups, and vice versa.
IRC is a protocol used for real-time text messaging. Setting up an IRC server allows users to connect and chat in channels. Below is the installation process for setting up an IRC server.
sudo apt-get update
sudo apt-get install unrealircdsudo nano /etc/unrealircd/unrealircd.confsudo systemctl start unrealircdsudo systemctl enable unrealircdEdit the configuration file to enable SQL-based authentication:
sudo nano unrealircd.conf
Add the following section to authenticate users from the users table in MariaDB:
loadmodule "third/mysql";
mysql {
hostname "localhost";
username "irc_user";
password "yourpassword";
database "authentication_db";
port 3306;
}
auth {
mysql {
query "SELECT username, password FROM users WHERE username='$1' AND irc_access=1";
user_field 1;
password_field 2;
encryption "md5"; // Adjust encryption method if needed
};
};
An IRC-to-News Bridge allows messages sent in IRC channels to be relayed to newsgroups and vice versa. This integration connects two different communication protocols: IRC and NNTP (Network News Transfer Protocol).
wget http://example.com/news2irc.tar.gzReplace `http://example.com/news2irc.tar.gz` with the actual link to News2IRC.tar -xvzf news2irc.tar.gzcd news2irc
nano config.confIn the configuration file, define:
perl news2irc.plcrontab -e
*/5 * * * * /path/to/news2irc/news2irc.plThis guide walks you through the process of setting up an IRC to Web Bridge, which allows communication between IRC channels and a web-based interface. This setup uses an Apache Web Server to display IRC messages in a web browser, providing a seamless way for web users to interact with an IRC channel.
Before proceeding, ensure the following prerequisites are met:
The bridge will allow IRC messages to be relayed and displayed on a web page, enabling users to chat via a web browser.
We will use The Lounge, a web-based IRC client, to bridge IRC to the web. Install The Lounge on your server.
sudo apt-get update
sudo apt-get install nodejs npmsudo npm install -g theloungethelounge startNow, we will configure Apache Web Server to serve the web interface for The Lounge IRC client.
sudo a2enmod proxy proxy_http rewritesudo nano /etc/apache2/sites-available/irc-web.confAdd the following configuration:
<VirtualHost *:80>
ServerName irc.example.com
ProxyPass /ws ws://localhost:9000/
ProxyPassReverse /ws ws://localhost:9000/
DocumentRoot /var/www/html
</VirtualHost>Replace `irc.example.com` with your actual domain name, and ensure that The Lounge is running on `localhost:9000`.sudo a2ensite irc-web.confsudo systemctl restart apache2Now that everything is set up, you can access The Lounge web client via your web browser:
By following this guide, you’ve successfully set up an IRC-to-Web bridge using Apache Web Server and The Lounge IRC client. This setup allows you to view and interact with IRC messages directly in a web browser, providing a simple interface for web users to participate in IRC chats.
Filename: tux.svg
Description: Tux is the official Linux mascot — a friendly cartoon penguin designed to represent the open-source spirit of Linux. It features a black and white penguin with yellow feet and beak, usually shown sitting and smiling cheerfully.
By Larry Ewing, Simon Budig, Garrett LeSage - https://isc.tamu.edu/~lewing/linux/, http://www.home.unix-ag.org/simon/penguin/, garrett/Tux on GitHub, CC0, Link