User Tools

Site Tools



This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
osx:start [2019/02/25 14:40]
robm [VPN over SSH] Add instructions for automating via SSH config files
osx:start [2019/05/23 09:33]
robm [GPG with remote forwarding]
Line 756: Line 756:
 ===== Automating via SSH configuration files ===== ===== Automating via SSH configuration files =====
 +<note important>​All commands here are run as **root** on the client system</​note>​
   - **As root** on your client system, generate a new SSH keypair to use for VPN. <​code>​ssh-keygen -f ~/​.ssh/​id_rsa_vpn -N ''</​code>​   - **As root** on your client system, generate a new SSH keypair to use for VPN. <​code>​ssh-keygen -f ~/​.ssh/​id_rsa_vpn -N ''</​code>​
Line 801: Line 803:
 route delete 10/8 $GATEWAY route delete 10/8 $GATEWAY
 route delete $REMOTE_HOST $GATEWAY route delete $REMOTE_HOST $GATEWAY
-) &</​code>​+) &</​code> ​This script is unlikely to work on other OS
   - Make the new script executable: <​code>​chmod a+x ~root/​.ssh/​</​code>​   - Make the new script executable: <​code>​chmod a+x ~root/​.ssh/​</​code>​
   - Test it by running <​code>​ssh vpn</​code>​   - Test it by running <​code>​ssh vpn</​code>​
Line 901: Line 903:
   brew cask install smcfancontrol   brew cask install smcfancontrol
 +====== GPG with remote forwarding ======
 +GPG Agent forwarding allows a remote system to access secrets held in your local system via an SSH tunnel. When you are not connected to the remote system, it cannot access your secrets, and if the remote system is compromised your secrets are not (since they are never stored on it).
 +My (initial) use-case is to allow docker on a remote host to store login my login credentials (so I can push/pull images when working), but not store secrets on that hose. THe default behaviour is to store my password in plain text, which is unacceptable.
 +So I opted to use [[https://​​engine/​reference/​commandline/​login/#​credentials-store|docker credentials management]] and [[https://​​|pass]]. The ''​pass''​ tool uses GPG to encrypt and decrypt passwords. If I use GPG the traditional way (with secret keys in my $HOME directory) I've not gained any security: the encrypted password and and the decryption key are on the same host!
 +So I want to use GPG agent forwarding to allow ''​pass''​ to decrypt secrets while I am connected and working, without the decryptions keys ever leaving my laptop.
 +Overview (notes to follow, I hope):
 +  - Install GPG locally and create an identity
 +  - Ensure that passphrase challenge ("​pinentry"​) does _not_ use the TTY, since the TTY at the remote won't match local - better to use a GUI or the OSX KeyChain
 +  - Install GPG on remote, and import public key
 +  - Configure SSH to forward agent socket
 +  - Disable systemd stuff which creates (unused) gpg sockets and/or configure SSHd to allow you to delete and recreate those sockets
 +  - ''​brew install gnupg gpg-agent pinentry-mac''​
 +  - Append to ''​~/​.profile'':​ <​code>​ if [ -f ~/​.gnupg/​.gpg-agent-info ] && [ -n "​$(pgrep gpg-agent)"​ ]; then
 +    source ~/​.gnupg/​.gpg-agent-info
 +    export GPG_AGENT_INFO
 +    eval $(gpg-agent --daemon --write-env-file ~/​.gnupg/​.gpg-agent-info)
 +  - Create/​modify the following GPG files:
 +    - ''​mkdir -p ~/​.gnupg''​
 +    - ''​~/​.gnupg/​gpg.conf'':<​code>​use-agent</​code>​
 +    - ''​~/​.gnupg/​gpg-agent.conf'':<​code>​ use-standard-socket
 +pinentry-program /​usr/​local/​bin/​pinentry-mac
 +default-cache-ttl 600
 +max-cache-ttl 7200</​code>​
 +<​code>​echo "​foo"​ | gpg --encrypt -r "​Robert Meerman"​ | gpg --decrypt</​code>​
osx/start.txt · Last modified: 2019/09/09 20:28 by robm