gnupg: ensure ssh uses gnupg-agent
Loads the gnupg_agent-skript in the ~/.bashrc, which exports the needed variables (SSH_AUTH_SOCK, SSH_AGENT_PID, GPG_AGENT_INFO). Also downloads the pubkey of the user and sets ownertrust on the key. Fixes #3
This commit is contained in:
@ -38,8 +38,26 @@
|
||||
dest: "{{ gpg_folder }}/gnupg_agent"
|
||||
mode: 0700
|
||||
|
||||
- name: Ensure gnupg_agent skript is included in .bashrc so SSH uses gpg-agent
|
||||
blockinfile:
|
||||
path: "~/.bashrc"
|
||||
insertafter: "\[\[ \$- != \*i\* \]\] && return"
|
||||
line: |
|
||||
# load script telling SSH to use the gpg agent
|
||||
source "{{ gpg_folder }}"/gnupg_agent
|
||||
state: present
|
||||
|
||||
- name: Download own pubkey
|
||||
get_url:
|
||||
url: "https://git.finallycoffee.eu/{{ gpg_user }}/about/raw/branch/master/pubkey.asc"
|
||||
dest: "~/{{ gpg_user }}.pub"
|
||||
|
||||
|
||||
|
||||
- name: Import own pubkey and set owner-trust
|
||||
command:
|
||||
cmd: |
|
||||
gpg2 --no-tty --command-fd 0 --import ~/{{ gpg_user }}.pub << EOF
|
||||
trust
|
||||
5
|
||||
quit
|
||||
EOF
|
||||
|
||||
|
Reference in New Issue
Block a user