Linux

Linux

OpenLDAP list all loaded schemas

- Posted in Linux by

ldapsearch -H ldapi:/// -Y EXTERNAL -b "cn=schema,cn=config" -LLL dn

Linux Reset the display of strange characters after opening a binary file

- Posted in Linux by

In Linux to reset the display of strange characters after opening a binary file with cat or less commands, just execute the command reset, this resets the character maps and clears the screen.

Are you using Quad9 DNS

- Posted in Linux by

to check if you are using Quad9 DNS (primary DNS: 9.9.9.9, secondary DNS: 149.112.112.112), just visit this url from Quad9: https://on.quad9.net/.

Linux block incomming Tor connection

- Posted in Linux by

This posts explains how to block incoming tor connection using iptables and ipset. The first step is to obtain the tor exit nodes list, it could be downloaded from the https://opendbl.net/.

wget https://opendbl.net/lists/tor-exit.list

The second step is to install ipset and ipset-persistent packages and create an ipset list named torlist in which the tor exit nodes will be inserted using a small bash script.

apt install ipset ipset-persistent
ipset create torlist hash:ip

This script read list downloaded line by line check the validity of each IP address and insert it in the ipset list torlist that has been just created., finally the ipset list is saved in the file /etc/iptables/ipsets.

#!/bin/bash

while IFS= read -r ip; do

    [[ -z "$ip" || "$ip" =~ ^# || "$ip" ! =~  ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]] && continue

    ipset add torlist $ip -exist

done < "tor-exit.list"

ipset save > /etc/iptables/ipsets

The last step is to create an INPUT iptables rule placed as the first rule to drop the incoming Tor connections.

iptables -I INPUT 1 -m set --match-set torlist src -j DROP
iptables-save > /etc/iptables/rules.v4

Hardening Apache HTTP Server

- Posted in Linux by

Remove server version banner

The default configuration will expose Apache Version and OS type, to prevent it change the ServerTokens to Prod and ServerSignature to Off in the Apache configuration file /etc/apache2/apache2.conf.

sudo nano /etc/apache2/apache2.conf
ServerTokens Prod
ServerSignature Off
curl --head https://technicalnode.ddns.net
HTTP/1.0 500 Only GET and POST are supported
Date: Tue, 14 Jul 2026 01:05:48 GMT
Server: Apache
Set-Cookie: PHPSESSID=fq5ah1kg03f0p391lrooi04cpt; path=/; SameSite=strict
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Connection: close
Content-Type: text/html; charset=UTF-8

Enable HTTP Strict Transport Security (HSTS) for Apache

sudo a2enmod headers
nano /etc/apache2/sites-available/000-default-ssl.conf
<VirtualHost *:443>
        Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
</VirtualHost>

Enable HTTP/2

sudo apt install php8.3-fpm
sudo a2enconf php8.3-fpm
sudo a2dismod mpm_prefork
sudo a2enmod mpm_event
sudo a2enmod http2
/etc/apache2/mods-available/http2.conf
Protocols h2 h2c http/1.1