Self Service for SSH DB Connection

New Contributor

We have a DB that needs an ssh tunnel in order for the user to connect. What might be the best way to automate this and make it as easy for the user as possible. Obviously these are non-tech people otherwise we'd just tell them to ssh via terminal.

Let's say we wanted to push a private key to each user, make a self service button that said Connect to DB. Possible? Better alternatives? This is essentially what I do now via ab alias. I have the added complexity of storing my private key in an encrypted dmg file, we'll have filevault on all machines and could push this into /Users/username/.ssh/keys/ for example

$ ukdb

$ alias ukdb='ssh -fNg -o ExitOnForwardFailure=yes -o ServerAliveInterval=15 -L -i /Volumes/secure-dmg/keys/mysql-key;'