最终方案

  • 自动登录代码,基于expect
  • #!/usr/bin/expect -f
    set timeout 300
    spawn ssh -qTfnN -D 7070 xxxxx@my.cutessh.info
    expect {
    	"*yes/no*" { send "yes\r" }
    	"*password*" { send "xxxxx\r" }
    }
    interact
    
  • 开机启动代码,放在/etc/rc.local
  • sleep 60 && /usr/bin/expect -f /home/tsung/ssh.exp
    
  • polipo配置文件,放在/etc/polipo/config
  • socksParentProxy = "localhost:7070"
    socksProxyType = socks5
    
    proxyAddress = "127.0.0.1"
    proxyPort = 1984
    

    弯路

  • 本来想用privoxy作socks转http,死活不成功,最终在一个网站看到说对karmic发行版貌似不支持,用sysv-rc-conf看了下,服务是打开的
  • 刚开始没写好启动代码,用任务去跑
  • crontab -e
    */5 * * * * /usr/bin/expect -f /home/tsung/ssh.exp >> /home/tsung/errtask 2>&1