赞
踩
结果:
1)iOS 7.1设备可以拨IPSec VPN到StrongSwan电脑上面来 - Connect to VPN
2)iOS 设备浏览器可以访问StrongSwan VPN所在的内网地址服务器 - Connect to intranet behind VPN
=========================================================
环境:
OpenSUSE 13.1 64位
iPad 2 with OS 7.1=========================================================
OpenSUSE准备:
下载OpenSUSE 13.1 64位 DVD iso文件,Vmware Workstation 9安装,选择手动安装
OpenSUSE关闭防火墙,在GUI界面里面搜索firewall,关闭防火墙即可
或者是命令行启动yast 字符菜单界面,选择Security and Users -> Firewall
=========================================================
开始安装SrongSwan
安装strongswan,当前最新版本5.1.1default_days = 3650 # This means the certificates will be valid 10 years. default 365 days
default_crl_days= 3000 # how long before next CRL, default 30 days
mkdir newcerts (原因是openssl.cnf缺省配置)
配置iOS设备:将生成的caCert.pem和clientCert.p12通过邮件的方式或者通过web方式下载到iOS设备上,并进行证书安装。
cd /etc/ipsec.d/ipsec restart
=========================================================
=========================================================
排错:
参考 http://wiki.strongswan.org/projects/strongswan/wiki/LoggerConfiguration
ipsec stroke loglevel ike 2外网测试:
注意:防火墙上面可能需要做地址映射 500 4500 两个UDP端口
外网访问内网测试:
拨通VPN后,iPad只能访问StrongSwan的IP地址的apache。
参考配置 Iptables转发,注意我的SUSE网卡别名不是eth0,是ens33。(按照参考,编写了服务脚本 /etc/systemd/system/strongswan-iptables.service)
sudo iptables -A INPUT -p udp --dport 500 -j ACCEPT sudo iptables -A INPUT -p udp --dport 4500 -j ACCEPT sudo iptables -t nat -A POSTROUTING -s 10.0.0.0/24 -o ens33 -j MASQUERADE sudo iptables -A FORWARD -s 10.0.0.0/24 -j ACCEPT sudo echo 1 > /proc/sys/net/ipv4/ip_forward
# Author: Marguerite Su <i@marguerite.su>
# Use Case: You have a strongswan vpn. You don't want to input iptables commands
# everytime upon server restart.
[Unit]
Description=Scripts to setup iptables rules for strongswan
Wants=network-online.target
# has to start before strongswan, or it doesn't know the routes.
# so you can connect, but no traffic.
Before=strongswan.service
After=network.target
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/sbin/iptables -A INPUT -p udp --dport 500 -j ACCEPT ; \
/usr/sbin/iptables -A INPUT -p udp --dport 4500 -j ACCEPT ; \
/usr/sbin/iptables -t nat -A POSTROUTING -s 10.0.0.0/24 -o ens33 -j MASQUERADE ; \
/usr/sbin/iptables -A FORWARD -s 10.0.0.0/24 -j ACCEPT ; \
/bin/sh -c 'echo -n 1 > /proc/sys/net/ipv4/ip_forward'
ExecStop=/bin/sh -c 'echo -n 0 > /proc/sys/net/ipv4/ip_forward' ; \
/usr/sbin/iptables -D FORWARD -s 10.0.0.0/24 -j ACCEPT ; \
/usr/sbin/iptables -t nat -D POSTROUTING -s 10.0.0.0/24 -o ens33 -j MASQUERADE ; \
/usr/sbin/iptables -D INPUT -p udp --dport 4500 -j ACCEPT ; \
/usr/sbin/iptables -D INPUT -p udp --dport 500 -j ACCEPT
[Install]
WantedBy=multi-user.target
systemctl enable strongswan-iptables.service
systemctl start strongswan-iptables.service
=========================================================
查看SSL证书过期时间
openssl x509 -text -in cacerts/cacert.pem
Validity
Not Before: Aug 7 10:18:56 2014 GMT
Not After : Sep 6 10:18:56 2014 GMT
=========================================================
iPhone VPN配置参考 http://wiki.strongswan.org/projects/strongswan/wiki/IOS_%28Apple%29
设置:default_crl_days= 300 /etc/ssl/openssl.cnf http://www.strongswan.org/docs/readme.htm
=========================================================
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。