Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save marcosyonaware/f69bae71ad35c6f55af40cd45074b84f to your computer and use it in GitHub Desktop.
Save marcosyonaware/f69bae71ad35c6f55af40cd45074b84f to your computer and use it in GitHub Desktop.
Quick tunnel connection using ssh password stored in bitwarden
#!/bin/bash
set -e
BITWARDEN_ENTRY_ID="TODO" # à remplir depuis `$ bw list items --search name_of_my_entry`
echo "🔒 getting ssh password from bitwarden"
bw get password ${BITWARDEN_ENTRY_ID} | pbcopy
echo "🔑 ssh password can be pasted for 10 seconds, from now"
(sleep 10; echo "🧹 clearing password"; echo -n '' | pbcopy)&
echo "🚇 opening ssh tunnel => paste your ssh password when requested"
sudo ssh -L 443:localhost:443 destination 'echo "🚉 tunnel is open => press Ctrl-C to quit"; sh'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment