Surfing the web with Safari (3.0.4) on Mac OS X 10.4 can be made a bit more private & secure by setting up a local SOCKS Proxy on an admin user account.
Use the following BASH command-line instructions at your own risk!
I. Setting up a local SOCKS proxy for Safari on a single admin user account
sudo launchctl list | grep com.openssh.sshd
defaults read /System/Library/LaunchDaemons/ssh
netstat -an | awk '/\*\.22[[:space:]]+.*LISTEN$/ {print}'
service --test-if-available ssh; echo $?
service --test-if-configured-on ssh; echo $?
otool -L /usr/sbin/sshd | grep libwrap
ping -c 10 checkip.dyndns.org
curl -L -s --max-time 10 http://checkip.dyndns.org | grep -Eo -m 1 '([[:digit:]]{1,3}\.){3}[[:digit:]]{1,3}'
ssh -q -D 8080 -f -C -N -x $(whoami)@127.0.0.1
mkdir -p $HOME/.ssh
chmod -R 0700 $HOME/.ssh
ssh-keygen -t rsa -f $HOME/.ssh/id_rsa -P ''
cp -p $HOME/.ssh/id_rsa.pub $HOME/.ssh/authorized_keys2
chmod 0600 $HOME/.ssh/authorized_keys2
srm -v $HOME/.ssh/id_rsa.pub
ssh-keygen -H -f $HOME/.ssh/known_hosts
srm -v $HOME/.ssh/known_hosts.old
chmod 0600 $HOME/.ssh/known_hosts
sudo sh -c "
echo '
# added
Protocol 2
PermitRootLogin no
PermitEmptyPasswords no
ChallengeResponseAuthentication no
PasswordAuthentication no
UsePAM no
PubkeyAuthentication yes
AuthorizedKeysFile $HOME/.ssh/authorized_keys2
#KeepAlive yes
MaxAuthTries 3
MaxStartups 3
#UseDNS no
LoginGraceTime 40
LogLevel INFO # QUIET, FATAL, ERROR, INFO, VERBOSE, DEBUG
#AllowUsers $(whoami) # add more users if you like: ~<TAB><TAB> (in Terminal.app) or dscl . -list /Users
AllowUsers $(whoami)@127.0.0.1 # cf. ssh -q -D 8080 -f -C -N -x $(whoami)@127.0.0.1 above
#AllowUsers $(whoami)@$(ipconfig getifaddr $(route -n get default | awk '/interface:/ { print $2 }') 2>/dev/null) # requires internet connection
#AllowGroups sshusersgroup # cf. dscl . -list /Groups; groups
' >> /private/etc/sshd_config
"
open -a Safari
sudo reboot
ssh -q -D 8080 -f -C -N -x $(whoami)@127.0.0.1
scutil --proxy
sudo ln -s "/Applications/Utilities/Network Utility.app/Contents/Resources/stroke" /bin/portscan
portscan localhost 8000 8100
lsof -i :22 -P
lsof -i :8080 -P
lsof -i TCP -P
lsof -U -P
sudo lsof -U -P
netstat -n -f inet
ipconfig getifaddr $(route -n get default | awk '/interface:/ { print $2 }')
open -a Safari http://www.auditmypc.com/software_audit.asp
open -a Safari http://www.whatsmyip.org/more/
II. Setting up a local SOCKS proxy for Safari using two different user accounts on the same computer
regular_user_name="$(whoami)"
regular_user_path="$HOME"
echo $regular_user_name $regular_user_path
ping -c 10 checkip.dyndns.org
curl -L -s --max-time 10 http://checkip.dyndns.org | grep -Eo -m 1 '([[:digit:]]{1,3}\.){3}[[:digit:]]{1,3}'
regular_user_name="...insert information from regular user account above..."
regular_user_path="...insert information from regular user account above..."
internal_IP_address=$(ipconfig getifaddr $(route -n get default | awk '/interface:/ { print $2 }'))
echo $internal_IP_address $regular_user_name $regular_user_path
service --test-if-available ssh; echo $?
service --test-if-configured-on ssh; echo $?
mkdir -p $HOME/.ssh
chmod -R 0700 $HOME/.ssh
ssh-keygen -t rsa -f $HOME/.ssh/id_rsa -P ''
cp -p $HOME/.ssh/id_rsa.pub $HOME/.ssh/authorized_keys2
chmod 0600 $HOME/.ssh/authorized_keys2
srm -v $HOME/.ssh/id_rsa.pub
ls -ld $HOME/.ssh
ls -l $HOME/.ssh
sudo mkdir -p $regular_user_path/.ssh
sudo chmod -R 0700 $regular_user_path/.ssh
sudo cp $HOME/.ssh/authorized_keys2 $regular_user_path/.ssh/authorized_keys2
sudo chown -R $regular_user_name:$regular_user_name $regular_user_path/.ssh
sudo chmod 0600 $regular_user_path/.ssh/authorized_keys2
sudo ls -l $regular_user_path/.ssh
sudo ls -ld $regular_user_path/.ssh
ssh -i $HOME/.ssh/id_rsa $regular_user_name@$internal_IP_address
exit
ssh-keygen -H -f $HOME/.ssh/known_hosts
srm -v $HOME/.ssh/known_hosts.old
chmod 0600 $HOME/.ssh/known_hosts
ssh -i $HOME/.ssh/id_rsa $regular_user_name@$internal_IP_address
ls
exit
sudo sh -c "
echo '
# added
Protocol 2
PermitRootLogin no
PermitEmptyPasswords no
ChallengeResponseAuthentication no
PasswordAuthentication no
UsePAM no
PubkeyAuthentication yes
#AuthorizedKeysFile $regular_user_path/.ssh/authorized_keys2
#KeepAlive yes
MaxAuthTries 3
MaxStartups 3
#UseDNS no
#PermitUserEnvironment yes # requires ~/.ssh/environment file; see man ssh and man sshd_config
LoginGraceTime 40
LogLevel INFO # QUIET, FATAL, ERROR, INFO, VERBOSE, DEBUG
#AllowUsers $(whoami) $regular_user_name
AllowUsers $(whoami)@$internal_IP_address $regular_user_name@$internal_IP_address
' >> /private/etc/sshd_config
"
ssh -q -D 8080 -f -C -N -x $regular_user_name@$internal_IP_address
open -a Safari
scutil --proxy
portscan localhost 8000 8100
ssh -p 22 $regular_user_name@$internal_IP_address ls
ssh -l $regular_user_name $internal_IP_address 'echo hello world; whoami; hostname; logname'
open -a Safari http://www.auditmypc.com/software_audit.asp
open -a Safari http://www.whatsmyip.org/more/
Further information on SSH & Mac OS X:
-
Getting started with SSH-
Remote Login With SSH-
SSH Without A Password-
Exit Your SSH Session Without Killing Your Job-
SSH on Mac OS X-
SSH-
ssh tunnelling-
ssh X forwarding debugging-
Tutorial: SSH To Alternate Ports and Enabling Multiple SSH Daemons-
Route All Your Internet Traffic Through a Proxy-
SSH Notes-
SSH Host Key Protection-
Setup the SSH server to use keys for authentication-
Auto-closing SSH tunnels-
SSH Tunnelling (Port Forwarding)-
Defending against brute force ssh attacks-
SSH + Screen = Easy Administration-
SSH SOCKS Proxy From Behind a Gateway-
nylon - flexible Unix proxy server with mirror mode; sudo port install nylon
-
tsocks - transparent SOCKS proxying library; sudo port install tsocks
-
Create a SOCKS proxy with SSH in Leopard