3b280524e17f3d7155b77f6f98ed3733b89c0541
[BK-2020-03.git] / user / bkwpe
1 #!/bin/bash
2
3 # 2019-08-14T21:58:08Z; baltakatei>
4
5 # The purpose of this script is to open a session of firefox dedicated
6 # to editing wikipedia from a remote machine with a public IP address
7 # not on Wikipedia's blocklist.
8
9 # This script:
10 # 1. Creates ssh proxy to remote server
11 # 2. Starts Firefox by calling a local installation of firefox via
12 # its own startup script.
13
14 # Note: This script does not automatically initialize the default
15 # Firefox profile with the correct SOCKS5 settings as can be seen in
16 # "Connection Settings" ("Manual proxy configuration", SOCKS
17 # Host="127.0.0.1", Port="8080"). These changes must be made manually
18 # until an automated method for applying SOCKS settings via edits to
19 # `prefs.js` in the default Firefox profile.
20
21 # Reference:
22
23 # SSH CONNECTION SETTINGS
24 REMOTE_USER=baltakatei
25 REMOTE_IP=76.102.50.36
26 REMOTE_PORT=63865
27 LOCAL_PROXY_PORT=8080
28
29 # STEP 1: Start an SSH master connection (-M)
30 # in the background (-f)
31 # without running a remote command (-N)
32 ssh -p $REMOTE_PORT -M -o ControlPath=/tmp/socks.%r@%h:%p -f -N -D $LOCAL_PROXY_PORT -C $REMOTE_USER@$REMOTE_IP
33
34 # STEP 2: Launch Firefox in the foreground
35 #/home/baltakatei/Desktop/firefox/firefox -P -no-remote
36 /home/baltakatei/Desktop/firefox/firefox -no-remote
37
38 # STEP 3: When user is done with Firefox, send an "exit" command to the master connection
39 ssh -p $REMOTE_PORT -o ControlPath=/tmp/socks.%r@%h:%p -O exit $REMOTE_USER@$REMOTE_IP