nuy

OracleLinux9.4_en

OracleLinux9.4 ; SSH Remote connection , Firewalld , NTP Server

1. Setting up a remote connection via SSHSSH is a service for connecting remotely to a server and is basically running immediately after the OS is installed, but the default settings are somewhat insecure.Here we will configure the default settings to increase the security of SSH connections.1.1 SSH service configuration file changesThe SSH service configuration file is "/etc/ssh/sshd_config".2. Firewall (Firewalld) settingsIn Oracle, the firewall is firewalld configured by default and enabled during OS installation.To briefly explain "firewalld," when setting communication control policies, communication permission/blocking rules are applied to predefined zones, and these zones are then assigned to each NIC (network adapter).3. Remote connection from WindowsConfiguration in WindowsStart the setup for remote connection from Windows, using "Tera Term" as the terminal emulator.Start Tera Term, cancel the startup screen, and then select "New Connection" from "File" in the Tera Term menu.
OracleLinux9.4_en

OracleLinux9.4 ; OS INSTALL 、Initialization

OracleLinux9.4Oracle Linux provides a 100% application binary compatible alternative to Red Hat Enterprise Linux and CentOS Linux for both hybrid and multi-cloud environments.Since 2006, Oracle Linux has been completely free to download and use. Source code, binaries and updates are provided free of charge. It is freely redistributable. Free for use in production environments.We will proceed with the latest Oracle Linux 9.4 (released May 15, 2024).1.Oracle Linux9.4 DownloadDownload the Oracle Linux 9.4 installation image (OracleLinux-R9-U4-x86_64-dvd.iso ) from the following sitehttps://yum.oracle.com/oracle-linux-isos.html2.Oracle Linux 9.4 InstallInstall USB media, change BIOS settings to boot from USB media, and install.
Debian12.8_en

Debian12.8 ; OS installation and initial configuration

1.Debian12In this article, we will explain how to build a server with Debian, the basis of the user-friendly Linux distribution UBUNTU. The latest is Debian 12 (codenamed “bookworm”) (released on June 10, 2023), a point-release version of Debian 12.8 (released on November 9, 2024) with bug fixes and security updates.See below for Miscellaneous Bugfixes and Security Updates.https://www.debian.org/News/2024/20241109
Debian12.8_en

Debian12.8 ; SSH , UFW(Firewall)Setting

1. SSH Service Security SettingsThe SSH service allows the root user to log in by default, and since the root user already knows the user name and can log in to the server with administrative privileges once the password is known, we will deny this setting.1.1 Creating a General Userf you have created a general user when installing Debian, this procedure is not necessary.If the only user created on the server is root, remote login via SSH will not be possible, so if a user has not been created during OS installation, a user must be created in advance.Users can be created with the "useradd" command. The "-m" option creates a home directory and the "-p" option specifies the password.For example, to set "debianuser" as the user account name and "123456" as the password, execute the following2. Firewall SettingsSince Debian often uses software called "ufw" to configure firewalls, we will configure firewall settings using ufw.Since ufw is not installed when the OS is installed, the ufw package must be installed prior to configuration. The following is a procedure to configure minimal filter settings after installation.Filter rules to be set in ufw• All packets forwarded to the server are rejected• All packets sent from the server to the outside are allowed• The first port to allow is the port for SSH• Limit packets coming into the server
Debian12.8_en

Debian12.8 ; SSH connection using public key cryptography

Create a key pairCreate a public/private key pair for a user connecting to a Linux server using OpenSSH.Use ssh-keygen to create the key pair.The creation of a public/private key pair must be done as a user with remote login privileges.If you do not specify the destination and file name, id_ed25519 and id_ed25519.pub will be created in /home/(user name)/.ssh/. On the way, enter the password for the key.
Debian12.8_en

Debian12.8 ; FTP Server , NTP Server

1. Install a time synchronization service NTP server# apt -y install chrony# vi /etc/chrony/chrony.conf# Lines 20-23.:Comment the default settings and add the NTP server for your time zone.#pool ntp.ubuntu.com     iburst maxsources 4#pool 0.ubuntu.pool.ntp.org iburst maxsources 1#pool 1.ubuntu.pool.ntp.org iburst maxsources 1#pool 2.ubuntu.pool.ntp.org iburst maxsources 2
Debian12.8_en

Debian12.8 ; Anti-virus(Clamav) 、Mail Server

1.Antivirus software Clamav installedInstall Clam AntiVirus, a free anti-virus software for Linux, as an anti-virus measure.By installing this anti-virus software, you can not only scan the entire server for viruses, but also scan incoming and outgoing mail for viruses if you build and configure a mail server.2. Mail server installationPostfix was developed as a Mail Transport Agent (MTA) to replace sendmail, and is a mail server that is highly compatible with sendmail, secure, easy to maintain, and fast.In addition, since Postfix only functions as an SMTP server for sending mail, the POP server Dovecot for receiving mail will be installed separately in the latter half.3 Applied ClamAV to mail server PostfixSet up Postfix and Clamav to work together to scan incoming and outgoing mail in real time.4 Apply spam checks to the mail server4.1 Spam checking using spamassassin and procmail①spamassassin and procmail installation
Debian12.8_en

Debian12.8 ; WEB Server(Apache) , Digest authentication

Web server Apache2 installationAllow http:80 and https:443 ports in UFW before installation3.  Apache2; Using Perl ScriptsEnable CGI to make Perl scripts available①Install Perl4 Apache2 : Using PHP Scripts①Install PHP5. Virtual Host SettingsCopy the default configuration file (file name is arbitrary, in this case vhost-yourdomain.conf as an example) and configure the virtual host6. Digest authentication with Apache2Since Basic Authentication, a well-known authentication authorization method for http, sends authentication information in plain text, there is a risk of ID and password leakage if the packet is intercepted.On the other hand, Digest Authentication encrypts and transmits authentication information, so there is almost no risk of information leakage.
Debian12.8_en

Debian12.8 ; Let's Encrypt, WEB/Mail Server SSL

1. Obtain a certificate(Let's Encrypt)1.1 advance preparation1.Enable mod_ssl# a2enmod ssl2.Package management system Snappy installedLet's Encrypt's SSL certificate issuing tool "certbot" is recommended to be installed using "snap" after 2021, so install Snapd first.2. SSL/TLS (Let's Encrypt) configuration for Apache2①Edit Apache2 SSL-related configuration fileshoge.com-ssl in hoge.com-ssl.conf is an arbitrary name3. SSL/TLS (Let's Encrypt) settings on the mail server3.1 Obtaining a certificate for the mail serverObtain a certificate for the mail server, but it cannot be obtained in the same way as above, so the following with the "--standalone" option fails.
Debian12.8_en

Debian12.8 ; MariaDB , WordPress Install

1. MariaDB1.1 Install# apt install mariadb-serverMariaDB version confirmation# mariadb -Vmariadb Ver 15.1 Distrib 10.11.6-MariaDB, for debian-linux-gnu (x86_64) using EditLine wrapper1.2 MariaDB Server Security SettingsMariaDB comes with a default security script, mariadb-secure-installation, which can be used to improve the security of your MariaDB installation, includingSet a password for the root account (if necessary).Disable remote root login to the database.Delete anonymous user accounts.Delete the test database to which anonymous users have access by default.2.WordPress2.1 Database CreationCreate a database for Word Press (for example, in this case, the database name is "wp_db", the user name is "wp_user", and the password is "?Y123456y")
Debian12.8_en

Debian12.8 ; Suricata + Elastic Stack + Kibana

Debian12.8 ; Suricata + Elastic Stack + KibanaPrerequisite.We will install Suricata IDS and ElasticStack on the following servers・1st server Suricata IDS & Filebeat : Debian12.5 IP address (192.168.11.83)・2nd server ElasticStack & kibana : Ubunru22.04 IP address(192.168.11.100) 1st server Suricata InstallSURICATA IDS/IPS is an open source IDS that monitors communications on the network and detects suspicious traffic. Its basic mechanism is signature-based, so it can detect predefined unauthorized communications. Suricata is also characterized by its ability to provide protection as well as detection.
Debian12.8_en

Debian12.8 ; Nagios Server , Tripwire Install

Open source integrated monitoring software "Nagios Server" installedNagios is an open source monitoring solution running on Linux.Nagios is designed to periodically check critical network, application, or server parameters.These parameters include microprocessor load, number of running processes, log files, disk and memory usage, as well as many other services such as SMTP (Simple Mail Transfer Protocol), HTTP (Hypertext Transfer Protocol), POP3 (Post Office Protocol 3), etc. can be checked.These parameters require a microprocessor load, a database such as PHP or MySQL to run Nagois, and a web server such as Apache or Nginx. We will proceed under the assumption that all of these have already been configured
Debian12.8_en

Debian12.8 ; Logwatch , Chkrootkit , Disk Usage Check Script

LogwatchLogwatch compiles various logs together and delivers them as a report via email on a regular daily basis. This is a useful tool for detecting unauthorized access and problems and monitoring servers.Chkrootkitchkrootkit is a tool to detect the presence of rootkits.Note that chkrootkit is meaningless after it has already been tampered with, so consideration must be given when introducing it. In addition, chkrootkit has no function to automatically deal with a rootkit even if it detects it, so it must be dealt with manually after detection.
Debian12.8_en

Debian12.8 ; System Backup & Restore

1. System Backup1.1 Backup under /var/www/html① Create backup_all.sh script under /opt/script1.2 MariaDB database backup①Create db_backup.sh script under /opt/script# vi /opt/script/db_backup.shdb_backup.sh script contents2. System Restore2.1 Restore backup files under HTML① Store HTML backup files used for backup in the "/ (root)" directorySelect the backup file with the latest timestamp (e.g. www_back_20220501.tar.gz)2.2 Restore MariaDB database①Save DB backup file to any directory and extract data# cd /var/www/backup/db_bak
Debian12.5_en

Debian12.5 ; Logwatch , Chkrootkit , Disk Usage Check Script

Logwatch , Chkrootkit , Disk Usage Check Script