Table des matières
0 billet(s) pour février 2026
Ansible Vagrant et Docker
Docker
Install
Proxy
Général
Ajout du compte au groupe docker
adduser jean docker
Attention, cela créé une faille de sécurité
Exemple
docker run -ti --privileged -v /:/host fedora chroot /host
Conf conteneur
Dockerfile
FROM debian:jessie #ENV http_proxy http://192.168.56.1:3128 #ENV https_proxy http://192.168.56.1:3128 ARG https_proxy ARG http_proxy ENV DEBIAN_FRONTEND noninteractive ENV TERM linux ENV LANG C.UTF-8 ENV LANGUAGE C.UTF-8 ENV LC_ALL C.UTF-8 RUN echo "deb http://ftp.debian.org/debian jessie-backports main" > /etc/apt/sources.list.d/backports.list RUN (apt-get update && apt-get upgrade -y -q && apt-get dist-upgrade -y -q && apt-get -y -q autoclean && apt-get -y -q autoremove) RUN apt-get install -q -y --no-install-recommends openssh-server python-minimal tmux bash locales sudo vim supervisor RUN apt-get install -q -y --no-install-recommends -t jessie-backports ansible RUN (locale-gen fr_FR.UTF-8 UTF-8 && dpkg-reconfigure locales) RUN mkdir -p /var/run/sshd RUN mkdir /root/.ssh RUN echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDQP77kB6AoqUSfvgy844x46CpJC5qLFTgnh2meUxMxA98jvk8TkheKICY2WBiEdORC4uGWVuMEIy0Zy/vL25JFlu7lgZ2B8g7r7JmITpVQMc+TlF5GyJqE1r56A5ljqZXKVVE9PnLCi2FN0rhQLpYM645U0Akvkc6yS0+6RFSWkobrC9/F1L6PU+dzmw6Yisd2nFDjw/J43QrADGPi3HCY+xTjcW/TD8FyGlNWuvNlvHY8aQKoOnuvWnK7F32ciaJE6/8BLKCap/lmkEtxAFd7hAt5YpLK6lNXtkbTKxBZF7SChVW4KJbI5IK2kaHIuXBhMfVTt3xSxk08wahbnVhV root@debian2.localdomain" > /root/.ssh/authorized_keys COPY sshd.conf /etc/supervisor/conf.d/sshd.conf EXPOSE 22 ENTRYPOINT ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf", "-n"]
Conf supervisord
sshd.conf
[program:sshd] directory=/ command=/usr/sbin/sshd autostart=true autorestart=true user = root
#docker build --no-cache -t plop --build-arg http_proxy=http://192.168.56.1:3128 --build-arg https_proxy=http://192.168.56.1:3128 . docker build -t plop --build-arg http_proxy=http://192.168.56.1:3128 --build-arg https_proxy=http://192.168.56.1:3128 .
Vagrant
Vagrantfile
Vagrant.configure("2") do |config| config.vm.provider "docker" do |d| #d.image = "debian:jessie" d.remains_running = false d.build_dir = "." d.has_ssh = true d.create_args = ['--name=ansible1'] end config.ssh.username = "root" config.ssh.private_key_path = "~/.ssh/id_rsa" config.vm.provision "ansible" do |ansible| ansible.playbook = "play-fi.yml" ansible.extra_vars = { hostname: "default" } end end
Autre
Un Makefile pour nous simplifier la vie
Makefile
FicListYaml = $(shell find . -type f -iname "*.yml" -not -iname "mdp.yml") FicListPlayBook = $(shell echo play*.yml) check: check-yaml check-ansible # Check YAML syntax check-yaml: for Fic in $(FicListYaml); do \ ansible-lint "$$Fic" || break ; \ done check-ansible: for Fic in $(FicListPlayBook); do \ ansible-playbook --check "$$Fic" || break ; \ done apply: for Fic in $(FicListPlayBook); do \ ansible-playbook "$$Fic" || break ; \ done # Check idempotent check-active: $(eval changed := $(shell ansible-playbook play-fi.yml |tail -2 |sed -e 's/^.*changed=\([0-9][0-9]*\).*/\1/')) @if [ "$(changed)" != "0" ]; then\ echo "ERR NO idempostent";\ false ;\ fi clean: rm -f *.retry vagrant destroy -f build: vagrant up --provider=docker status: vagrant global-status docker ps
Pb
La commande hostname échoue dans un Docker
J'ai dû utiliser la clause WHEN
- name: define hostname hostname: name='{{hostnameFqdn}}' when: ansible_virtualization_type != "docker"
La modification du fichier /etc/hosts via lineinfile pose également pb.
Could not replace file: /tmp/tmpu74RFY to /etc/hosts: [Errno 16] Device or resource busy
Materiel sécurité et insécurité
Intel Management Engine
Vulnerable and proprietary low-level hardware parts … advanced attacks.
The Intel Management Engine (ME) is a type of separate computer within all modern Intel processors (CPU). The ME acts as a master controller for your CPU and has extensive access to your computer (system memory, display, keyboard, network). Intel controls the code of the ME and severe vulnerabilities have already been found in the ME that allow local and remote attacks. Therefore, ME can be considered a backdoor.
Gadget pentest
Yubikey
Autres
Virtual Intel Software Guard Extensions (vSGX)
Notes Markdown Étendue
Lint
markdownlint (mdl)
$ sudo apt-get install markdownlint $ mdl notes_-_nerdctl.txt notes_-_nerdctl.txt:13: MD012 Multiple consecutive blank lines notes_-_nerdctl.txt:20: MD012 Multiple consecutive blank lines notes_-_nerdctl.txt:24: MD012 Multiple consecutive blank lines notes_-_nerdctl.txt:42: MD012 Multiple consecutive blank lines notes_-_nerdctl.txt:54: MD012 Multiple consecutive blank lines notes_-_nerdctl.txt:55: MD012 Multiple consecutive blank lines notes_-_nerdctl.txt:67: MD012 Multiple consecutive blank lines notes_-_nerdctl.txt:30: MD013 Line length notes_-_nerdctl.txt:50: MD031 Fenced code blocks should be surrounded by blank lines notes_-_nerdctl.txt:7: MD032 Lists should be surrounded by blank lines notes_-_nerdctl.txt:15: MD032 Lists should be surrounded by blank lines notes_-_nerdctl.txt:22: MD032 Lists should be surrounded by blank lines notes_-_nerdctl.txt:15: MD034 Bare URL used notes_-_nerdctl.txt:16: MD034 Bare URL used notes_-_nerdctl.txt:17: MD034 Bare URL used notes_-_nerdctl.txt:18: MD034 Bare URL used notes_-_nerdctl.txt:22: MD034 Bare URL used
Conversion Markdown vers ODT
pandoc notes.md -f markdown -t odt -o notes.odt
Autres
pandoc --list-input-formats lists native
Éditeurs Markdown
Voir :
- hedgedoc
Markdown slide
Voir :
Editer un fichier Markdown avec Atom
Atom \ Puis [CTRL] + [SHIFT] + [M] \ Ou “Packages - Markdown Preview - Toggle Preview”
Linter
Install
sudo apt-get install ruby-mdl
Utilisation
mdl fichier.md
Config - ignorer une règle
mdl ~/code/mkdocs/projet1/docs/start.md /home/jean/code/mkdocs/projet1/docs/start.md:41: MD013 Line length /home/jean/code/mkdocs/projet1/docs/start.md:171: MD013 Line length mdl -r ~MD013 ~/code/mkdocs/projet1/docs/start.md mdl -r ~MD013,~MD046 ~/code/mkdocs/projet1/docs/start.md
Autres
Markdown
For security reasons, the Unicode character U+0000 must be replaced with the REPLACEMENT CHARACTER (U+FFFD)
#sudo add-apt-repository ppa:wereturtle/ppa sudo apt update sudo apt install ghostwriter
markdown.pl
Manipulation PDF en ligne de commande avec pdftk
Voir https://doc.ubuntu-fr.org/pdftk
Voir aussi
- qpdf
Réparer un pdf, recommander avant d'utiliser pdfedit
pdftk fichier-orig.pdf output fichier.pdf
Pour concaténer des PDF
pdftk page1.pdf page2.pdf page3.pdf page4.pdf page5.pdf cat output toutes-les-pages.pdf
Couper un PDF, garder que les pages souhaitées (ici on garde les pages 1 2 142 et 157)
pdftk EBODACC-A_20160054_0001_p000.pdf cat 1 2 142 157 output EBODACC-A_20160054_0001_p000_p1p2p142p157.pdf
Supprimer la 1ère page
pdftk fichier-orig.pdf cat 2-end output fichier.pdf
Insérer / Remplacer une page
Exemple : remplacer la page 4 par la page 1 d'un second document.
pdftk A=Document1.pdf B=Document2.pdf cat A1-3 B1 A5-end output out1.pdf
Convertir une ou plusieurs images jpeg en PDF avec imagemagick
convert a.jpg b.jpg ... z.jpg output.pdf
# Exemple :
convert screenshot-a24f9838.jpg screenshot-129e4d57b.jpg ecrans.pdf
Conversion ODT, DOC en PDF
sudo apt-get install libreoffice-common soffice --headless --convert-to pdf /tmp/plop.doc
ou
unoconv --listener # A demarrer qu'une seule fois unoconv --format pdf --output /tmp fichier.odt
jodconverter fichier.odt fichier.pdf
Autres outils
poppler-utils :
- pdfunite
- pdfdetach
- pdfinfo
- pdftoppm
- pdftocairo
- pdftohtml
- pdffonts
- pdfimages
- pdfseparate
- pdftops
- pdftotext
pdfnup
Install
sudo apt-get install -y python-pypdf2 sudo apt-get install -y python3-pypdf2 /usr/bin/pip install --user pdfnup
Manipulation PDF avec PDFedit
Voir aussi :
Il faut installer les paquets suivants (présent dans les anciens dépôts squeeze) : pdfedit, libqt3-mt
wget http://ftp.fr.debian.org/debian/pool/main/p/pdfedit/pdfedit_0.4.5-1_amd64.deb wget http://ftp.fr.debian.org/debian/pool/main/q/qt-x11-free/libqt3-mt_3.3.8b-7+b1_amd64.deb dpkg -i pdfedit_0.4.5-1_amd64.deb libqt3-mt_3.3.8b-7+b1_amd64.deb
libqt3-mt dépendait de libjpeg62 qui semble avoir était remplacé par libjpeg62-turbo
On copie le fichier avant de le modifier (on ne sait jamais)
cp -p /var/lib/dpkg/status{,.old}
Puis dans la section “Package: libqt3-mt” on remplace libjpeg62 (>= 6b1) par libjpeg62-turbo
- /var/lib/dpkg/status
Package: libqt3-mt Status: install ok installed Priority: optional Section: libs Installed-Size: 9356 Maintainer: Debian Qt/KDE Maintainers <debian-qt-kde@lists.debian.org> Architecture: amd64 Source: qt-x11-free (3:3.3.8b-7) Version: 3:3.3.8b-7+b1 Replaces: libqt3, libqt3-helper, libqt3c102-mt, qt3-tools (<< 2:3.0.2-20020306-1) Depends: libaudio2, libc6 (>= 2.3.3), libfontconfig1 (>= 2.8.0), libfreetype6 (>= 2.2.1), libgcc1 (>= 1:4.1.1), libice6 (>= 1:1.0.0), libjpeg62-turbo, libmng1 (>= 1.0.10), libpng12-0 (>= 1.2.13-4), libsm6, libstdc++6 (>= 4.1.1), libx1 Recommends: libgl1-mesa-glx | libgl1, libglu1-mesa | libglu1, libxmu6 (>= 4.3.0.dfsg.1-4) Suggests: libqt3-mt-psql, libqt3-mt-mysql, libqt3-mt-odbc Conflicts: libqt3c-mt, libqt3c102-mt, libqui1-emb Description: Qt GUI Library (Threaded runtime version), Version 3 This is the Trolltech Qt library, version 3. It's necessary for applications that link against the libqt-mt.so.3, e.g. all KDE3 applications. Homepage: http://trolltech.com
Pour finaliser l'installation
apt-get -f install
Avant de travailler vos PDF avec PDFedit, je vous recommande de les “réparer !?” grâce à PDFtk. Ça évite beaucoup de bug Exemple
pdftk rapport_de_stage.pdf output rapport_de_stage_pour_editer_avec_pdfedit.pdf
Surtout travailler systématiquement sur des copies, par sur les originaux, au risque de corrompre vos fichiers
