======secret-tool====== ---- =====Description===== Store and retrieve passwords from the keyring. ---- =====Install===== ====apt==== * Install using apt: sudo apt install libsecret-tools ---- =====Usage===== * **Flags:** * ''%%--label%%'' = Mainly for GUI programs but can be used to retrieve a given secret. * ''%%{attribute}%%'' = Used by the secret-tool for retrieving or deleting a given secret. * ''%%{value}%%'' = Used by the secret-tool for retrieving or deleting a given secret. * Add an entry: secret-tool store --label='My Label' {attribute} {value} {attribute2} {value2} [...] * Retrieve a password: secret-tool lookup {attribute} {value} {attribute2} {value2} [...] * Show entries with similar key/values: secret-tool search --all {attribute} {value} {attribute2} {value2} [...] * Delete an entry: secret-tool clear {attribute} {value} {attribute2} {value2} [...] ---- ====Searching==== * Generic Formatting Example: secret-tool search --all {attribute} {value} [...] * Search ''%%Title%%'': secret-tool search --all Title name * Search ''%%UserName%%'': secret-tool search --all UserName name * Search ''%%URL%%'': secret-tool search --all URL https://www.url.com * Search ''%%Notes%%'': secret-tool search --all Notes value ---- =====Tips===== * Set an alias in ''%%~/.bash_aliases%%'': alias get_password1='secret-tool lookup {attribute} {value} {attribute2} {value2}' * Use in docker: https://www.marian-dan.ro/blog/storing-secrets-using-secret-tool/ ---- ====Use keyring for Ansible==== * Create keyring entry: secret-tool store --label='Ansible Playbook' service ansible_playbook username * Create variable in playbook: admin_user: "username" ansible_become_pass: "{{ lookup('community.general.keyring', 'ansible_playbook {{ admin_user }}') }}" * https://docs.ansible.com/ansible/latest/collections/community/general/keyring_lookup.html ----