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

Fetchmail

Voir aussi

Intro

La cathédrale et le bazar

fetchmail -v -d 0 --sslproto TLS1 --sslcertfile dovecot.pem

Les options --sslproto et --sslcertfile peuvent être enregistrée dans le fichier .fetchmailrc

Le certificat dovecot.pem provient du serveur IMAP dovecot (/etc/dovecot/dovecot.pem) Il peut être récupéré par la commande suivante :

openssl s_client -connect imap.acme.fr:993 </dev/null > dovecot.pem

Exemple de fichier de conf

Récupérer les courriels de mon 2em serveur (secondaire backup DRP) pour les remettre sur le 1er Cette exemple nécessite Procmail

~/.fetchmailrc

### global settings ###
#set syslog
#set daemon 90
set postmaster "postmaster@acme.fr"
set no bouncemail
#set no spambounce

### server settings ###
poll "imap.acme.fr" port 993
protocol IMAP aka acme.fr
envelope "X-Envelope-To:"
timeout 30
#localdomains acme.fr

#### user settings ###
user "alice" password "MOTDEPASS" is alice no keep ssl sslcertck sslcertfile dovecot.pem sslproto TLS1 options fetchall no rewrite warnings 86400 mda "/usr/bin/procmail -f %F -d %T";
smtphost "localhost" smtpname "alice@acme.fr" smtpaddress "localhost"
fetchlimit 25

user "bob" password "MOTDEPASS" is bob no keep ssl sslcertck sslcertfile dovecot.pem sslproto TLS1 options fetchall no rewrite warnings 86400 mda "/usr/bin/procmail -f %F -d %T";
smtphost "localhost" smtpname "bob@acme.fr" smtpaddress "localhost"
fetchlimit 25

Exemple 2

Récupérer mes courriels de Yahoo sur mon serveur perso ~/.fetchmailrc

### global settings ###
set syslog
set daemon 90
set postmaster "postmaster@acme.fr"
#set no bouncemail
#set no spambounce

### server settings ###
poll "pop.mail.yahoo.com" port 995
with protocol POP3 aka acme.fr
envelope "X-Envelope-To:"
timeout 30
localdomains acme.fr

#### user settings ###
user "jblegra@yahoo.fr" password "MOTDEPASS" is jblegra
here no keep ssl
options fetchall no rewrite warnings 86400
smtphost "localhost" smtpname "jblegra@acme.fr" #smtpaddress "acme.fr"
fetchlimit 25
chmod 600 ~/.fetchmailrc
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
blog.txt · Dernière modification : de 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki