...
Implementing SSH tunneling with launchctl on a Mac.I recommend you to watch the preview first.
...
Goal
Goal Sucess Message
Code Block language bash > nc -zv localhost 13326 Connection to localhost port 13326 [tcp/*] succeeded!
If you get anything other than a success message.
DM Crong the contents of "cat ~/.log/autossh/metaflyer/error.log".
Required
install brew
Recommendation "brew update"
install git latest
Code Block brew install git
Code Block brew ugrade git
gitlab
Please disable 2FA
Check gitlab id , password
Please sign in with your personal email (e.g. Gmail).
Do not use "*@i-on.net" mail.
Invite and accept tailsacle - https://login.tailscale.com/admin/invite/7LvR2S1t6xT
and password
Mac's 13326 port should be empty
Install
Code Block language bash > curl -fsSL https://www.ice.i-on.net/bash/metaflyer/bastion/autossh.sh | s
Check
check pid
Code Block language bash > ps -ef|grep autossh 501 48863 1 0 6:04PM ?? 0:00.02 /opt/homebrew/bin/autossh -M 0 -NT -o StrictHostKeyChecking no -o ServerAliveInterval 10 -o ServerAliveCountMax 3 -i ~/.ssh/dxp/bastion/id_rsa -L 13326:customer-rds-test-mf.dxp.internal:3306 bastion@bastion.ice.i-on.net -L 13326:customer-rds-prd-mf.dxp.internal:3306 bastion@bastion.ice.i-on.net
check launchctl with pid
Code Block language bash > launchctl list | grep kr.co.metaflyer.autossh 48863 0 kr.co.metaflyer.autossh
check port
Code Block > nc -zv localhost 13326 Connection to localhost port 13326 [tcp/*] succeeded!
check log
Code Block > cat ~/.log/autossh/metaflyer/error.log
Manual Uninstall (Generally, it's not necessary.)
stop launchctl
Code Block language bash launchctl stop kr.co.metaflyer.autossh && launchctl bootout gui/$UID ~/Library/LaunchAgents/kr.co.metaflyer.autossh.plist && ps -ef | grep autossh | grep -v grep | awk '{ print $2 }' | xargs kill -TERM
delete file
Code Block language bash rm -rf ~/Library/LaunchAgents/kr.co.metaflyer.autossh.plist rm -rf ~/.ssh/dxp rm -rf ~/.log/autossh/metaflyer.log
...