Outils pour utilisateurs

Outils du site


blog

AAP Ansible Automation Platform - Credentials - exports - decrypt

Voir :

Voir aussi :

L'algo de chiffrement est aes-cbc Le secret principal est présent dans /etc/tower/SECRET_KEY, mais une clef dérivée est systématiquement utilisée.

Lors de l'export d'un Credential, le secret (mot de passe, clef privée..) n'est pas exportée pour des raisons de sécurité.

Voici comment le récupérer

sudo -u awx -i
 
#awx-manage shell_plus --ipython
awx-manage shell_plus
from awx.main.utils import decrypt_field
cred = Credential.objects.get(name="Nom_Credential")
 
# Avoir la liste des champs (ex: password)
cred.inputs
 
# Avoir le mdp déchiffré
#print(decrypt_field(cred, "password"))
cred.get_input('password')

Notes Credentials et base de données

psql -t -A -h pg1.db.acme.local -U user1 -d twrdb -p 5454
SELECT inputs FROM main_credential WHERE name = 'Nom_Credential';"
{"password": "$encrypted$UTF8$AESCBC$Z0FBQUFZQmtRT2t6Y3IwMl9yZXk3SUEwemdCVGxQZUZvZDQwbEw0MUgyYjdwd0JkdDlRUHZDUldnWVNTVjFuZ0ZfdGhxTWZndEJ2M050ZFpVdFFpVnVmaDF1dTViVHJCNVV3dkFYMU5abVVKeEZLRXlHVkUtUW89", "username": "user1@acme.local"}

La DB contient un champ nommé inputs dont le contenu est du JSON. A l’intérieur du JSON, nous avons un champs password dans notre exemple et un champ username A l’intérieur du champs password nous avons plusieurs champs séparé par le caractère $


Références

13.1.3. Secret handling for automation use

Ansible Tower stores a variety of secrets in the database that are either used for automation or are a result of automation. These secrets include: all secret fields of all credential types (passwords, secret keys, authentication tokens, secret cloud credentials) secret tokens and passwords for external services defined in Ansible Tower settings “password” type survey fields entries

To encrypt secret fields, Tower uses AES in CBC mode with a 256-bit key for encryption, PKCS7 padding, and HMAC using SHA256 for authentication. The encryption/decryption process derives the AES-256 bit encryption key from the SECRET_KEY (described above), the field name of the model field and the database assigned auto-incremented record ID. Thus, if any attribute used in the key generation process changes, Tower fails to correctly decrypt the secret. Ansible Tower is designed such that the SECRET_KEY is never readable in playbooks Ansible Tower launches, that these secrets are never readable by Tower users, and no secret field values are ever made available via the Ansible Tower REST API. If a secret value is used in a playbook, we recommend using no_log on the task so that it is not accidentally logged.

https://docs.ansible.com/ansible-tower/latest/html/administration/secret_handling.html

Data is encrypted before it is saved to the database and is decrypted as is needed in Tower. The encryption/decryption process derives the AES-256 bit encryption key from <SECRET_KEY, field_name, primary_key> where field_name is the name of the Model field and primary_key is the database assigned auto-incremented record ID. Thus, if any attribute used in the key generation process changes, Tower fails to correctly decrypt the secret.

https://docs.ansible.com/ansible-tower/3.5.3/html/userguide/credentials.html

Added a command to generate a new SECRET_KEY and rekey the database

https://docs.ansible.com/ansible-tower/3.6.2/html/installandreference/release_notes.html

Autres

openssl enc -aes-256-cbc -pbkdf2 -pass pass:MYPASSWORD -p -in foo_clear -out foo_enc
2025/03/24 15:06

Fan de la console

Console Linux Text-Based

FB FrameBuffer http://blog.rom1v.com/2012/04/lire-des-images-et-des-videos-sans-serveur-x-dans-un-tty/

http://doc.ubuntu-fr.org/liste_des_applications_console

Voir :

  • tmux / GNU screen
  • mutt
  • Poezio
  • IPython / Jupyter
  • lftp
  • se_passer_de_flash youtube-dl / yt-dlp, cclive
  • Kpcli (KeepassX)
  • fbi (Frame Buffer)
  • Play (Sound, mp3, flac etc…)
  • taskwarrior / tasksh
  • Abook
  • alsamixer
  • Aptitude
  • mplayer
  • nnn
  • feh
  • bat ( remplace cat )
  • exa ( remplace ls )
  • ncdu ( Visualiser facilement la taille des dossiers en console )
  • fzf (command-line fuzzy finder) ; alternative à locate et find

Web :

  • w3m
  • retawq
  • lynx
  • links
  • links2
  • elinks
  • edbrowse
  • aview

Voir aussi :

  • surfraw

Ecran de connexion login - Display Linux system Information In Terminal :

  • screenFetch
  • neofetch
  • neowofetch
  • linuxlogo
  • archey

Terminals :

Geo

Lock

Voir vlock verrouillage_de_session_gnu_linux

Remplacé par physlock

sudo aptitude install vlock cmatrix
cmatrix -s && vlock -san

fzf

#export FZF_DEFAULT_OPTS="--preview 'bat --color=always {}'"
export FZF_DEFAULT_OPTS="--preview 'batcat --color=always {}'"
 
#export FZF_DEFAULT_COMMAND="fd --type f"
export FZF_DEFAULT_COMMAND="fdfind --type f"
2025/03/24 15:06

Faire une pause toutes les x heures pour éviter les tendinites et la fatigues des yeux

Voir également : workrave

Un peu d'ergonomie !

Je cherchais à avoir une alerte toutes les 2 heures, pour faire une pause, me rappeler de sortir et regarder loin pour préserver un peu mes yeux.

J'ai découvert un logiciel Libre initialement prévu pour prévenir des tendinites qui répond parfaitement à ce besoin.

Installation

apt-get install xwrits
xwrits +idle=0:20 breaktime=15:00 typetime=120:00 +mouse +rp=/home/jean/Images/pause.gif +wp=/home/jean/Images/pause.gif

typetime=120:00
Pause toutes les 2 heures (120 minutes) d'activité sur l'ordi (clavier et souris grâce à +mouse)

breaktime=15:00
Pause de 15 minutes requis

+idle=0:20
Ne pas comptabiliser le temps d'inactivité (pas d'entrée clavier/souris pendant 20 secondes)

Les images doivent être au format GIF.

Reste à lancer cette commande après chaque ouverture de session. Avec mate-session-properties si vous êtes sous MateDesktop ou gnome-session-properties si vous êtes sous Gnome.

Workrave

Par défaut Workrave enregistre sa configuration dans ????? FIXME

Par itiliser un fichier ini, il suffit de créer le fichier

touch ~/.workrave/workrave.ini
2025/03/24 15:06

Faire fonctionner Adminer avec Sqlite

/var/www/usvn/public/adminer.php

<?php
function adminer_object() {
 
  class AdminerSoftware extends Adminer {
 
    function login($login, $password) {
      // validate user submitted credentials
      // return ($login == 'admin');
      return ($login == 'admin' && $password == 'P@ssw0rd');
    }
 
  }
 
  return new AdminerSoftware;
}
 
include 'adminer-4.6.1.php';
2025/03/24 15:06

Exemples paramètres noyau kernel Linux boot

Voir aussi :

Kernel boot parameter

cat /proc/cmdline

En cas de pb

Voir :

noapic nolapic acpi=off nomodeset nodmraid
edd=on

Désactiver Cloutinit

cloud-init=disabled

Désactiver la mitigations des CPU pour améliorer les performances au dépend de la sécurité Kernel 5.1.13 et sup

mitigations=off

Avant Kernel 5.1.13

/etc/default/grub

GRUB_CMDLINE_LINUX="noibrs noibpb nopti nospectre_v2 nospectre_v1 l1tf=off nospec_store_bypass_disable no_stf_barrier mds=off tsx=on tsx_async_abort=off mitigations=off"

Retbleed

spectre_v2=ibrs retbleed=off

Voir https://access.redhat.com/solutions/retbleed

pnpbios=off noapic

Désactive partiellement KPTI (Kernel page-table isolation)
KPTI a été crée pour limiter l'impact de Meltdown

noibrs noibpb nopti
#pti=off

Autres

pci=noaer
pcie_aspm=off
Fix boot errors

Source : https://www.techradar.com/how-to/computing/how-to-fix-any-linux-problem-1322630

noapic

ou

noapictimer, acpi=off

ou

acpi=force
irqpoll
pci=nommconf
pci=nomsi
splash=silent quiet showopts  nvme_core.default_ps_max_latency_us=170000 crashkernel=192M,high crashkernel=72M,low intremap=no_x2apic_optout apic=verbose lapic irqfixup irqpoll i2c_i801.disable_features=0x10 hpet=disable initcall_blacklist=dw_i2c_init_driver nvme_core.default_ps_max_latency_us=200000 iwlmvm.power_scheme=1 iwlwifi.amsdu_size=3


lapic=notscdeadline

acpi=rsdt

pci=nocrs
no_timer_check

Pb avec SSD BIOS : SATA sur AHCI à la place de RAID Ou change RAID On to Disabled (Disable : The SATA controllers are hidden).

nvme_load=YES

Source : https://www.dell.com/support/article/fr-fr/sln299303/chargement-d-ubuntu-sur-les-syst%C3%A8mes-%C3%A9quip%C3%A9s-de-disques-pcie-m2?lang=fr

Debug

loglevel=7 systemd.log_level=debug
ignore_loglevel

Affiche tous les messages Peut être changé dynamiquement

Linux Crashes, Reboots, ACPI and APIC

Source : http://www.gilfether.com/linux-crashes-reboots-acpi-and-apic/357/

On single processor machines you can fully disable ACPI and APIC by passing kernel boot parameters:

noapic nolapic acpi=ht

On a dual core, quad core, or multiprocessor machine, you want to make sure you enable Local APIC. Local APIC has some kind of control over your Multiprocessor machine. If you shut off Local APIC on an multi-core or multiprocessor machine, you will only see one processor available. Use the following Kernel parameters:

noapic lapic acpi=ht

Exemple Oracle

numa=off transparent_hugepage=never clocksource=tsc 

ipv6.disable=1 audit=1 audit_backlog_limit=8192 

Exemples

CloneZilla

linux /live/vmlinuz boot=live union=overlay username=user config components  noswap edd=on nomodeset nodmraid noeject locales=en_US.UTF-8 keyboard-layouts=NONE ocs_live_run="ocs-live-restore" ocs_live_extra_param="-e1 auto -e2 -c -r -j2 -scr -p true restoredisk IMAGES sda sdb" ocs_live_batch=yes vga=788 ip= net.ifnames=0 quiet nosplash i915.blacklist=yes radeonhd.blacklist=yes nouveau.blacklist=yes vmwgfx.enable_fbdev=1

Autres

xdriver=vesa fastboot

UEFI

video=efifb fbcon=rotate:1

Désactive le chargement du microcode CPU

dis_ucode_ldr

Lenteur au boot à cause d'un maque d'entropie

random.trust_cpu=on

Voir https://daniel-lange.com/archives/152-hello-buster.html

Voir KVM : https://www.redhat.com/en/blog/red-hat-enterprise-linux-virtual-machines-access-random-numbers-made-easy

memmap=512M\$1024M

/etc/default/grub

GRUB_CMDLINE_LINUX_DEFAULT="quiet memmap=512M\\\$1024M"

Autres

force_latency=cstate.id:1|3
 
force_latency=1
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