【安全牛学习笔记】补充Proxytunnel、stunnel4

来源:互联网 发布:为什么手机网络不稳定 编辑:程序博客网 时间:2024/05/19 00:09

stunnel4                                      

无需修改源代码的情况下降TCP流量封装与SSL通道内

适用于本身不支持加密传输的应用                

支持openssl安全特性                           

跨平台                                        

性能

yuanfh@Bodhi:~$ sudo apt-get install stunnel4

1.1.1.1  防火墙

External port range: from:other 3306

NAT IP 1.1.1.10

Local port: 3306

save

msfadmin@metasploitable:~$ netstat -pantu | grep :3306

(No info could be read for "-p": geteuid()=1000 but you should be root.)

tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN

wireshark

ip.addr == 192.168.1.11

External port range: from:other 3306; to:3306

root@K:~# mysql -u root -h 192.168.1.11

Welcome to the Mysql monitor. Commands and with ; or \g.

Your MYSQL connection id is 7

Server version: 5.0.51a-3ubuntuS (Ubuntu)

Copyright (c) 2000, 2016 Oracle and/or its affiliate. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or it>

affiliates. Other names may be trademarks of their respective

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement

mysql> show datebases;

+--------------------+

| Database                |

+--------------------+

| information_schema |

| dvwa                          |

| metasploit                 |

| mysql                        |

| owasp10                   |

| tikiwiki                      |

| tikiwiki195                |

+--------------------+

stunnel4                                                       

安装内网Stunnel4服务器                                         

服务器配置                                                    

    - 生成证书:openssl req -new --days 365 -nodes -x509 -out   

      /etc/stunnel/stunnel.pem -keyout /etc/stunnel/stunnel.pem

    - 创建配置文件 /etc/stunnel/stunnel.conf                    

      cert = /etc/stunnel/stunne.pem                            

      setuid = stunnel4                                        

      setgid = stunnel4                                        

      pid = /var/run/stunnel4/stunnel4.pid                      

      [mysqls]                                                 

      accept = 0.0.0.0:443                                     

      connect = 1.1.1.1:3306

yuanfh@Bodhi:~$ sudo openssl req -new --days 1000 -nodes -x509 -out /etc/stunnel/stunnel.pem -keyout /etc/stunnel/stunnel.pem

Generating a 2048 bit RSA private key

.......................................................................................

....................................................................+++

..................+++

writing new private key to '/etc/stunnel/stunnel.pem'

-----

You are about to be asked to enter information that will incorporated

into your certificate request.

What you are about to enter is what is called a Distinguished Name or a DN.

There you are quite a few fields but you can leave some blank

For some fields there will be a default value.

If you enter '.', the field will be left blank.

-----

Country Name (2 letter code) [AU]:CN

State or Province Name (full name) [Some-State]:BJ

Locality Name (eg. city) []:BJ_HD

Organization Name (eg. company) [Internet Widgits Pty Ltd]:LAB

Organizational Unit Name (eg, section) []:IT

Common Name (e.g. server FQDN or YOUR name) []:www.lab.com

Email Address []:yuanfh@lab.com

yuanfh@Bodhi:~$ cat /etc/stunnel/stunnel.pem

yuanfh@Bodhi:~$ sudo vi  /etc/stunnel/stunnel.conf

cert = /etc/stunnel/stunne.pem 

setuid = stunnel4

setgid = stunnel4

pid = /var/run/stunnel4/stunnel4.pid

[mysqls]

accept = 0.0.0.0:443

connect = 1.1.1.1:3306

stunnel4                                        

Stunnel4自动启动                                

    - /etc/default/stunnel4                     

启动stunnel4服务端                              

    - service stunnel4 start                    

防火墙规则                                      

    - 端口映射TCP/443端口到stunnel4服务端TCP/443

    - 设置防火墙规则                            

Stunnel4客户端

stunnel4                            

启动客户端服务                      

    - service stunnel4 stop / start

Mysql客户端连接服务器               

    - mysql -u root -h 127.0.0.1    

抓包对比隧道前后差异

yuanfh@Bodhi:~$ sudo vi /etc/default/stunnel4

WNABLED=1

yuanfh@Bodhi:~$ service stunnel start

yuanfh@Bodhi:~$ netstat -pantu | grep 443

(Not all processes could be identified, non-owned process info

 will not be shown, you would have to be root to see it all.)

tcp        0 0.0.0.0:443                    0.0.0.0:*              LISTEN     -

yuanfh@Bodhi:~$ sudo service stunnel4 stop

Stopping SSL tunnels: [stopped./etc/stunnel/stunnel.conf] stunnel.

Enternal port range: from: HTTPS

NAT: 1.1.1.11

root@K:~# vi /etc/stunnel/a.conf

client = yes

{mysqls]

accept = 3306

connect = 192.168.1.11:443

root@K:~# vi /etc/default/stunnel4

ENABLED=1

root@K:~# service stunnel4 start

root@K:~# cat /etc/stunnel/a.conf

client = yes

{mysqls]

accept = 3306

connect = 192.168.1.11:443

root@K:~# netstat -pantu | grep :3306

tcp        0 0.0.0.0:3306                   0.0.0.0:*              LISTEN     3355/stunnel4

root@K:~# mysql -u root -h 127.0.0.1

Welcome to the Mysql monitor. Commands and with ; or \g.

Your MYSQL connection id is 7

Server version: 5.0.51a-3ubuntuS (Ubuntu)

Copyright (c) 2000, 2016 Oracle and/or its affiliate. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or it>

affiliates. Other names may be trademarks of their respective

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement

mysql> show datebases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| dvwa               |

| metasploit         |

| mysql              |

| owasp10            |

| tikiwiki           |

| tikiwiki195        |

+--------------------+

7 rows in set (0.00 sec)

ip.addr == 192.168.1.11

该笔记为安全牛课堂学员笔记,想看此课程或者信息安全类干货可以移步到安全牛课堂

Security+认证为什么是互联网+时代最火爆的认证?


      牛妹先给大家介绍一下Security+


        Security+ 认证是一种中立第三方认证,其发证机构为美国计算机行业协会CompTIA ;是和CISSP、ITIL 等共同包含在内的国际 IT 业 10 大热门认证之一,和CISSP偏重信息安全管理相比,Security+ 认证更偏重信息安全技术和操作。

       通过该认证证明了您具备网络安全,合规性和操作安全,威胁和漏洞,应用程序、数据和主机安全,访问控制和身份管理以及加密技术等方面的能力。因其考试难度不易,含金量较高,目前已被全球企业和安全专业人士所普遍采纳。

Security+认证如此火爆的原因?  

       原因一:在所有信息安全认证当中,偏重信息安全技术的认证是空白的, Security+认证正好可以弥补信息安全技术领域的空白 。

      目前行业内受认可的信息安全认证主要有CISP和CISSP,但是无论CISP还是CISSP都是偏重信息安全管理的,技术知识讲的宽泛且浅显,考试都是一带而过。而且CISSP要求持证人员的信息安全工作经验都要5年以上,CISP也要求大专学历4年以上工作经验,这些要求无疑把有能力且上进的年轻人的持证之路堵住。在现实社会中,无论是找工作还是升职加薪,或是投标时候报人员,认证都是必不可少的,这给年轻人带来了很多不公平。而Security+的出现可以扫清这些年轻人职业发展中的障碍,由于Security+偏重信息安全技术,所以对工作经验没有特别的要求。只要你有IT相关背景,追求进步就可以学习和考试。

       原因二: IT运维人员工作与翻身的利器。

       在银行、证券、保险、信息通讯等行业,IT运维人员非常多,IT运维涉及的工作面也非常广。是一个集网络、系统、安全、应用架构、存储为一体的综合性技术岗。虽然没有程序猿们“生当做光棍,死亦写代码”的悲壮,但也有着“锄禾日当午,不如运维苦“的感慨。天天对着电脑和机器,时间长了难免有对于职业发展的迷茫和困惑。Security+国际认证的出现可以让有追求的IT运维人员学习网络安全知识,掌握网络安全实践。职业发展朝着网络安全的方向发展,解决国内信息安全人才的匮乏问题。另外,即使不转型,要做好运维工作,学习安全知识取得安全认证也是必不可少的。

        原因三:接地气、国际范儿、考试方便、费用适中!

CompTIA作为全球ICT领域最具影响力的全球领先机构,在信息安全人才认证方面是专业、公平、公正的。Security+认证偏重操作且和一线工程师的日常工作息息相关。适合银行、证券、保险、互联网公司等IT相关人员学习。作为国际认证在全球147个国家受到广泛的认可。

        在目前的信息安全大潮之下,人才是信息安全发展的关键。而目前国内的信息安全人才是非常匮乏的,相信Security+认证一定会成为最火爆的信息安全认证。

原创粉丝点击