stunnel-client
#!/bin/bash # giving user passwordless sudo privileges USER=`whoami` MYPATH=$(cat /etc/passwd|grep $USER|awk -F: '{print $6}') # need to be run as root if [[ "$EUID" -ne 0 ]]; then echo "This script must be run as root" exit 1 fi #parse args while getopts "c:i:p:I:P:z:h" arg do case $arg in c) CONFIG=$OPTARG if [[ ! -f "$CONFIG" ]]; then echo " unvalid arg for -c, ple make sure the config file is exist " exit 1 fi ;; i) PROXY_IP=${OPTARG:-127.0.0.1} ;; p) PROXY_PORT=${OPTARG:-8888} ;; I) SERVER_IP=$OPTARG ;; P) SERVER_PORT=$OPTARG ;; z) ZTE_PROXY=${OPTARG:-proxysh.zte.com.cn} ;; h) echo " -------------args for setting up stunnel--------------------" echo " -c: client certification" echo " -i: proxy ip, default to localhost echo " -p: proxy port, default to 8888" echo " -I: server ip echo " -P: server port listened in server" echo " -z: zte proxy, need to be consistent with system network set" echo "-------------------------------------------------------------" exit 0 ;; ?) echo "unvalid arg" exit 1 ;; esac done if [[ ! $CONFIG || ! $SERVER_IP || ! $SERVER_PORT ]]; then echo " need args, ple use -h for help..." exit 1 fi HTTP_PROXY=http://$PROXY_IP:$PROXY_PORT NO_PROXY=localhost,127.0.0.1,10.*.*.*/8 # use internal apt-source INTER_APT_SOURCE=10.62.99.232 function use_internal_apt_source { sudo mv /etc/apt/sources.list /etc/apt/sources.list.bk sudo cat <<EOF >/etc/apt/sources.list deb http://$INTER_APT_SOURCE/common/ubuntu trusty main restricted multiverse universe deb http://$INTER_APT_SOURCE/common/ubuntu trusty-security main restricted multiverse universe deb http://$INTER_APT_SOURCE/common/ubuntu trusty-updates main restricted multiverse universe deb http://$INTER_APT_SOURCE/common/ubuntu trusty-proposed main restricted multiverse universe deb http://$inter_apt_source/common/ubuntu trusty-backports main restricted multiverse universe EOF sudo apt-get update } # if use internal apt-source to install stunnel, # after install stunnel successfully, ple change back original apt-source function change_back_apt_source { sudo mv /etc/apt/sources.list.bk /etc/apt/sources.list } # (optional) if can not connect to wwww, user internal apt-source use_internal_apt_source sudo apt-get install -y stunnel # (optional) no matter if stunnel package is installed, change back to origin apt-source change_back_apt_source sudo cat << EOF > /etc/stunnel/client.conf chroot = /var/lib/stunnel4/ setuid = stunnel4 setgid = stunnel4 pid = /stunnel4-client.pid client = yes cert = /etc/stunnel/client.pem sslVersion = SSLv3 socket = l:TCP_NODELAY=1 socket = r:TCP_NODELAY=1 [squid] accept = $PROXY_PORT protocol = connect protocolHost = $SERVER_IP:$SERVER_PORT connect = $ZTE_PROXY:80 EOF sudo cp $CONFIG /etc/stunnel/client.pem sudo sed -i -r "s/ENABLED=0/ENABLED=1/g" /etc/default/stunnel4 # restart stunnel sudo service stunnel4 restart #config proxy: append to $MYPATH/.profile cat <<EOF >> /$MYPATH/.profile export http_proxy=$HTTP_PROXY export https_proxy=$HTTP_PROXY export no_proxy=$NO_PROXY EOF sudo cat <<EOF > /etc/apt/apt.conf Acquire::http::proxy \"$HTTP_PROXY/\"; Acquire::https::proxy \"$HTTP_PROXY/\"; EOF source $MYPATH/.profile sudo apt-get update
stunnel-client的更多相关文章
- Stunnel使用2
1.首先测试一下stunnel.exe,是否能正常运行,正常的话,不会报错,在桌面右下角位置显示. 2.第一步完成后,打开stunnel.conf,对stunnel进行配置,需要修改一下几项:(mys ...
- squid+stunnel+用户密码认证的三种玩法
没办法,应用越来越深入,就会越来越多要求. squid+stunnel+用户密码认证的场景至少以下三个,我会遇到. 1,标准玩法 在服务器上建一个SQUID,加密码认证,然后,其它人通过它上网.(不要 ...
- AWS + Stunnel + Squid ***
[需求] 第一,能***. 第二,在企业网络要能突破端口限制. [原理] 利用AWS提供的一年免费EC2服务,搭建一台自己的VPS,在VPS中利用Stunnel与本机建立加密连接,将本地http请求通 ...
- stunnel-server
#!/bin/bash # need to be run as root ]]; then echo "must to be run as root" exit fi # givi ...
- 【原】基于64位Centos6.2的mcrouter使用简介
此文转载必须注明原文地址,请尊重作者的劳动成果! http://www.cnblogs.com/lyongerr/p/5040071.html 目录 文档控制... 2 1 mcrouter简介.. ...
- 用ccproxy + stunnel做个加密代理
https://www.stunnel.org/downloads.html ccproxy + stunnel做个加密http代理和socks5代理 目前国内用户无法访问某些国外网站,如http:/ ...
- stunnel+CCProxy,搭建加密代理
总所周知,不可抗拒的特别有用心的原因,我们无法访问youtube,picasa,Twitter……国外优秀网站,很多人采用了代理服务器的方法访问. 如果您有一台放在海外的服务器,这个就好办了.下载一个 ...
- Windows系统Stunnel客户端的配置
Stunnel官方就有Windows版本,到下面的地址下载: https://www.stunnel.org/downloads.html 选择”stunnel-X.XX-installer.exe“ ...
- Stunnel使用
建立加密隧道 使用 Stunnel 建立加密隧道 附件中的 Server 和 Clinet 都是已经配置好了的,只需修改 Server 的 stunnel.conf 的 connect 为实际的ip ...
随机推荐
- 【图像处理】【SEED-VPM】6.文件目录结构
———————————————————————————————————————————————————————————————————————— seed-vpm6467 \ Hardware Tes ...
- 160个crackme-之Afkayas.1
工具: OD 环境: windows XP 运行: 我们先运行一下这个小程序,看看它到底是干什么的.运行后发现它要我们输入Type In your Name 和Type In your Serial ...
- AndroidManifest.xml file missing!
1.点击菜单栏中的Project——>Clean一下. 2.把AndroidManifest.xml文件再保存一下就可以了.
- SYN攻击
一.TCP握手协议 在TCP/IP协议中,TCP协议提供可靠的连接服务,采用三次握手建立一个连接. 第一次握手:建立连接时,客户端发送syn包(syn=j)到服务器,并进入SYN_SEND状态,等待服 ...
- Web开发中最致命的8个小错误
错误1:表单的label标签跟表单字段没有关联 利用“for”属性允许用户单击label也可以选中表单中的内容.这可以扩大复选框和单选框的点击区域,非常实用. 错误2:logo图片没有链接到主页 点击 ...
- java运算符
赋值运算符 int num1=10; int num2=30; System.out.println(num1+num2); 算术运算符 int num=20; System.out.println( ...
- UIButtonTypeSystem backBarButtonItem
当UIButton是UIButtonTypeSystem类型时,改变UIButton的frame,系统会有一个动画改变效果,不想要这个效果,将类型改为UIButtonTypeCustom. backB ...
- java多线程之 基本概念
一.线程的五种状态 1. 新建状态(New) : 线程对象被创建后,就进入了新建状态.例如,Thread thread = new Thread().2. 就绪状态(Runnable) ...
- LoadRunner录制一个登录
1.点击录制脚本 2.点击左边页面加号
- .NET笔试题集(二)
1.using关键字有什么用?什么是IDisposable? using可以声明namespace的引入,还可以实现非托管资源的释放,实现了IDisposiable的类在using中创建,using结 ...