Table des matières
- 2026:
- 2025:
8 billet(s) pour mars 2026
| Notes conteneurs oras artifact OCI | 2026/03/23 21:13 | Jean-Baptiste |
| Notes podman secret | 2026/03/23 15:10 | Jean-Baptiste |
| Notes ansible podman | 2026/03/23 14:08 | Jean-Baptiste |
| Notes podman volume | 2026/03/23 14:00 | Jean-Baptiste |
| Find list - Trouver des fichiers à partir d'une liste | 2026/03/18 14:32 | Jean-Baptiste |
| AWX inventaire vault | 2026/03/17 18:04 | Jean-Baptiste |
| AWX - Configuration git en local (sans serveur web) | 2026/03/05 16:24 | Jean-Baptiste |
| OpenSMTP | 2026/03/03 16:58 | Jean-Baptiste |
Traefik - un reverse proxy pour Docker
Voir aussi :
traefik.yml
entryPoints: web: address: ":80" websecure: address: ":443" serversTransport: insecureSkipVerify: true # rootCAs: # - certs/inter-chain.pem providers: file: filename: dynamic_conf.yml watch: true docker: endpoint: "unix:///var/run/docker.sock" exposedByDefault: false log: #level: DEBUG level: INFO api: dashboard: true #debug: true #insecure: true
dynamic_conf.yml
tls: certificates: - certFile: certs/registry.docker.local.crt keyFile: certs/registry.docker.local.key - certFile: certs/wildcard.docker.local.crt keyFile: certs/wildcard.docker.local.key stores: - default stores: default: defaultCertificate: certFile: certs/wildcard.docker.local.crt keyFile: certs/wildcard.docker.local.key options: default: minVersion: VersionTLS12 sniStrict: true
docker-compose.yml
version: '3.7' services: traefik: image: traefik #restart: unless-stopped ports: - "80:80" - "443:443" volumes: - /etc/localtime:/etc/localtime:ro - /var/run/docker.sock:/var/run/docker.sock - $PWD/traefik.yml:/traefik.yml:ro - $PWD/dynamic_conf.yml:/dynamic_conf.yml:ro - $PWD/certs:/certs:ro # environment: # PUID: ${PUID} # PGID: ${PGID} # TZ: ${TZ} labels: - traefik.enable=true - traefik.http.routers.dashboard.entrypoints=web - traefik.http.routers.dashboard.rule=Host(`traefik.docker.local`) #- traefik.http.services.s-dashboard.loadbalancer.server.port=8080 - traefik.port=8080 - traefik.http.routers.s-dashboard.entrypoints=websecure - traefik.http.routers.s-dashboard.rule=Host(`traefik.docker.local`) - traefik.http.routers.s-dashboard.service=api@internal - traefik.http.routers.s-dashboard.middlewares=auth@docker # mkpasswd -m md5 |sed -e 's/\$/$$/g' - traefik.http.middlewares.auth.basicauth.users=jean:$$1$$qvbVKuOn$$qKZpjcMQuMFWNgC9vtycL1 - traefik.http.routers.s-dashboard.tls=true - traefik.http.routers.dashboard.middlewares=https-redirect@docker - traefik.http.middlewares.https-redirect.redirectscheme.scheme=https - traefik.http.middlewares.https-redirect.redirectscheme.permanent=true # hello: # image: osones/helloworld # labels: # - traefik.enable=true # - traefik.http.routers.hw.entrypoints=web # - traefik.http.routers.hw.rule=Host(`hw.docker.local`) # - traefik.http.routers.s-hw.entrypoints=websecure # - traefik.http.routers.s-hw.rule=Host(`hw.docker.local`) # - traefik.http.routers.s-hw.tls=true # - traefik.http.routers.hw.middlewares=https-redirect@docker # - traefik.http.middlewares.https-redirect.redirectscheme.scheme=https # - traefik.http.middlewares.https-redirect.redirectscheme.permanent=true # #- "traefik.port=80" # #- "traefik.backend=hello" redis: image: redis #restart: unless-stopped restart: always registry: image: registry:2 depends_on: - redis environment: environment: - REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY=/data - REGISTRY_STORAGE_CACHE_BLOBDESCRIPTOR=redis - REGISTRY_REDIS_ADDR=redis:6379 volumes: - $PWD/data:/data labels: - traefik.enable=true - traefik.port=5000 - traefik.http.routers.s-registry.rule=Host(`registry.docker.local`) - traefik.http.routers.s-registry.entrypoints=websecure - traefik.http.routers.s-registry.tls=true registry-ui: image: konradkleine/docker-registry-frontend:v2 #restart: unless-stopped depends_on: - registry environment: ENV_DOCKER_REGISTRY_HOST: 'registry' ENV_DOCKER_REGISTRY_PORT: 5000 #ENV_DOCKER_REGISTRY_USE_SSL: 1 ENV_DEFAULT_REPOSITORIES_PER_PAGE: 50 labels: - traefik.enable=true - traefik.port=80 - traefik.http.routers.s-registry-ui.rule=Host(`registry-ui.docker.local`) - traefik.http.routers.s-registry-ui.entrypoints=websecure - traefik.http.routers.s-registry-ui.tls=true - traefik.http.routers.s-registry-ui.middlewares=auth@docker - traefik.http.middlewares.auth.basicauth.users=jean:$$1$$qvbVKuOn$$qKZpjcMQuMFWNgC9vtycL1
Exemple de génération de certificats. Notez que Traefik est capable d'utiliser Let's Encrypt
mkdir certs openssl req -newkey rsa:4096 -nodes -sha256 -keyout certs/wildcard.docker.local.key -x509 -days 365 -out certs/wildcard.docker.local.crt
docker-compose up -d
Tous logger et historiser vos commandes bash grace à la commande "script"
Voir aussi :
- netconsole
Conserver un historique en local de tout ce qui est affiché dans vos shells (entrée/sortie) C'est également valable pour les connexions distantes via SSH. NB : Les mots de passes SSH ne serons pas enregistré (car pas affichés à l'écran)
Il suffit d'ajouter dans le .bashrc
~/.bashrc
##### EXTREM LOGING / HISTORIZE #### historyFolder="$HOME" historyFilename=".history_$(date '+%Y-%m-%d-%H-%M').$$.txt" historyFilenameTime=".history_$(date '+%Y-%m-%d-%H-%M').$$.time" #parentProcessNameOfCurrentShell=$(ps --no-headers -o comm -p $(ps --no-headers -o ppid -p $$)) parentProcessNameOfCurrentShell=$(ps --no-headers -o comm -p $PPID) if [ "$parentProcessNameOfCurrentShell" != script ] then script -aqf ${historyFolder}/${historyFilename} -t 2> ${historyFolder}/${historyFilenameTime} fi
Vous pouvez voir Les caractères de contrôle, le mouvement du curseur, couleurs, etc… seront également enregistrés ce qui “pollue” le fichier. Voici un exemple de comment le nettoyer en cas de besoin :
cat $NOMDUFICHIER |sed -e 's/[[:cntrl:]]//g' -e 's/\[[^m]*m//g' -e 's/\^*M//g' >$NOUVEAUFICHIER
Pour arrêter l'historisation du shell courant, utiliser la commande :
exit
A utiliser une seul fois. Sinon vous fermerez votre shell.
Pour reprendre l'historisation, après un “exit” il suffit de sourcer votre .bashrc
source ~/.bashrc
Rejouer l'historique, exemple :
scriptreplay -t .history_2014-10-14-16-57.7649.time .history_2014-10-14-16-57.7649.txt
Il est possible de jeter un œil rapide sur le fichier avec cat, more ou less
cat .history_2014-10-14-16-57.7649.txt less -r .history_2014-10-14-16-57.7649.txt more .history_2014-10-14-16-57.7649.txt
Autre façon avec rsyslog
/etc/rsyslog.d/bash.conf
local6.* /var/log/commands.log
/etc/bash.bashrc
# bash history logger export PROMPT_COMMAND='RETRN_VAL=$?;logger -p local6.debug "$(whoami) [$$]: $(history 1 | sed "s/^[ ]*[0-9]\+[ ]*//" ) [$RETRN_VAL]"'
systemctl restart rsyslog
Autre
De pas dupliquer les ligne dans l'historique
export HISTCONTROL=ignoredups
Afficher les date & heure dans l'history (hardening)
export HISTTIMEFORMAT="[ %d/%m/%Y %H:%M:%S ]"
Avec SystemD
# journalctl -t sudo -p 5 -u session-*.scope -b Sep 12 08:19:01 vmdeb01 sudo[601]: admin : TTY=pts/0 ; PWD=/root ; USER=root ; COMMAND=/bin/bash
Torréfier une application grâce à Tsocks
Torréfier : Passer par le réseaux Tor (pour cacher son IP) Voir https://trac.torproject.org/projects/tor/wiki/doc/TorifyHOWTO
Tor doit être correctement configuré et lancé
/etc/tsocks.conf
server = 127.0.0.1 server_port = 9050 tordns_enable = true local = 127.0.0.0/255.128.0.0 local = 127.128.0.0/255.192.0.0 local = 192.0.0.0/255.0.0.0
tsocks w3m http://mire.ipadsl.net
Ne marche pas pour toutes les applications, dépend des APIs utilisées !
Équivalent à GNU screen / tmux pour X
Voir aussi :
- xmove
- winswitch
xpra
xpra --no-pulseaudio --no-clipboard --compress=9 attach ssh:tribler@kimi:2222:100
- 2222 : port TCP pour SSH
- 100 : Identifiant pour xpra
