RagHon Consulting
+47 98237711
  • Home
  • Services
  • Products
    • Oracle Enterprise Ops Center >
      • Links
      • Youtube
    • Self Extracting Zip Files
    • RC 2 SMF toolkit
    • RBAC aware user provisioning
    • Oracle Software
    • Oracle Hardware
    • Citrix Software
  • Partners
  • Blog
  • Contact
  • About
  • Support
    • Documents
  • Apps
  • Hjem

OSX + proxy config on the comandline

11/2/2014

0 Comments

 
I find that I'm working on networks with and without a proxy. And have been pointing and clicking to enable disable the socks proxy. Had a quick google and found this beautiful little command : 

  • sudo networksetup  -setsocksfirewallproxystate Wi-Fi off
  • sudo networksetup  -setsocksfirewallproxy Wi-Fi localhost 20000
  • sudo networksetup  -setsocksfirewallproxystate Wi-Fi on

My small script (added as a bash function in .bash_profile)
proxy () {
    case $1 in
        on)
            ssh -fN proxy-init
            sudo networksetup  -setsocksfirewallproxy Wi-Fi localhost 20000
            sudo networksetup  -setsocksfirewallproxystate Wi-Fi on
            ;;
        off)
            sudo networksetup  -setsocksfirewallproxystate Wi-Fi off
            ps -ef | awk '/ssh -fN uio-init/ && !/awk/ {print $2}' | xargs kill
            ;;
   esac
}


PS : the ssh commands are used to initialise some ports via ssh. proxy-init is a ssh "makro"  defined in my ~/.ssh/config file. 

It looks like almost like this : 

Host uio-init
User ragnahon
ControlMaster yes
ControlPath /tmp/.watershed_ssh_session
DynamicForward 127.0.0.1:20000
LocalForward 127.0.0.1:3389 a-rdp.server.at.my.company.com:3389
ProxyCommand ssh  -qax myusername@login.company.com 'nc -X 5 -w 60000 my.server.company.com 22'

0 Comments



Leave a Reply.

    View my profile on LinkedIn

    Author

    Ragnar Hongset @ RagHon Consulting. Independent consultant with 9 years of experience working for SUN Microsystems, and 15+ years experience with Solaris systems.

    Archives

    Mai 2014
    Februar 2014
    Mars 2013
    Februar 2013
    Januar 2013
    April 2012
    Februar 2012
    November 2011

    Categories

    Alle
    Cheat
    Comstar
    Dns
    Encryption
    Ios
    Ipadm
    Iscsi
    Ledvil
    Mac
    Mpxio
    Nexenta
    Nsswitch.conf
    Opensolaris
    Oracle Virtual Desktop Infrastructure
    Osx
    Pgp
    Resolv.conf
    Smf
    S/MIME
    Snap
    Solaris
    Solaris 11
    Solaris 9
    Sun Ray
    Svccfg
    Svcs
    Trusted Extentions
    Tx
    Unix
    Vdi
    Windows
    Xp

    RSS-feed