Outils pour utilisateurs

Outils du site


blog

Notes iTop ITSM ESM CMDB ITIL

Voir :

Voir aussi :

sudo docker run -d -p 8000:80 --name=my-itop vbkunin/itop
2025/03/24 15:06

Notes IPv6

Voir :

2025/03/24 15:06

Notes iptables

Les bases

Il existe les tables :

  • filter (défaut)
  • nat
  • mangle

Bloquer une IP en sortie

Pour bloquer l'IP 192.168.2.18 en sortie.

iptables -I OUTPUT -d 192.168.2.18 -j REJECT

Pour effacer la règle

iptables -D OUTPUT -d 192.168.2.18 -j REJECT

Nettoyer / supprimer plusieurs règles qui contiennent un motif spécifique

Exemple : pour supprimer toutes les règles contenant “445”

iptables -S | grep 445 | sed -e 's/^-A/-D/' | xargs -L1 iptables

Logs

iptables -A INPUT -p igmp -j LOG --log-level info --log-prefix "IGMP:"
 
# log pour paquets refusés
iptables -N LOGDROP
iptables -A LOGDROP -m limit --limit 5/second  -j LOG --log-level notice --log-ip-options --log-prefix "Netfilter refused:"
iptables -A LOGDROP -j DROP
 
# iptables -A pub-priv -m limit --limit 5/second  -j LOG --log-level notice --log-ip-options --log-prefix "Netfilter pub-priv:"
 
iptables -A FORWARD -j LOGDROP
iptables -A INPUT -j LOGDROP
 
 
 
iptables -A INPUT -p icmp -m limit -j LOG --log-prefix "ICMP/IN: "
iptables -A OUTPUT -p icmp -m limit -j LOG --log-prefix "ICMP/OUT: "
iptables -A FORWARD -p icmp -m limit -j LOG --log-prefix "ICMP/FWD: "
2025/03/24 15:06

Notes IPC shared memory

Voir :

Voir aussi :

#Total de la RAM
total=$(cat /proc/meminfo | grep MemTotal | awk '{print $2}')
 
# 90% de la mémoire physique max
ratio=0.9
 
# On applique le ratio et on converti en pages de 4096
shmall=$(echo $total/4096*$ratio+1 | bc)
shmmax=$(echo $total*$ratio | bc)
 
# On arrondi la valeur
shmall=$(echo $shmall | sed -e 's/\..*$//')
shmmax=$(echo $shmmax | sed -e 's/\..*$//')
 
echo $shmall > /proc/sys/kernel/shmall
echo $shmmax > /proc/sys/kernel/shmmax
 
# ipcs -lm
#################
 
 
#################
# Overcommit memory ?
# sysctl -w vm.overcommit_memory=2
 
# Page size ?
# getconf PAGE_SIZE
# cat /proc/sys/kernel/shmmni
#################
 
#### SEMAPHORES
# http://www.postgresql.org/docs/9.1/static/runtime-config-connection.html#GUC-MAX-CONNECTIONS
# SEMMNS is the second parameter in output of cat /proc/sys/kernel/sem (default value 32000) 
# SEMMNI is the last parameter there, default value 128 - this is the limiting factor - SEMMNI must be at least at least ceil(max_connections / 16)
 
# http://www.puschitz.com/TuningLinuxForOracle.shtml#TheSEMMNSParameter
# http://www.postgresql.org.es/node/229
####

Connaître la PAGE_SIZE \ Voir https://en.wikipedia.org/wiki/Page_%28computer_memory%29

getconf PAGE_SIZE
cat /proc/sys/kernel/shmmni
$ ipcs

------ Message Queues --------
key        msqid      owner      perms      used-bytes   messages    

------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch     status      
0x0052e2c1 32768      postgres   600        56         20                      
0x00000000 17924097   wouter     600        33554432   2          dest         
0x00000000 49446914   wouter     600        524288     2          dest         
[...]

$ ipcs -i 17924097 -m -p

Shared memory Segment shmid=17924097
uid=1000    gid=1000    cuid=1000   cgid=1000
mode=01600  access_perms=0600
bytes=33554432  lpid=3808   cpid=1457   nattch=2
att_time=Fri Jul  3 10:43:28 2015  
det_time=Fri Jul  3 10:43:28 2015  
change_time=Fri Jul  3 10:03:00 2015 

Debug

Source : http://www.makelinux.net/alp/035

The ipcs command provides information on interprocess communication facilities, including shared segments. Use the -m flag to obtain information about shared memory. For example, this code illustrates that one shared memory segment, numbered 1627649, is in use:

$ ipcs -m 

------ Shared Memory Segments -------
key       shmid     owner     perms     bytes     nattch    status 
0x00000000 1627649   user    640       25600     0 

If this memory segment was erroneously left behind by a program, you can use the ipcrm command to remove it.

ipcrm shm 1627649 

Periodically remove allocated semaphores which belong to the user running the plugin. This can be achieved like this (example for the user “nrpe”)\ Source : http://folk.uio.no/trondham/software/check_openmanage.html

ipcrm $(ipcs -s | awk '/nrpe/ {print "-s ",$2}')
2025/03/24 15:06
blog.txt · Dernière modification : de 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki