Last active
January 7, 2022 12:49
-
-
Save johnstanfield/2c19021e4d2093d2912e5674784886c4 to your computer and use it in GitHub Desktop.
open google chrome via socks5 tunnel to aws
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# prerequisites | |
# 1) you have a (Linux) EC2 instance with SSH enabled, source/destination check disabled, etc. | |
# 2) you have a security group rule with a tag named roaming (this script updates that rule to allow you access) (note: tag the rule, not the security group) | |
# grant access to your IP access | |
myip=$(curl -s https://ipv4.icanhazip.com) | |
read sgid sgrid < <(echo $(aws ec2 describe-security-group-rules --filter Name=tag:Name,Values=roaming | jq '.SecurityGroupRules[0].GroupId, .SecurityGroupRules[0].SecurityGroupRuleId' -r)) | |
aws ec2 modify-security-group-rules --group-id $sgid --security-group-rules SecurityGroupRuleId=$sgrid,SecurityGroupRule=\{CidrIpv4=$myip\/32,FromPort=22,ToPort=22,IpProtocol=TCP,Description=roaming\} | |
# open tunnel | |
# -f=background -N=don't execute command -D=local port | |
ssh -fND 1337 yourname@yourhost | |
# open chrome using the tunnel | |
# it is easier to open chrome like this than fiddle and unfiddle with chrome settings | |
# it opens to ipv4.icanhazip.com so you can confirm you're using the tunnel | |
# make sure chrome is not already running or chrome will not use the tunnel | |
google-chrome --proxy-server="socks5://127.0.0.1:1337" http://ipv4.icanhazip.com |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment