bw password muckery
This commit is contained in:
parent
d25dd29b65
commit
9a7fe73014
4 changed files with 47 additions and 5 deletions
|
@ -5,7 +5,7 @@ Description=SSH key agent
|
||||||
Type=forking
|
Type=forking
|
||||||
Environment=SSH_AUTH_SOCK=%h/.ssh/ssh_auth_sock
|
Environment=SSH_AUTH_SOCK=%h/.ssh/ssh_auth_sock
|
||||||
ExecStartPre=/usr/bin/rm -f $SSH_AUTH_SOCK
|
ExecStartPre=/usr/bin/rm -f $SSH_AUTH_SOCK
|
||||||
ExecStart=/usr/bin/ssh-agent -a $SSH_AUTH_SOCK -t 3600
|
ExecStart=/usr/bin/ssh-agent -a $SSH_AUTH_SOCK -t 18200
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=default.target
|
WantedBy=default.target
|
||||||
|
|
9
.zshrc
9
.zshrc
|
@ -11,7 +11,7 @@ export PATH=$HOME/bin:$PATH:/bin:/sbin:/usr/sbin:/usr/local/sbin
|
||||||
|
|
||||||
export EDITOR=nvim
|
export EDITOR=nvim
|
||||||
#export DISPLAY=:0
|
#export DISPLAY=:0
|
||||||
export GDK_SCALE=2
|
export GDK_SCALE=1.5
|
||||||
|
|
||||||
fpath=(~/.zsh/functions $fpath)
|
fpath=(~/.zsh/functions $fpath)
|
||||||
|
|
||||||
|
@ -182,7 +182,9 @@ function prompt_command {
|
||||||
# alias zshconfig="mate ~/.zshrc"
|
# alias zshconfig="mate ~/.zshrc"
|
||||||
# alias ohmyzsh="mate ~/.oh-my-zsh"
|
# alias ohmyzsh="mate ~/.oh-my-zsh"
|
||||||
|
|
||||||
alias ls='ls --color=auto --group-directories-first --human-readable --almost-all'
|
# alias ls='ls --color=auto --group-directories-first --human-readable --almost-all'
|
||||||
|
alias ls=exa
|
||||||
|
alias bat=bat --theme=ansi-light
|
||||||
|
|
||||||
bindkey -e
|
bindkey -e
|
||||||
bindkey "^[[A" history-substring-search-up
|
bindkey "^[[A" history-substring-search-up
|
||||||
|
@ -249,6 +251,9 @@ command -v helm >/dev/null 2>&1 && source <(helm completion zsh)
|
||||||
command -v ark >/dev/null 2>&1 && source <(ark completion zsh)
|
command -v ark >/dev/null 2>&1 && source <(ark completion zsh)
|
||||||
command -v stern >/dev/null 2>&1 && source <(stern --completion zsh)
|
command -v stern >/dev/null 2>&1 && source <(stern --completion zsh)
|
||||||
|
|
||||||
|
# Flux
|
||||||
|
export FLUX_FORWARD_NAMESPACE=flux
|
||||||
|
|
||||||
[ -f /usr/share/bash-completion/completions/aws ] && source /usr/share/bash-completion/completions/aws
|
[ -f /usr/share/bash-completion/completions/aws ] && source /usr/share/bash-completion/completions/aws
|
||||||
[ -f /opt/google-cloud-sdk/completion.zsh.inc ] && source /opt/google-cloud-sdk/completion.zsh.inc
|
[ -f /opt/google-cloud-sdk/completion.zsh.inc ] && source /opt/google-cloud-sdk/completion.zsh.inc
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
AUTO_LOCK=900
|
AUTO_LOCK=3600
|
||||||
BW_SESSION=
|
BW_SESSION=
|
||||||
|
|
||||||
exit_error() {
|
exit_error() {
|
||||||
echo "$2"
|
echo "$2"
|
||||||
|
keyctl purge user bw_master || true
|
||||||
|
keyctl purge user bw_session || true
|
||||||
exit "$1"
|
exit "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
37
bin/pwenv
37
bin/pwenv
|
@ -1,7 +1,42 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
|
purge=0
|
||||||
|
ttl=259200
|
||||||
|
|
||||||
|
usage() { echo "Usage: $0 [-t SECONDS] [-f]" 1>&2; exit 1; }
|
||||||
|
|
||||||
|
while getopts ":ft:" o; do
|
||||||
|
case "${o}" in
|
||||||
|
f)
|
||||||
|
purge=1
|
||||||
|
;;
|
||||||
|
t)
|
||||||
|
ttl=${OPTARG}
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
usage
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
shift $((OPTIND-1))
|
||||||
|
|
||||||
var="$1"
|
var="$1"
|
||||||
shift
|
shift
|
||||||
|
|
||||||
exec env ${var}=$(systemd-ask-password --accept-cached --keyname="pwenv.${var}" "${var}: ") "$@"
|
if [ -z "${var}" ]; then
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
|
||||||
|
function get_password() {
|
||||||
|
key="pwenv.${var}"
|
||||||
|
if [ "${purge}" == "1" ]; then
|
||||||
|
keyctl purge user ${key} 2>&1 >>/dev/null || true
|
||||||
|
fi
|
||||||
|
out=$(systemd-ask-password --accept-cached --keyname="${key}" "${var}:")
|
||||||
|
key_id=$(keyctl request user ${key} 2>/dev/null)
|
||||||
|
keyctl timeout $key_id $ttl
|
||||||
|
echo $out
|
||||||
|
}
|
||||||
|
|
||||||
|
exec env ${var}=$(get_password) "$@"
|
||||||
|
|
Loading…
Reference in a new issue