Outils pour utilisateurs

Outils du site


blog

Notes - yamllint

Voir :

Voir aussi :

Exemple de conf .yamllint

---

extends: default

rules:
  colons:
    max-spaces-before: 1
    max-spaces-after: 20
  line-length: disable

FIXME

2026/06/05 11:14 · Jean-Baptiste

Contrôle parental - bloquer un utilisateur après une certaine heure

Empêcher la connexion après dans une plage horaire définie

Semble ne pas marcher ?

/etc/pam.d/login

# Uncomment and edit /etc/security/time.conf if you need to set
# time restraint on logins.
# (Replaces the `PORTTIME_CHECKS_ENAB' option from login.defs
# as well as /etc/porttime)
#account    requisite  pam_time.so

Modif ici

cat <<EOF >> /etc/pam.d/common-account
account requisite pam_time.so
EOF

/etc/security/time.conf

*;*;toto;!Al2200-0300
2026/06/04 17:22 · Jean-Baptiste

Notes SystemD Timer

Voir :

Voir aussi :

NOTE : Dans le cas d'un service ne devant se lancer exclusivement par “timer” et non pas au démarrage de la machine : Dans ce cas le fichier “.service” ne contient pas de section [Install]

Désactiver tous les timers

Très utile après un ntpdate. Dans le cas contraire SystemD pourrait lancer d'un coups tous les timers !

systemctl list-timers --no-block --read-only --state active --output json | jq '.[].unit' | xargs systemctl stop 
 
# Vérif :
systemctl list-timers --no-block --read-only --state active 

Autres

systemctl stop logrotate.timer
systemctl disable logrotate.timer
touch /var/lib/systemd/timers/stamp-logrotate.timer
systemctl clean --what=state logrotate.timer
systemctl enable logrotate.timer
systemctl daemon-reload
systemctl reload-or-restart logrotate.timer

Exemples

atop-rotate

/usr/lib/systemd/system/atop-rotate.service

[Unit]
Description=Restart atop daemon to rotate logs
 
[Service]
Type=oneshot
ExecStart=/usr/bin/systemctl try-restart atop.service

/usr/lib/systemd/system/atop-rotate.timer

[Unit]
Description=Daily atop restart
 
[Timer]
OnCalendar=daily
 
[Install]
WantedBy=timers.target

Autres

systemctl list-timers --all --state bad
systemctl list-timers --all --state bad-setting
systemctl list-timers --all --state error
systemctl list-timers --all --state failed

FIXME

2026/06/04 17:19 · Jean-Baptiste

Contrôle parental - Fermer la session après une certaine heure

Avec une crontab

A faire : Notification de l'utilisateur

export EDITOR=vim
crontab -e
00 00 * * * /usr/bin/skill -TERM -u toto
#00 00 * * * /sbin/shutdown now

Avec SystemD

/etc/systemd/system/safe-hours-for-kids.service

[Unit]
Description=Safe hours for kids Service
Wants=network.target
After=network.target
 
[Service]
#ExecStart=bash -c '/usr/bin/date >> /tmp/plop.txt'
ExecStart=/usr/sbin/shutdown -h now
Type=oneshot
RemainAfterExit=no
 
#[Install]
#WantedBy=multi-user.target

/etc/systemd/system/safe-hours-for-kids.timer

[Unit]
Description=Run always between 23:00 and 23:59
 
[Timer]
#OnBootSec=15min
#OnUnitActiveSec=1w
# DayOfWeek Year-Month-Day Hour:Minute:Second
#OnCalendar=*-*-* 00,22..23:*:00
OnCalendar=*-*-* 23:00..23:59
 
[Install]
WantedBy=timers.target
systemd-analyze calendar "23:00..03:00"
systemd-analyze verify /etc/systemd/system/safe-hours-for-kids.service 
systemd-analyze verify /etc/systemd/system/safe-hours-for-kids.timer 
 
systemctl daemon-reload
systemctl stop --now safe-hours-for-kids.timer
systemctl enable --now safe-hours-for-kids.timer
 
systemctl status safe-hours-for-kids.timer

FIXME

2026/06/04 17:19 · Jean-Baptiste

Pb podman - network - netns namespace - duplicate default gateway

Voir :

Voir aussi :

J’ai constaté un bug sur Podman.

[root@srv1 ~]# lsns -t net | sed 1d | awk '{print $4}' | xargs -L1 -I% bash -c 'echo % ; time nsenter -t % -n host target'
1
target.acme.local has address 192.168.64.163

real    0m0.023s
user    0m0.004s
sys     0m0.003s
51826
target.acme.local has address 192.168.64.163

real    0m0.015s
user    0m0.003s
sys     0m0.003s
51812
target.acme.local has address 192.168.64.163

real    0m0.019s
user    0m0.003s
sys     0m0.003s
52103
target.acme.local has address 192.168.64.163

real    0m5.012s
user    0m0.003s
sys     0m0.005s
52376
target.acme.local has address 192.168.64.163

real    0m5.014s
user    0m0.006s
sys     0m0.002s
52579
target.acme.local has address 192.168.64.163

real    0m0.014s
user    0m0.005s
sys     0m0.002s

Ces délais élevés de trois voir cinq secondes surviennent aléatoirement, ce n’est pas systématique.

/usr/src/app # ping 10.131.18.1
PING 10.131.18.1 (10.131.18.1): 56 data bytes
64 bytes from 10.131.18.1: seq=1 ttl=254 time=2.925 ms
64 bytes from 10.131.18.1: seq=2 ttl=254 time=1.741 ms
^C
--- 10.131.18.1 ping statistics ---
3 packets transmitted, 2 packets received, 33% packet loss
round-trip min/avg/max = 1.741/2.333/2.925 ms

Alors que le ping de cette même adresse sur l’hôte est OK.

/usr/src/app # ip r
default via 10.89.0.1 dev eth0
default via 10.89.1.1 dev eth1
10.89.0.0/24 dev eth0 scope link  src 10.89.0.3
10.89.1.0/24 dev eth1 scope link  src 10.89.1.2

La table de routage est étrange

Solution provisoire

[root@srv1 ~]# lsns -t net
        NS TYPE NPROCS   PID USER      NETNSID NSFS COMMAND
4026531992 net     320     1 root   unassigned      /usr/lib/systemd/systemd --switched-root --system --deserialize 18
4026532530 net       1 51826 docker unassigned      redis-server *:6379
4026532603 net       2 51812 docker unassigned      /usr/sbin/dnsmasq -u root --conf-file=/run/user/1003457/containers/cni/dnsname/nginx-nodejs-redis_redisne
4026532668 net       3 52103 docker unassigned      npm
4026532733 net       2 52376 docker unassigned      npm
4026532799 net       4 52579 docker unassigned      rootlessport
unshare -n /bin/bash
nsenter -t 52103 -n bash
ip route del 0.0.0.0/0 via 10.89.1.1

Comme il y avait deux passerelles par défaut (et que cela n’est pas cohérent) on en supprime une. Il convient de faire la même chose pour les autres containers.

Reste à trouver une solution parraine. Peut-être est-ce juste un problème de conf.

Autres

podman ps -p --ns
2026/06/04 11:51 · Jean-Baptiste
blog.txt · Dernière modification : de 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki