stunnel-server
#!/bin/bash
# need to be run as root
]]; then
echo "must to be run as root"
exit
fi
# giving user passwordless sudo privileges
who=`whoami`
myhomepath=$(cat /etc/passwd|grep $who|awk -F: '{print $6}')
# receive specific port from cmd,
PORT=${:-}
#install package
sudo apt-get install -y squid stunnel
# generate key, including client & server
cd /etc/stunnel
openssl req -new -x509 -days -batch -nodes -config /usr/share/doc/stunnel4/examples/stunnel.cnf -out server.pem -keyout server.pem
openssl req -new -x509 -days -batch -nodes -config /usr/share/doc/stunnel4/examples/stunnel.cnf -out client.pem -keyout client.pem
# modify (if not exist, will create) stunnel config
sudo cat <<EOF >/etc/stunnel/stunnel.conf
chroot = /var/lib/stunnel4/
setuid = stunnel4
setgid = stunnel4
pid = /stunnel4.pid
debug =
output = stunnel.log
cert = /etc/stunnel/server.pem
#sslVersion = SSLv3
verify =
CAfile = /etc/stunnel/client.pem
socket = r:TCP_NODELAY=
socket = l:TCP_NODELAY=
[squid]
accept = $PORT
connect =
EOF
# config squid
sudo sed -i -r "s/^#acl localnet src 10.0.0.0/acl localnet src 10.0.0.0/g" /etc/squid3/squid.conf
sudo sed -i -r "s/^#acl localnet src 172.16.0.0/acl localnet src 172.16.0.0/g" /etc/squid3/squid.conf
sudo sed -i -r "s/^#acl localnet src 192.168.0.0/acl localnet src 192.168.0.0/g" /etc/squid3/squid.conf
sudo sed -i -r "s/^#acl localnet src fc00::/acl localnet src fc00::/g" /etc/squid3/squid.conf
sudo sed -i -r "s/^#acl localnet src fe80::/acl localnet src fe80::/g" /etc/squid3/squid.conf
sudo sed -i -r "/acl Safe_ports port 777/a acl SSL_ports port 443 6667 7709 143 993 585 5223 29418 \\n" /etc/squid3/squid.conf
sudo sed -i -r "/acl CONNECT method CONNECT/a acl irc_port port 6667\\nacl irc dstdomain irc.freenode.net\\nhttp_access allow irc irc_port \\n" /etc/squid3/squid.conf
# important...
sed -i -r "s/ENABLED=0/ENABLED=1/g" /etc/default/stunnel4
# restart service
sudo service stunnel4 restart
stunnel-server的更多相关文章
- Stunnel使用2
1.首先测试一下stunnel.exe,是否能正常运行,正常的话,不会报错,在桌面右下角位置显示. 2.第一步完成后,打开stunnel.conf,对stunnel进行配置,需要修改一下几项:(mys ...
- (转)用stunnel给普通http通信加密
转自:https://www.digitalocean.com/community/tutorials/how-to-set-up-an-ssl-tunnel-using-stunnel-on-ubu ...
- 【原】基于64位Centos6.2的mcrouter使用简介
此文转载必须注明原文地址,请尊重作者的劳动成果! http://www.cnblogs.com/lyongerr/p/5040071.html 目录 文档控制... 2 1 mcrouter简介.. ...
- Windows系统Stunnel客户端的配置
Stunnel官方就有Windows版本,到下面的地址下载: https://www.stunnel.org/downloads.html 选择”stunnel-X.XX-installer.exe“ ...
- Stunnel服务端
Stunnel on Debian GNU/Linux 6 (squeeze) 传统的POP3, SMTP, Samba等服务,都是不加密的协议(即在网络上明文传输数据),通过stunnel,可以将访 ...
- Stunnel使用
建立加密隧道 使用 Stunnel 建立加密隧道 附件中的 Server 和 Clinet 都是已经配置好了的,只需修改 Server 的 stunnel.conf 的 connect 为实际的ip ...
- 常用工具之stunnel
The stunnel program is designed to work as an SSL encryption wrapper between remote client and local ...
- 安装Stunnel来实现正向代理邮件
文:铁乐与猫 2017年8月 一开始我是使用yum install来安装stunnel的 感觉版本低点也无所谓,毕竟只是拿来加密代理一下邮件收发. 可是后来发现之前下载的最新官网版本的tar包里有很多 ...
- linux下使用Stunnel配置与使用方式一例
第一部分:stunnel的安装与配置 注:在ubuntu下,stunnel的安装很简单快捷. 在synaptic(安立得工具系统下可以直接选举安装) 在服务器环境下,直接使用apt-get insta ...
随机推荐
- vs 中统计代码行数
------解决方案--------------------b*[^:b#/]+.*$^b*[^:b#/]+.*$ ctrl + shift + F 查找选项勾选 正则表达式
- <java基础学习>JAVA 对象和类
Java is an Object-Oriented Language. As a language that has the Object Oriented feature, Java suppor ...
- C#获取实体类属性名称
方法: public static string GetPropertyName(Expression<Func<SupplierInfos, string>> expr) { ...
- Java Mysql分页显示
public class View { private int currentPage; private int pageSize; private int recordCount; public V ...
- 一个简单的游戏开发框架(四.舞台Stage)
首先是StageManager类: class StageManager : public Singleton<StageManager> { friend class Singleton ...
- android学习之ListView
移通152余继彪 该组件用于显示列表的view 包含了三个关键元素 listView 适配器 以及数据,适配器主要是用于将数据映射到listview,适配器数据主要是有hasmap 配合list对每 ...
- android 多个notifycation向同一个Actiivity传递不同数据
如果你有这方面的需求,那你实践的时候可能会发现,多个Notifycation点击的时候会传递相同的数据. 通常情况下我们可能这样写. Notification notification = new N ...
- 用PowerMock mock 由工厂方法产生的对象
有些对象需要mock的对象是由工厂方法产生出来的,而工厂方法一般是静态方法,这时候就需要同时mock工厂方法及对象 被测方法: public class EmployeeServiceFactory ...
- java之ubuntu12.04 开发环境配制
配置java开发环境,即安装jdk: 1.配置环境变量 ,更改/etc/profile文件:sudo gedit /etc/profile; 在文件最后加上如下几行(其实跟windows下的配置原理一 ...
- 【转】silverlight telerik RadGridView 列头显示其他控件
<telerik:GridViewDataColumn DataMemberBinding="{Binding target_id}" IsFilterable=" ...