OpenLDAP list all loaded schemas

- Posted in Linux by

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

Access to Linux Samba guest share from Windows 11 with guest account

- Posted in Windows by

To access to Linux a Samba guest share from Windows 11, ]the guest access has to be enabled by executing the following commands in PowerShell.

Set-SmbClientConfiguration -RequireSecuritySignature $false
Set-SmbClientConfiguration -EnableInsecureGuestLogons $true

The Linux Samba guest share is a share configured with guest only = Yes and guest ok = Yes. In the example below the access to the guest share is restricted by hosts allow = xxx.xxx.xxx.xxx and hosts deny = 0.0.0.0/0.

[public]
    path = /shares/public
    force group = public
    read only = No
    create mask = 0660
    directory mask = 0770
    **guest only = Yes
    guest ok = Yes**
    hosts allow = xxx.xxx.xxx.xxx
    hosts deny = 0.0.0.0/0

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.

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