[root@mha1 ~]# yum install epel* -y [root@mha1 ~]# yum update -y
[root@mha1 ~]# yum install libpcap -y [root@mha1 ~]# rpm -Uvh http://poptop.sourceforge.net/yum/stable/rhel6/pptp-release-current.noarch.rpm [root@mha1 ~]# rpm -Uvh http://poptop.sourceforge.net/yum/stable/rhel6/x86_64/dkms-2.0.17.5-1.noarch.rpm [root@mha1 ~]# rpm -Uvh http://poptop.sourceforge.net/yum/stable/rhel6/x86_64/ppp-2.4.5-33.0.rhel6.x86_64.rpm [root@mha1 ~]# rpm -Uvh http://poptop.sourceforge.net/yum/stable/rhel6/x86_64/ppp-devel-2.4.5-33.0.rhel6.x86_64.rpm [root@mha1 ~]# rpm -Uvh http://poptop.sourceforge.net/yum/stable/rhel6/x86_64/pptp-release-4-7.rhel6.noarch.rpm [root@mha1 ~]# rpm -Uvh http://poptop.sourceforge.net/yum/stable/rhel6/x86_64/pptpd-1.4.0-1.el6.x86_64.rpm
[root@mha1 ~]# vi /etc/sysctl.conf net.ipv4.ip_forward =1
[root@mha1 ~]# cp /etc/pptpd.conf /etc/pptpd.conf.back [root@mha1 ~]# > /etc/pptpd.conf [root@mha1 ~]# vi /etc/pptpd.conf ppp /usr/sbin/pppd option /etc/ppp/options.pptpd noipparam logwtmp connections 100 localip 192.168.0.101
[root@mha1 ~]# cp /etc/ppp/options.pptpd /etc/ppp/options.pptpd.back [root@mha1 ~]# > /etc/ppp/options.pptpd [root@mha1 ~]# vi /etc/ppp/options.pptpd name pptpd proxyarp nodeflate nobsdcomp lcp-echo-failure 10 lcp-echo-interval 5 deflate 0 lock logfile /var/log/pptpd.log refuse-pap refuse-chap refuse-mschap require-mschap-v2 ## CHAP 인증 ## require-chap ## DNS lookup ## ms-dns 8.8.8.8 nobsdcomp novj novjccomp # RADIUS Modify# plugin radius.so plugin radattr.so
[root@mha1 ~]# /etc/rc.d/init.d/pptpd restart-kill [root@mha1 ~]# /etc/rc.d/init.d/pptpd start [root@mha1 ~]# netstat -nltp | grep pptp tcp 0 0 0.0.0.0:1723 0.0.0.0:* LISTEN 1775/pptpd
[root@mha1 ~]# yum install -y xl2tpd
[root@mha1 ~]# cp /etc/xl2tpd/xl2tpd.conf /etc/xl2tpd/xl2tpd.conf.back [root@mha1 ~]# > /etc/xl2tpd/xl2tpd.conf [root@mha1 ~]# vi /etc/xl2tpd/xl2tpd.conf [global] port = 1701 auth file = /etc/xl2tpd/l2tp-secrets access control = no rand source = dev ipsec saref = yes [lns default] exclusive = no ip range = 192.168.80.5-192.168.81.35 local ip = 192.168.80.1 require chap = yes refuse pap = yes require authentication = yes name = VPNserver ppp debug = yes pppoptfile = /etc/ppp/options.xl2tpd length bit = yes flow bit = yes
[root@mha1 ~]# cp /etc/ppp/options.xl2tpd /etc/ppp/options.xl2tpd.back [root@mha1 ~]# > /etc/ppp/options.xl2tpd [root@mha1 ~]# vi /etc/ppp/options.xl2tpd ipcp-accept-local ipcp-accept-remote lcp-echo-failure 30 lcp-echo-interval 5 ms-dns 8.8.8.8 ms-dns 8.8.4.4 noccp nodeflate auth crtscts idle 1800 mtu 1410 mru 1410 defaultroute debug proxyarp connect-delay 5000 lock plugin radius.so plugin radattr.so
[root@mha1 ~]# yum install freeradius freeradius-mysql radiusclient-ng radiusclient-ng-utils freeradius-utils mysql-devel -y
[root@mha1 ~]# ln -s /etc/radiusclient-ng /etc/radiusclient
[root@mha1 ~]# vi /etc/radiusclient-ng/radiusclient.conf #bindaddr *
[root@mha1 ~]# vi /etc/radiusclient-ng/servers localhost cy_key
[root@mha1 ~]# cp /usr/share/radiusclient-ng/diction* /etc/radiusclient-ng/ [root@mha1 ~]# vi /etc/radiusclient-ng/dictionary.microsoft VENDOR Microsoft 311 Microsoft ATTRIBUTE MS-CHAP-Response 1 string Microsoft ATTRIBUTE MS-CHAP-Error 2 string Microsoft ATTRIBUTE MS-CHAP-CPW-1 3 string Microsoft ATTRIBUTE MS-CHAP-CPW-2 4 string Microsoft ATTRIBUTE MS-CHAP-LM-Enc-PW 5 string Microsoft ATTRIBUTE MS-CHAP-NT-Enc-PW 6 string Microsoft ATTRIBUTE MS-MPPE-Encryption-Policy 7 string Microsoft ATTRIBUTE MS-MPPE-Encryption-Type 8 string Microsoft ATTRIBUTE MS-MPPE-Encryption-Types 8 string Microsoft ATTRIBUTE MS-RAS-Vendor 9 integer Microsoft ATTRIBUTE MS-CHAP-Domain 10 string Microsoft ATTRIBUTE MS-CHAP-Challenge 11 string Microsoft ATTRIBUTE MS-CHAP-MPPE-Keys 12 string Microsoft ATTRIBUTE MS-BAP-Usage 13 integer Microsoft ATTRIBUTE MS-Link-Utilization-Threshold 14 integer Microsoft ATTRIBUTE MS-Link-Drop-Time-Limit 15 integer Microsoft ATTRIBUTE MS-MPPE-Send-Key 16 string Microsoft ATTRIBUTE MS-MPPE-Recv-Key 17 string Microsoft ATTRIBUTE MS-RAS-Version 18 string Microsoft ATTRIBUTE MS-Old-ARAP-Password 19 string Microsoft ATTRIBUTE MS-New-ARAP-Password 20 string Microsoft ATTRIBUTE MS-ARAP-PW-Change-Reason 21 integer Microsoft ATTRIBUTE MS-Filter 22 string Microsoft ATTRIBUTE MS-Acct-Auth-Type 23 integer Microsoft ATTRIBUTE MS-Acct-EAP-Type 24 integer Microsoft ATTRIBUTE MS-CHAP2-Response 25 string Microsoft ATTRIBUTE MS-CHAP2-Success 26 string Microsoft ATTRIBUTE MS-CHAP2-CPW 27 string Microsoft ATTRIBUTE MS-Primary-DNS-Server 28 ipaddr Microsoft ATTRIBUTE MS-Secondary-DNS-Server 29 ipaddr Microsoft ATTRIBUTE MS-Primary-NBNS-Server 30 ipaddr Microsoft ATTRIBUTE MS-Secondary-NBNS-Server 31 ipaddr Microsoft VALUE MS-BAP-Usage Not-Allowed 0 VALUE MS-BAP-Usage Allowed 1 VALUE MS-BAP-Usage Required 2 VALUE MS-ARAP-PW-Change-Reason Just-Change-Password 1 VALUE MS-ARAP-PW-Change-Reason Expired-Password 2 VALUE MS-ARAP-PW-Change-Reason Admin-Requires-Password-Change 3 VALUE MS-ARAP-PW-Change-Reason Password-Too-Short 4 VALUE MS-Acct-Auth-Type PAP 1 VALUE MS-Acct-Auth-Type CHAP 2 VALUE MS-Acct-Auth-Type MS-CHAP-1 3 VALUE MS-Acct-Auth-Type MS-CHAP-2 4 VALUE MS-Acct-Auth-Type EAP 5 VALUE MS-Acct-EAP-Type MD5 4 VALUE MS-Acct-EAP-Type OTP 5 VALUE MS-Acct-EAP-Type Generic-Token-Card 6 VALUE MS-Acct-EAP-Type TLS 13
[root@mha1 ~]# vi /etc/radiusclient-ng/radiusclient.conf ... #dictionary /usr/share/radiusclient-ng/dictionary dictionary /etc/radiusclient-ng/dictionary ...
[root@mha1 ~]# vi /etc/radiusclient-ng/dictionary ... INCLUDE /etc/radiusclient-ng/dictionary.microsoft INCLUDE /etc/radiusclient-ng/dictionary.merit ...
[root@mha1 mysql]# mysql -uroot -p Enter password: ... mysql> grant all privileges on *.* to 'radius '@'localhost ' identified by 'radpass' with grant option; mysql> grant all privileges on *.* to 'radius'@'%' identified by 'radpass ' with grant option; mysql> create database radius; Query OK, 1 row affected (0.00 sec) ...
[root@mha1 mysql]# cd /etc/raddb/sql/mysql/ [root@mha1 mysql]# mysql -uroot -p < admin.sql [root@mha1 mysql]# mysql -uroot -p radius < schema.sql
[root@mha1 mysql]# mysql -uroot -p ... mysql> use radius Database changed mysql> INSERT INTO radcheck (username,attribute,op,value) values ('user1','User-Password','==','pass1'); Query OK, 1 row affected (0.01 sec) mysql> select * from radcheck; +----+----------+---------------+----+-------+ | id | username | attribute | op | value | +----+----------+---------------+----+-------+ | 1 | user1 | User-Password | == | pass1 | +----+----------+---------------+----+-------+ 1 row in set (0.00 sec)
mysql> INSERT INTO radreply (username, attribute, op, value) values ('user1','Framed-IP-Address',':=','192.168.0.102'); Query OK, 1 row affected (0.01 sec) mysql> select * from radreply; +----+----------+-------------------+----+--------------+ | id | username | attribute | op | value | +----+----------+-------------------+----+--------------+ | 1 | user1 | Framed-IP-Address | := | 192.168.0.102 | +----+----------+-------------------+----+--------------+ 1 row in set (0.00 sec)
[root@mha1 mysql]# vi /etc/raddb/clients.conf client 127.0.0.1 { ipaddr = 192.168.0.101 secret = cy_key shortname = localhost nastype = other }
[root@mha1 mysql]# vi /etc/raddb/users ... DEFAULT Simultaneous-Use := 1 Fall-Through = 1
[root@mha1 mysql]# vi /etc/raddb/radiusd.conf ... $INCLUDE sql.conf ...
[root@mha1 mysql]# vi /etc/raddb/sql.conf ... sql { database = "mysql" driver = "rlm_sql_${database}" server = "192.168.0.101" login = "root" password = "12345" ...
[root@mha1 mysql]# vi /etc/raddb/modules/mschap ... mschap { ... use_mppe = yes require_encryption = yes require_strong = yes } ...
[root@mha1 mysql]# vi /etc/raddb/sites-enabled/default .. authorize { ... #files sql ... } ... session { ... sql } ... post-auth { ... sql ... } accounting { sql ... ....
[root@mha1 ~]# yum -y install http://wiki.nikoforge.org/download/ipsec-tools/ipsec-tools-0.8.0-3defpsk.el6.x86_64.rpm
[root@mha1 ~]# vi /etc/xl2tpd/xl2tpd.conf [global] ipsec saref = yes ,,,
[root@mha1 ~]# vi /etc/racoon/init.sh #!/bin/sh echo -e "flush;\n\ spdflush;\n\ spdadd 0.0.0.0/0[0] 0.0.0.0/0[1701] udp -P in ipsec esp/transport//require;\n\ spdadd 0.0.0.0/0[1701] 0.0.0.0/0[0] udp -P out ipsec esp/transport//require;\n"\ | setkey -c [root@mha1 ~]# chmod 750 /etc/racoon/init.sh [root@mha1 ~]# echo /etc/racoon/init.sh >> /etc/rc.d/rc.local
[root@mha1 ~]# cp -aR /etc/racoon/racoon.conf /etc/racoon/racoon.conf_bak [root@mha1 ~]# >/etc/racoon/racoon.conf [root@mha1 ~]# vi /etc/racoon/racoon.conf path include "/etc/racoon"; path pre_shared_key "/etc/racoon/psk.txt"; path certificate "/etc/racoon/certs"; path script "/etc/racoon/scripts"; remote anonymous { exchange_mode aggressive,main; passive on; proposal_check obey; support_proxy on; nat_traversal on; ike_frag on; dpd_delay 20; proposal { encryption_algorithm aes; hash_algorithm sha1; authentication_method pre_shared_key; dh_group modp1024; } proposal { encryption_algorithm 3des; hash_algorithm sha1; authentication_method pre_shared_key; dh_group modp1024; } } sainfo anonymous { encryption_algorithm aes,3des; authentication_algorithm hmac_sha1; compression_algorithm deflate; pfs_group modp1024; } [root@mha1 ~]# chmod 600 /etc/racoon/racoon.conf
[root@mha1 ~]# vi /etc/racoon/psk.txt * cy_key
[root@mha1 ~]# chkconfig --add racoon [root@mha1 ~]# chkconfig --add pptpd [root@mha1 ~]# chkconfig --add xl2tpd [root@mha1 ~]# chkconfig --add radiusd [root@mha1 ~]# chkconfig --level 3 radiusd on [root@mha1 ~]# chkconfig --level 3 pptpd on [root@mha1 ~]# chkconfig --level 3 xl2tpd on [root@mha1 ~]# chkconfig --level 3 racoon on [root@mha1 ~]# /etc/init.d/racoon restart [root@mha1 ~]# /etc/init.d/pptpd start [root@mha1 ~]# /etc/init.d/xl2tpd start [root@mha1 ~]# /etc/init.d/radiusd start
'System > Linux' 카테고리의 다른 글
CentOS 7 OpenVpn install (0) | 2017.07.29 |
---|---|
JVM APM pinponit 1.6 install (0) | 2016.12.18 |
Migrate from FirewallD to Iptables on CentOS 7 (0) | 2016.05.08 |
Centos7 NIC rename (0) | 2016.05.06 |
Centos7 Net-tools install (0) | 2016.05.06 |