diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2021-12-14 00:58:22 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2021-12-14 02:16:16 +0100 |
commit | e3c15ec94649c7ba079c3332fc4afc5bda0b4b5a (patch) | |
tree | 215c9048c49c5fbcab9484893024b0bd42f74d9f /modules/profiles/files | |
parent | Merge branch 'raspi' (diff) | |
download | webdav_server-e3c15ec94649c7ba079c3332fc4afc5bda0b4b5a.tar.gz webdav_server-e3c15ec94649c7ba079c3332fc4afc5bda0b4b5a.tar.xz |
Migrate stuff from ansible.
Diffstat (limited to 'modules/profiles/files')
-rwxr-xr-x | modules/profiles/files/passmenu | 29 | ||||
-rw-r--r-- | modules/profiles/files/ssh-agent.service | 13 |
2 files changed, 42 insertions, 0 deletions
diff --git a/modules/profiles/files/passmenu b/modules/profiles/files/passmenu new file mode 100755 index 0000000..653ebda --- /dev/null +++ b/modules/profiles/files/passmenu @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +shopt -s nullglob globstar + +typeit=0 +if [[ $1 == "--type" ]]; then + typeit=1 + shift +fi + +prefix=${PASSWORD_STORE_DIR-~/.password-store} +password_files=( "$prefix"/**/*.gpg ) +password_files=( "${password_files[@]#"$prefix"/}" ) +password_files=( "${password_files[@]%.gpg}" ) + +password=$(printf '%s\n' "${password_files[@]}" | dmenu "$@") + +[[ -n $password ]] || exit + +if [[ "$password" == *-otp ]]; then + otp='otp' +fi + +if [[ $typeit -eq 0 ]]; then + pass $otp show -c "$password" 2>/dev/null +else + pass $otp show "$password" | { IFS= read -r pass; printf %s "$pass"; } | + xdotool type --clearmodifiers --file - +fi diff --git a/modules/profiles/files/ssh-agent.service b/modules/profiles/files/ssh-agent.service new file mode 100644 index 0000000..d49edc6 --- /dev/null +++ b/modules/profiles/files/ssh-agent.service @@ -0,0 +1,13 @@ +# https://unix.stackexchange.com/questions/339840/how-to-start-and-use-ssh-agent-as-systemd-service + +[Unit] +Description=SSH key agent + +[Service] +Type=simple +Environment=SSH_AUTH_SOCK=%t/ssh-agent.socket +# ExecStart=/usr/bin/ssh-agent -D -a $SSH_AUTH_SOCK +ExecStart=/usr/bin/ssh-agent -D -a $SSH_AUTH_SOCK + +[Install] +WantedBy=default.target |