Table des matières
- 2026:
- 2025:
14 billet(s) pour novembre 2026
| Notes IA WebMCP | 2026/11/19 09:13 | |
| Réseaux - protocole QUIC mieux que TCP | 2026/11/17 21:26 | Jean-Baptiste |
| Notes conversion JSON YAML | 2026/11/13 11:16 | Jean-Baptiste |
| Git commit perdu | 2026/11/12 18:16 | Jean-Baptiste |
| Notes mojo lang | 2026/11/11 20:34 | Jean-Baptiste |
| Notes rust lang compilation | 2026/11/11 18:35 | Jean-Baptiste |
| Mémoire VSIZE VMSIZE SEGV lang C | 2026/11/11 15:59 | Jean-Baptiste |
| Ansible-navigator utilisation de ansible-vault | 2026/11/06 11:33 | Jean-Baptiste |
| Err Ansible - Module result deserialization failed No start of json char found | 2026/11/06 09:09 | Jean-Baptiste |
| Script Python conversion JSON vers CSV | 2026/11/06 08:14 | Jean-Baptiste |
| Filter Incoming IPv4 Packets Containing IP Options - cve-2026-98432 mitigation - Kernel TCP Use-After-Free | 2026/11/04 21:04 | Jean-Baptiste |
| Notes ZFS | 2026/11/03 18:04 | Jean-Baptiste |
| Diff image container | 2026/11/03 16:30 | Jean-Baptiste |
| Notes processus multi-thread | 2026/11/03 10:59 | Jean-Baptiste |
Mosh pour remplacer SSH
Site du projet https://mosh.mit.edu/
Autre : http://www.slashroot.in/mosh-better-alternative-ssh
Voir aussi
mosh --ssh='ssh -p 7000' user@serveur
Sur le serveur
mosh-server
MOSH CONNECT 60001 ewiNFI9EvmGMaQP3DzNKuw
Sur le client
MOSH_KEY=ewiNFI9EvmGMaQP3DzNKuw mosh-client 151.80.136.92 60001
Session utilisateur (sans privilèges root)
Téléchargement du binaire mosh-server en session utilisateur (si pas de privilèges root)
mkdir -p ~/tmp/mosh cd ~/tmp/mosh apt-get download mosh ar x mosh_1.2.4a-1+b2_amd64.deb tar xvf data.tar.xz
On test que l’exécutable se lance bien sans erreurs
~/tmp/mosh/usr/bin/mosh-server
A présent nous utilisons mosh (qui utilisera SSH pour l’authentification)
mosh --ssh='ssh -p 2222' --server ~/tmp/mosh/usr/bin/mosh-server jean@192.168.2.101 -- tmux at -d
Monter une partition d un disque qui a été cloné entièrement via dd ou ddrescue
Méthode 1 - kpartx
$ kpartx -av disk.img loop3p1 : 0 20964762 /dev/loop3 63
Pour vérifier la partition:
fsck /dev/mapper/loop3p1
Pour supprimer le périphérique
kpartx -d disk.img
Méthode 2 - losetup offset
Source : Mounting a raw partition file made with dd or dd_rescue in Linux
dd if=/dev/sda of=/mnt/nfs/backup/harddrive.img
file harddrive.img
harddrive.img: x86 boot sector; GRand Unified Bootloader, stage1 version 0x3, stage2 address 0x2000, stage2 segment 0x200, GRUB version 0.97; partition 1: ID=0x83, active, starthead 1, startsector 63, 33640047 sectors, code offset 0x48
startsector 63
Voir gdisk et parted pour GPT. A tester
fdisk -l harddrive.img
Device Boot Start End Blocks Id System harddrive.img * 63 33640109 16820023+ 83 Linux
63 x 512 = 32256
Pour monter la partition en lecture
mount -o ro,loop,offset=32256 harddrive.img /mnt/loop
Pour faire un fsck ou un mkfs
losetup --offset 32256 /dev/loop2 harddrive.img fsck /dev/loop2
Puis pour monter la partition
mount /dev/loop2 /mnt/loop
Monter un serveur SFTP chroote avec OpenSSH
Voir : https://michauko.org/blog/sftp-chroot-et-pas-de-ssh-bloquer-un-utilisateur-dans-un-repertoire-1099/
Voir aussi :
mkdir -p /chroot/shared/ chown root:nsc /chroot chmod 750 /chroot useradd sftpuser -M -d /dev/null -s /sbin/nologin # useradd is a low level utility for adding users. On Debian, administrators should usually use adduser(8) instead. echo "/mnt/shared/ /chroot/shared/ none _netdev,bind 0 0" >> /etc/fstab
/etc/ssh/sshd_config
# Subsystem sftp /usr/lib/openssh/sftp-server
Subsystem sftp internal-sftp
Match User sftpuser
ChrootDirectory /chroot
ForceCommand internal-sftp
AllowTcpForwarding no
GatewayPorts no
X11Forwarding no
PermitTunnel no
AllowAgentForwarding no
PermitTTY no
mount /chroot/shared/ systemctl restart sshd systemctl status sshd
Autres
The simplest way is to create some script that would take care of that. Add
Match User test1 ForceCommand /path/to/your/script.sh
And your script will basically run whatever the user wants, unless it is request for SFTP:
#!/bin/bash if [[ "$SSH_ORIGINAL_COMMAND" =~ .*sftp-server.* ]]; then echo "SFTP not allowed" exit 255; else exec "$SSH_ORIGINAL_COMMAND" fi
Monter un partage ftp comme une partition
Obsolète
Voir Notes rclone
sudo apt-get update sudo apt-get install curlftpfs
mkdir -p ~/mnt/ftp curlftpfs ftp://ftp.truc.org ~/mnt/ftp/ -o user=utilisateur:pass fusermount -u ~/mnt/ftp/
Voir ~/.netrc
Créer un proxy inverse sed
Voir également netsed
Intro
Lors d'une mission, un collègue a trouvé cette astuce.
Créer un reverse proxy et ext_filter Ce module permet de modifier les flux sortant. La page officiele est : mod_ext_filter.html
Il faut activer le module et desactiver le deflate (pour que la sortie de soit pas compressé).
a2enmod ext_filter a2dismod deflate
On définit la commande:
ExtFilterDefine fixtext mode=output intype=text/xml cmd="/bin/sed s/toto/titi/g"
Que l'on utilise après (dans la sous section Location) : SetOutputFilter fixtext
NetSed
Le serveur écoute sur le port TCP 8080. Nous créons un nouveau socket écoutant sur 8084
netsed tcp 8084 127.0.0.1 8080 s/andrew/mike%00%00 s/andrew/mike%00%00 >/dev/null
