Automatically trigger BankID login through SSH.

This commit is contained in:
dabruh 2022-06-05 02:54:00 +02:00
parent 0e27fa5cfa
commit 20764a342a
2 changed files with 15 additions and 1 deletions

14
.local/bin/send-bankid-token Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
# Takes a bankid URI as input, extracts the token and writes the token to disk
# on a target Windows SSH host. The target host is expected to watch for this
# file, just like the following PowerShell script does:
# https://gitlab.com/dabruh/weird-corner/-/blob/main/powershell/BankIDTokenFileWatcher.ps1
TOKEN=${1:?} || exit 1
TOKEN="${TOKEN#*=}"
TOKEN="${TOKEN%&*}"
xclip -selection clipboard <<<"$TOKEN"
ssh bankid -- powershell.exe -NoLogo -ExecutionPolicy Bypass -Command "Set-Content -Path C:\.bidtoken -Value '$TOKEN'" &
notify-send BankID "Token has been sent." &

View File

@ -1,4 +1,4 @@
[Desktop Entry]
Type=Application
Name=BankID URI xclip
Exec=bash -c "xclip -selection clipboard <<<%u"
Exec=bash -c "send-bankid-token '%u'"