SSH pos-quantum config

 

On the SSH Server

1. Check OpenSSH version (requires OpenSSH 9.0+):

ssh -V

2. Edit SSH server configuration:

Edit /etc/ssh/sshd_config or create /etc/ssh/sshd_config.d/post-quantum.conf:

# Enable post-quantum key exchange algorithms
KexAlgorithms sntrup761x25519-sha512@openssh.com,curve25519-sha256,curve25519-sha256@libssh.org,
ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,
diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256

Note: sntrup761x25519-sha512@openssh.com is listed first, providing post-quantum security while maintaining backward compatibility.

3. Restart SSH service:

# Debian/Ubuntu
sudo systemctl restart sshd

# RHEL/CentOS/Rocky
sudo systemctl restart sshd

# Verify configuration is valid before restarting
sudo sshd -t

On the SSH Client (Optional)

You can also configure your client to prefer post-quantum algorithms:

Edit ~/.ssh/config:

Host *
    KexAlgorithms sntrup761x25519-sha512@openssh.com,curve25519-sha256,curve25519-sha256@libssh.org

Verification

Test the Connection

After configuration, test your SSH connection:

ssh -v user@hostname 2>&1 | grep "kex:"

Look for output like:

debug1: kex: algorithm: sntrup761x25519-sha512@openssh.com

Verify Key Exchange Algorithm

Connect and check which algorithm is being used:

ssh -o LogLevel=DEBUG user@hostname 2>&1 | grep "kex: algorithm"

Habilitar log LDAP

 

O Event ID 2889 (do log Directory Service no Windows Server / Active Directory) registra tentativas de autenticação/associação 
(bind) LDAP não assinada contra um Controlador de Domínio (DC). Ele serve para identificar clientes, aplicações ou serviços que fazem conexões 
LDAP inseguras (sem assinatura SASL ou sem SSL/TLS em simple binds), ajudando a migrar o ambiente para LDAP Signing sem quebrar 

1. No registro do Controlador de Domínio, acesse HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics.
2. Defina o valor 16 LDAP Interface Events (DWORD) como 2 (Básico). 

Obter certificado do servidor para LDAPS no Linux

 Pegar certificado LDAPS:

1. Conecte-se ao servidor com openssl s_client

ex: openssl s_client -connect ldap.example.com:636 -showcerts

Isso pegará o cert sendo servido.

Salve isso em um arquivo

2. use openssl para inspecionar o cert

openssl x509 -noout -text -in nome_do_arquivo

testar conexão:
ldapsearch -H ldap://nome_servidor.example:389 -ZZ -x -D "cn=usuario,ou=nome,dc=example,dc=gov" -W -b "dc=example,dc=gov"

testar sem certificado
LDAPTLS_REQCERT=never ldapsearch -H ldap://nome_servidor.example:389 -ZZ -x -D "cn=usuario,ou=nome,dc=example,dc=gov" -W -b "dc=example,dc=gov"

 

- copiar certificado para store do sistema:
cp server.crt /usr/local/share/ca-certificates
update-ca-certificates

fonte: https://www.reddit.com/r/sysadmin/comments/1wibqqy/enabling_ldaps_from_linux_host_to_active/

Corrigir erro NATS no Segura

 

### erro Nats

orbit nats stop
orbit nats setup
orbit services reload
orbit nats stream reload
orbit services restart all
ls -lh /var/orbini/system/incdt/

ESXi enable remote syslog

 

esxcli system syslog config set --loghost=udp://10.20.0.27:514

esxcli network firewall ruleset set --ruleset-id=syslog --enabled=true 

esxcli network firewall refresh

esxcli system syslog reload

How to Install PHP 8.3 on Ubuntu 26.04, 24.04 and 22.04

 importar chave repo

sudo apt install -y ca-certificates curl
sudo curl -fsSLo /usr/share/keyrings/deb.sury.org-php.gpg https://packages.sury.org/php/apt.gpg

criar arquivo do repo - copiar texto a seguir, colar e executar no terminal

. /etc/os-release
ARCH="$(dpkg --print-architecture)"

case "$VERSION_CODENAME:$ARCH" in
  resolute:amd64|resolute:arm64|noble:amd64|noble:arm64|noble:armhf|jammy:amd64|jammy:arm64|jammy:armhf)
    printf '%s\n' \
      'Types: deb' \
      'URIs: https://packages.sury.org/php/' \
      "Suites: $VERSION_CODENAME" \
      'Components: main' \
      "Architectures: $ARCH" \
      'Signed-By: /usr/share/keyrings/deb.sury.org-php.gpg' | sudo tee /etc/apt/sources.list.d/php.sources > /dev/null
    ;;
  *)
    printf 'This PHP 8.3 workflow covers Ubuntu 26.04 on amd64/arm64 and Ubuntu 24.04/22.04 on amd64/arm64/armhf; this host reports %s/%s.\n' "$VERSION_CODENAME" "$ARCH" >&2
    false
    ;;
esac



apt update

apt upgrade -y


source: https://linuxcapable.com/how-to-install-php-8-3-on-ubuntu-linux/

Ubuntu 24.04 PHP OCI8 error

 

As oci8.so still expecting libaio.so.1, creating the following symlink resolves the issue:

ln -s /usr/lib/x86_64-linux-gnu/libaio.so.1t64 /usr/lib/x86_64-linux-gnu/libaio.so.1

Veeam NFS error

 ver processo porta 111

Get-Process -Id (Get-NetTCPConnection -LocalPort 111).OwningProcess

taskkill /f /pid <pid>


iniciar serviço veeam vpower nfs: 

net start VeeamNFSSvc

conferir o novo processo na porta 111

Get-Process -Id (Get-NetTCPConnection -LocalPort 111).OwningProcess



Apache get real IP from NGINX proxy

 

Apache get real IP from NGINX proxy 

nginx: 

set_real_ip_from 0.0.0.0/0;
real_ip_header X-Forwarded-For;
real_ip_recursive on;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;

service nginx reload

##################################
apache2:

a2enconf remoteip
a2enmod remoteip

pico /etc/apache2/conf-available/remoteip.conf
 

add:
RemoteIPHeader X-Forwarded-For
RemoteIPInternalProxy <IP_NGINX>


service apache2 restart

Controle de acesso SSH com hosts.deny e hosts.allow

 

Faça login na sua máquina Linux e abra uma janela de terminal. Primeiro, vamos negar todo o acesso ao daemon SSH. Abra o arquivo hosts.deny com o comando 

sudo nano /etc/hosts.deny

No final desse arquivo, adicione:

sshd: ALL

Salve e feche o arquivo.

Em seguida, abra o arquivo hosts.allow com o comando

sudo nano /etc/hosts.allow

 Digamos que você queira permitir acesso SSH apenas para duas máquinas em sua rede, nos endereços IP 192.168.1.62 e 192.168.1.152. Para isso, adicione a linha:

sshd: 192.168.1.62, 192.168.1.152

Salve e feche o arquivo.

Nesse ponto, apenas essas duas máquinas têm permissão para acessar seu computador ou servidor via SSH. Lembre-se de que o arquivo hosts.deny é lido antes do hosts.allow, portanto, definir sshd: ALL em hosts.deny só é anulado se houver uma entrada em hosts.allow. 

Enable WinRM Windwos server 2025

 Run in CMD

WinRM with TLS/SSL 

winrm quickconfig -transport:https -force -quiet

 

Basic authentication

winrm set winrm/config/service/auth @{Basic="true"}

Remove computer from Azure Arc

  

To fully remove a computer from Azure Arc-enabled servers, follow the official steps in the Uninstall the Azure Connected Machine agent guide to clear extensions, disconnect the agent, and remove the local software.

1. Remove VM Extensions

  • Open the Azure portal.

  • Go to Azure Arc and select Machines.

  • Click your target server, go to Extensions, select any installed extensions, and click Uninstall.

2. Disconnect the Agent from the Server

  • Open an administrative command prompt on the physical or virtual machine.

  • Run the following command to disconnect the agent and delete the Azure resource representation:

    bash

    azcmagent disconnect

  • Sign in with your Azure account when prompted.
    (Note: If the Azure resource was already deleted manually in the portal, run
    azcmagent disconnect --force-local-only instead).

3. Uninstall the Agent Software

  • Windows: Open Control Panel > Programs and Features, select Azure Connected Machine Agent, and click Uninstall.

  • Linux: Use your package manager (e.g.,

  • sudo apt purge azcmagent or sudo yum remove azcmagent).

  • Manually delete leftover configuration folders if needed, such as C:\Program Files\AzureConnectedMachineAgent on Windows.


NGINX as a load balancer for WebSocket

 

To configure NGINX as a secure load balancer for WebSocket (wss://) connections,use an HTTP upgrade map, increase connection timeouts, and configure SSL termination. 
Complete NGINX Configuration Example
Add this configuration inside your nginx.conf or site configuration file:
nginx
http {
    # Map dynamic connection upgrade headers
    map $http_upgrade $connection_upgrade {
        default upgrade;
        ''      close;
    }

    upstream websocket_backend {
        ip_hash; # Ensures sticky sessions for client connections
        server ://example.com;
        server ://example.com;
    }

    server {
        listen 443 ssl;
        server_name yourdomain.com;

        # SSL/TLS Certificates for WSS termination
        ssl_certificate /path/to/fullchain.pem;
        ssl_certificate_key /path/to/privkey.pem;

        location / {
            proxy_pass http://websocket_backend;
            
            # Required for WebSocket handshake
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection $connection_upgrade;
            
            # Standard proxy headers
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;

            # Prevent idle timeouts from dropping long-lived connections (set to 24 hours)
            proxy_read_timeout 86400s;
            proxy_send_timeout 86400s;
            
            # Disable buffering for real-time data streaming
            proxy_buffering off;
        }
    }

    # Optional: Redirect HTTP to HTTPS
    server {
        listen 80;
        server_name yourdomain.com;
        return 301 https://$host$request_uri;
    }
}

Apt only upgrade selected packages

 apt list --upgradable | cut -d"/" -f1 > /tmp/apt

pico /tmp/apt

cat /tmp/apt | tr "\n" " "

apt install --only-upgrade <list_of_packages>

Configuring Static Routes with ip commands

As a system administrator, you can configure static routes using the ip route command.
To display the IP routing table, use the ip route command. For example:
~]$ ip route
default via 192.168.122.1 dev ens9  proto static  metric 1024
192.168.122.0/24 dev ens9  proto kernel  scope link  src 192.168.122.107
192.168.122.0/24 dev enp1s0  proto kernel  scope link  src 192.168.122.126
The ip route commands take the following form:
ip route [ add | del | change | append | replace ] destination-address
See the ip-route(8) man page for more details on the options and formats. 
 
To add a static route to a host address, in other words to a single IP address:
~]# ip route add 192.0.2.1 via 10.0.0.1 [dev interface]
where 192.0.2.1 is the IP address of the host in dotted decimal notation, 10.0.0.1 is the next hop address and interface is the exit interface leading to the next hop. 
 
To add a static route to a network, in other words to an IP address representing a range of IP addresses:
~]# ip route add 192.0.2.0/24 via 10.0.0.1 [dev interface]
where 192.0.2.0 is the IP address of the destination network in dotted decimal notation and /24 is the network prefix. The network prefix is the number of enabled bits in the subnet mask. This format of network address slash network prefix length is sometimes referred to as classless inter-domain routing (CIDR) notation.
To remove the assigned static route:
~]# ip route del 192.0.2.1

Check point block a single IP address

 

Using Suspicious Activity Monitoring (SAM)
  1. Connect to the firewall via SSH and log into Expert mode:
    expert
    
  2. Run the fw sam command to block traffic to and from the target IP:
    fw sam -t 0 -b -s <IP_Address>
    • -t 0 sets the timeout (0 means indefinite, or specify seconds like -t 3600 for 1 hour).
    • -b blocks both source and destination directions.
    • -s specifies the source IP address to block. [1]
Alternatively, for high-performance accelerated drops using SecureXL, you can use the fwaccel dos deny utility: [1]
fwaccel dos deny -a <IP_Address>
 
 
fw samp block -d <IP-Address> -u <Unique-Name>
fw samp unblock -u block_bad_ip
 
 

Useful Check Point Commands

 

Useful Check Point Commands

Table 1. Useful CP Commands
Command Description
cpconfig change SIC, licenses and more
cpview -t show top style performance counters
cphaprob stat list the state of the high availability cluster members. Should show active and standby devices.
cphaprob -a if display status of monitored interfaces in a cluster
cphaprob -l list display registered cluster devices and status
cphaprob syncstat display sync transport layer statistics
cphaprob ldstat display sync serialization statistics
cphastop stop a cluster member from passing traffic. Stops synchronization. (emergency only)
clusterXL_admin down –p disable this node from cluster membership
cphaconf cluster_id get get cluster Global ID membership
cphaconf set_ccp broadcast/multicast set cluster mode
cplic print license information
cpstart start all checkpoint services
cpstat fw show policy name, policy install time and interface table
cpstat ha high availability state
cpstat blades top rule hits and amount of connections
cpstat os -f all checkpoint interface table, routing table, version, memory status, cpu load, disk space
cpstat os -f cpu checkpoint cpu status
cpstat os -f multi_cpu checkpoint cpu load distribution
cpstat os -f sensors hardware environment (temperature/fan/voltage)
cpstat os -f routing checkpoint routing table
cpstat mg -f log_server monitor log servers performance (events/sec)
cpstat -f log_connection fw monitor log servers settings
cpstop stop all checkpoint services
cpwd_admin monitor_list list processes actively monitored. Firewall should contain cpd and vpnd.
show sysenv all show hardware sensors (fans,power supply,temp,volt)
show asset all show serial numbers and hardware info
show route destination xx.xx.xx.xx show routing for specific host
ip route get xx.xx.xx.xx show routing for specific host
iclid / show cluster state show cluster fail over history
promote_util promote the Secondary Management server to become the Primary server
cp_conf sic init key123 norestart reset SIC without restarting the firewall process


Useful FW Commands

Table 2. Useful FW Commands
Command Description
fw ver firewall version
fw ctl iflist show interface names
fw ctl pstat show control kernel memory and connections
fwaccel stat show SecureXL status
fw fetch <manager IP> get the policy from the firewall manager
fwm load <policy name> <gateway name> compile and install a policy on the target's gateways.
fw getifs list interfaces and IP addresses
fw log show the content of the connections log
fw log -b "MMM DD, YYYY HH:MM:SS" "MMM DD, YYYY HH:MM:SS" search the current log for activity between specific times
fw log -c drop search for dropped packets in the active log; also can use accept or reject to search
fw log -f tail the current log
fwm logexport -i <log name> -o <output name> -n -p export an old log file on the firewall manager
fw logswitch rotate logs
fw lslogs list firewall logs
fw stat firewall status, should contain the name of the policy and the relevant interfaces.
fw stat -l show which policy is associated with which interface and package drop, accept and reject
fw tab displays firewall tables
fw tab -s -t connections number of connections in state table
fw tab -f -t vpn_routing -u routing for remote vpns
fw tab -s -t userc_users number of remote users connected (VPN)
fw tab -t xlate -x clear all translated entries
fw unloadlocal clear local firewall policy
fw monitor -e "accept host(10.1.1.10);" trace the packet flow to/from the specified host
fw ctl zdebug + drop | grep 'x.x.x.x\|y.y.y.y' Check reason of your packet being dropped

 

Checking Root Account Status

 

Checking Local Root Account Status
  • Run sudo passwd -S root: Look for the status letter in the output. An L means the account is locked (disabled), while a P means it has a usable password.
  • Check /etc/shadow directly: Run sudo getent shadow root or sudo grep root /etc/shadow. If the second field (the password hash field) starts with an ! or *, the password is locked and direct login is disabled. [1, 2]
Checking Remote SSH Root Login Status
  • Test the effective SSH setting: Run sudo sshd -T | grep permitrootlogin. If it outputs permitrootlogin no or prohibit-password, remote root access via password is disabled.
  • Inspect the configuration files: Check /etc/ssh/sshd_config and files inside /etc/ssh/sshd_config.d/ for PermitRootLogin no

Ubuntu Unsupported upgrades

 Unsupported upgrades

Sometimes do-release-upgrade isn't able to run the upgrade to the latest version and it shows an error similar to this:

An upgrade from 'eoan' to 'focal' is not supported with this tool.

If that happens, you need to download a version-specific upgrader, you can find the link at https://changelogs.ubuntu.com/meta-release.

You need to download the upgrade tool for the version you are upgrading to. For example, if you are upgrading to Ubuntu 20.04 (focal), you'll see the link on that page as follows:

UpgradeTool: http://archive.ubuntu.com/ubuntu/dists/focal-updates/main/dist-upgrader-all/current/focal.tar.gz

The download is an archive which contains an executable with the code name of the release. execute it to run the upgrade tool for that release. Note that the archive extracts everything in the current directory so you might want to create a directory for it to extract into:

# Downloads the upgrader, check the link above for the URL of the file for your release
wget http://archive.ubuntu.com/ubuntu/dists/focal-updates/main/dist-upgrader-all/current/focal.tar.gz
# Extract it into a new directory
mkdir upgrader
tar -xaf focal.tar.gz -C upgrader
cd upgrader
# Run the executable, the name changes based on the release
./focal

This executable works the same as do-release-upgrade. If you still get the error of the upgrade not being supported, you might need to make an intermediate upgrade to an earlier version.

Adicionar registro DNS windows linha de comando

 Usando o Prompt de Comando (dnscmd)Abra o Prompt de Comando como Administrador e utilize a seguinte estrutura para adicionar um registro do tipo A (endereço IP):
dnscmd . /RecordAdd <NomeDaZona> <NomeDoHost> A <EnderecoIP>
Exemplo prático: 
dnscmd . /RecordAdd meu-dominio.com meu-servidor A 192.168.1.50

O ponto . indica que você está gerenciando o servidor DNS local.
Usando o PowerShell (Add-DnsServerResourceRecordA)
Abra o Windows PowerShell como Administrador e execute o comando correspondente para a zona de pesquisa direta:
Add-DnsServerResourceRecordA -Name <NomeDoHost> -IPv4Address <EnderecoIP> -ZoneName <NomeDaZona>
Exemplo prático: Add-DnsServerResourceRecordA -Name meu-servidor -IPv4Address 192.168.1.50 -ZoneName meu-dominio.com 

SSH pos-quantum config

  On the SSH Server 1. Check OpenSSH version (requires OpenSSH 9.0+): ssh -V 2. Edit SSH server configuration: Edit /etc/ssh/sshd_config...

Mais vistos