From 2a2e309e330a2854c54c9fad376e80090d1603d1 Mon Sep 17 00:00:00 2001 From: DustVoice Date: Tue, 31 May 2022 21:35:30 +0200 Subject: [PATCH] Modify gpg/ssh forwarding stuff --- .ssh/config | 4 ++-- .zsh_alias | 46 ++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 46 insertions(+), 4 deletions(-) diff --git a/.ssh/config b/.ssh/config index 669f9839..53682937 100644 --- a/.ssh/config +++ b/.ssh/config @@ -2,5 +2,5 @@ Host archserver HostName pc.dustvoice.de ForwardAgent yes ForwardX11 yes - RemoteForward /run/user/1000/gnupg/S.gpg-agent /run/user/1000/gnupg/S.gpg-agent.extra - RemoteForward /run/user/1000/gnupg/S.gpg-agent.ssh /run/user/1000/gnupg/S.gpg-agent.ssh + RemoteForward /run/user/1000/gnupg/S.gpg-agent /home/dustvoice/.gnupg/S.gpg-agent.extra + RemoteForward /run/user/1000/gnupg/S.gpg-agent.ssh /home/dustvoice/.gnupg/S.gpg-agent.ssh diff --git a/.zsh_alias b/.zsh_alias index ea773eac..8aec22db 100644 --- a/.zsh_alias +++ b/.zsh_alias @@ -41,7 +41,7 @@ alias resolve='/opt/resolve/bin/resolve' # ====== # ====== -# Pianoteq 6 +# Pianoteq 7 # ====== alias pianoteq='pianoteq\ 7' # ====== @@ -126,7 +126,7 @@ function check-iommu-func() { alias check-iommu='check-iommu-func' function battery-monitor-func() { - watch -t -n 60 '( if [ $(cat /sys/class/power_supply/ACAD/online) == "1" ]; then printf "Power connected\n"; else printf "Power disconnected\n"; fi; printf "\nBattery capacity: "; cat /sys/class/power_supply/BAT1/capacity; printf "\n(Updated every 60s)"; )'; + watch1 -t -n 60 '( if [ $(cat /sys/class/power_supply/ACAD/online) == "1" ]; then printf "Power connected\n"; else printf "Power disconnected\n"; fi; printf "\nBattery capacity: "; cat /sys/class/power_supply/BAT1/capacity; printf "\n(Updated every 60s)"; )'; } alias battery-monitor='battery-monitor-func' @@ -161,3 +161,45 @@ function bspwm-load-func() { alias bspwm-save="bspwm-save-func workspaces workspaces.prev_save" alias bspwm-load="bspwm-load-func workspaces workspaces.prev_load" # === + +# === +# Hyper-V agents forwarding +# === +function hyperv-gpg-agent() { + socket_path="$HOME/.gnupg/S.gpg-agent" + host_ip=$(ip route show 0.0.0.0/0 dev eth0 | cut -d\ -f3) + if [[ -f $socket_path ]]; then + rm $socket_path + fi + (setsid socat UNIX-LISTEN:$socket_path,fork tcp-connect:$host_ip:59545) +} + +function hyperv-gpg-agent-extra() { + socket_path="$HOME/.gnupg/S.gpg-agent.extra" + host_ip=$(ip route show 0.0.0.0/0 dev eth0 | cut -d\ -f3) + if [[ -f $socket_path ]]; then + rm $socket_path + fi + (setsid socat UNIX-LISTEN:$socket_path,fork tcp-connect:$host_ip:59544) +} + +function hyperv-ssh-agent() { + #socket_path="$HOME/.gnupg/S.gpg-agent.ssh" + socket_path="$HOME/.ssh/agent.sock" + host_ip=$(ip route show 0.0.0.0/0 dev eth0 | cut -d\ -f3) + if [[ -f $socket_path ]]; then + rm $socket_path + fi + (setsid socat UNIX-LISTEN:$socket_path,fork tcp-connect:$host_ip:59546) +} + +function hyperv-agents() { + hyperv-gpg-agent + #hyperv-gpg-agent-extra + hyperv-ssh-agent +} + +alias hyperv-gpg-forward="hyperv-gpg-agent" +alias hyperv-ssh-forward="hyperv-ssh-agent" +alias hyperv-forward="hyperv-agents" +# ===