Coder Social home page Coder Social logo

quericy / one-key-ikev2-vpn Goto Github PK

View Code? Open in Web Editor NEW
2.1K 134.0 706.0 103 KB

A bash script base on Centos or Ubuntu help you to create IKEV2/L2TP vpn.

License: GNU General Public License v3.0

Shell 100.00%
ikev2 vpn strongswan ikev2-vpn ssl ssl-ikev2

one-key-ikev2-vpn's Issues

IKEv2 iOS 9.3.1 和 OSX 10.11.4 连接不上

ubuntu 14.04 KVM master分支

Log

Apr 13 08:25:52 guest charon: 03[IKE] remote host is behind NAT
Apr 13 08:25:52 guest charon: 03[IKE] sending cert request for "C=com, O=myvpn, CN=VPN CA"
Apr 13 08:25:52 guest charon: 03[ENC] generating IKE_SA_INIT response 0 [ SA KE No N(NATD_S_IP) N(NATD_D_IP) CERTREQ N(MULT_AUTH) ]
Apr 13 08:25:52 guest charon: 03[NET] sending packet: from ip[500] to ip2[500] (465 bytes)
Apr 13 08:25:53 guest charon: 13[NET] received packet: from ip2[4500] to ip[4500] (496 bytes)
Apr 13 08:25:53 guest charon: 13[ENC] parsed IKE_AUTH request 1 [ IDi N(INIT_CONTACT) N(MOBIKE_SUP) IDr CPRQ(ADDR DHCP DNS MASK ADDR6 DHCP6 DNS6) N(ESP_TFC_PAD_N) N(NON_FIRST_FRAG) SA TSi TSr ]
Apr 13 08:25:53 guest charon: 13[CFG] looking for peer configs matching ip[ip]...ip2[192.168.1.102]
Apr 13 08:25:53 guest charon: 13[CFG] selected peer config 'ios_ikev2'
Apr 13 08:25:53 guest charon: 13[IKE] initiating EAP_IDENTITY method (id 0x00)
Apr 13 08:25:53 guest charon: 13[IKE] received ESP_TFC_PADDING_NOT_SUPPORTED, not using ESPv3 TFC padding
Apr 13 08:25:53 guest charon: 13[IKE] peer supports MOBIKE
Apr 13 08:25:53 guest charon: 13[IKE] authentication of 'ip' (myself) with RSA signature successful
Apr 13 08:25:53 guest charon: 13[IKE] sending end entity cert "C=com, O=myvpn, CN=ip"
Apr 13 08:25:53 guest charon: 13[ENC] generating IKE_AUTH response 1 [ IDr CERT AUTH EAP/REQ/ID ]
Apr 13 08:25:53 guest charon: 13[NET] sending packet: from ip[4500] to ip2[4500] (1184 bytes)

Automatic IPv6 detection request

Hi, if there have a Linux VPS who is equipped with IPV6 address (Such as ISP DigitalOcean), I am wandering if it possible to automatically detect IPv6 support in StrongSwan by default?

no netkey IPsec stack detected when run ipsec

Hi,
Did you encounter that issue, missing ipsec stack, so ipsec can't run.
My OS is Ubuntu 14.04 x86_64.
[root@www:/home/vpn/strongswan# ipsec status
Security Associations (0 up, 0 connecting):
none
root@www:/home/vpn/strongswan# ipsec restart
Stopping strongSwan IPsec...
Starting strongSwan 5.5.1 IPsec [starter]...
no netkey IPsec stack detected
no KLIPS IPsec stack detected
no known IPsec stack detected, ignoring!
root@www:/home/vpn/strongswan#
root@www:/home/vpn/strongswan#
root@www:/home/vpn/strongswan# uname -a
Linux www 2.6.32-042stab108.5 #1 SMP Wed Jun 17 20:20:17 MSK 2015 x86_64 x86_64 x86_64 GNU/Linux

Thanks,
Chao

关于 Azure VM 获取IP地址有误的问题

使用 Azure VM A0 主机,成安装此版本且 IOS 9 可正常连接 VPN(android_xauth_psk 形式),但故障形式为无网络访问。

ipsec statusall 日志如下:

Security Associations (1 up, 0 connecting): android_xauth_psk[4]: ESTABLISHED 10 seconds ago, 10.0.0.4[10.0.0.4]...194.129.91.141[192.168.1.107]

此处 10.0.0.4 应为 VM 的外网 ip 地址,而非为本地局域网地址,可知此处存疑。
又查 StrangSwan 监听日志为:

Listening IP addresses:
  10.0.0.4
  10.0.1.1

可知错误原因为脚本未正确获取 ip 地址。
我已作 net.ipv4.ip_forward=1 转发,恳请询问现在可能的解决办法。

真实机器怎么选

第一步要选(OpenVZ还是Xen、KVM),可是我是真实机器,怎么弄?

iOS和OSX使用IKEv2连接正好8分钟时就断开

服务器系统:Ubuntu 14.04.2 x64 (OpenVZ)
客户端系统:iOS 9.3.1 / OSX 10.11.4
连接方式: IKEv2 (使用IKEv1能正常连接不断线)

测试过多次,每次都能正常连接并正常使用,但正好8分钟时就断开。日志如下:

Apr  1 22:12:31 152424 charon: 14[IKE] 客户端IP is initiating an IKE_SA
Apr  1 22:12:32 152424 charon: 15[IKE] IKE_SA ios_ikev2[13] established between 服务器IP[服务器域名]...客户端IP[192.168.1.5]
Apr  1 22:12:32 152424 charon: 15[IKE] CHILD_SA ios_ikev2{20} established with SPIs 5c12d761_i 0e37ed88_o and TS 0.0.0.0/0 === 10.31.2.1/32
Apr  1 22:20:32 152424 charon: 13[IKE] 客户端IP is initiating an IKE_SA
Apr  1 22:20:33 152424 charon: 13[IKE] deleting IKE_SA ios_ikev2[13] between 服务器IP[服务器域名]...客户端IP[192.168.1.5]
Apr  1 22:20:33 152424 charon: 13[IKE] IKE_SA deleted

会可能是什么原因导致的?

radius auth

hi,
I installed strongswan on my ubuntu 14.04 LTS and now i want to use radius auth for ikev1 and ikev2
my ipsec.conf:
http://paste.ubuntu.com/23216842/
with this config ikev1 radius work with no problem but ikev2 doesn't work.
my syslog:
http://paste.ubuntu.com/23216851/

also i tested rightauth=xauth-pam ( eap-gtc plugin installed) for use pam_radius but that does n't work
my /etc/pam.d/ipsec :
auth required /lib/security/pam_radius_auth.so account required /lib/security/pam_radius_auth.so session required /lib/security/pam_radius_auth.so
thanks for your script

tar bug

小意外,如果目录有 strongswan-5.3.3
那脚本就有错误了,无法进行,既然下载指定了 5.5.1,tar命令也指定好了

最新的脚本对安卓手机支持有bug!

A。我之前用过你的2016 年 07 月 07 日 那个一键安装脚本,主要是使用strongswan-5.3.5,经过测试在CentOS6.7 mini iso 安装的虚拟机下正常,我的华为手机(安卓6)系统自带的vpn设置ikev1 vpn能在4G下拨号成功(用PSK 预设密钥+ 用户名/密码方式),并成功上网(手机开Juice SSH 连 local手机后能在终端窗口ping 通 8.8.8.8, 这时运行ifconfig 能看到手机其实能获得10.31.2.1这地址)........
B。但是换了最新的一键脚本,主要使用的是strongswan-5.5.1,经过同样测试在CentOS6.7 和 CentOS 7(均是mini iso 安装的系统)下,对安卓手机有问题,同样的手机同样的设置,能4G下拨号成功,但是手机开Juice SSH 连 local手机后能在终端窗口ping 8.8.8.8 不通,当然也就不能上网,这时运行ifconfig 能看到手机其实能正常获得10.31.2.1。看服务器的log 也同样很正常。
所有测试环境都有设置 net.ipv4.ip_forward = 1 , iptables 也很简单的,主要用了你的默认设置,否则也不会在A测试中成功,请研究一下,欢迎加QQ探讨 ! QQ 46673364

安装完成后,mac不能连接

已经安装完成,并把ca.cert.pem下载到本地,尝试用证书鉴定设置,发现列表里面没有显示该证书,keychain里面也是显示该证书不被信任,又尝试用用户名和密码登录,也连接不上,请问怎么解决呢?

第三方购买的证书的配置问题

我第三方购买的ssl证书可以在我的网站上使用(https),但此证书没法用在一键安装脚本里面, 会导致win7连接ipsecs时提示 Error 13801:IKE authentication错误
我怀疑是证书配置有问题,请问会是什么原因?

ca.cert.pem 证书颁发机构的CA,比如Let‘s Encrypt的证书,或者其他链证书;---->这个是证书签发机构的 the intermediate certificate 吗?
server.cert.pem 签发的域名证书;--->这个是我购买的SSL证书(已经可以成功用在https)?
server.pem 签发域名证书时用的私钥;---->这个是我的私钥?

谢谢!

Readme有个小错误

Readme有个小错误

  • 连上服务器后无法链接外网:
    1.打开sysctl文件:
vim /etc/sysctl

应该是vim /etc/sysctl.conf

--enable-tools NO longer valid in strongSwan 5.3.5

I came across your article when trying to compile the latest strongswan (5.3.5 at the moment) as the package in Ubuntu 14.04 LTS is a bit out-dated (5.1.2) and does not have the swanctl CLI tool introduced in 5.2.0.

Your article did help me to figure out the autoconf options to compile strongswan with needed plugins, thanks for that ;-D

Just want to point out that --enable-tools is no longer valid option for 5.3.5. Not exactly sure what it is but I reckon it is replaced by --enable-swanctl as per Autoconf options for the most current strongSwan release

configure: WARNING: unrecognized options: --enable-tools

You may want to update the install script.

Anyway, I compiled 5.3.5 from source using the following autoconf configurations and it worked fine so far.

cd /path/to/strongswan-5.3.5

./configure --prefix=/usr --sysconfdir=/etc --enable-eap-identity --enable-eap-md5 \
--enable-eap-mschapv2 --enable-eap-tls --enable-eap-ttls --enable-eap-peap  \
--enable-eap-tnc --enable-eap-dynamic --enable-eap-radius --enable-xauth-eap  \
--enable-xauth-pam  --enable-dhcp  --enable-openssl  --enable-addrblock --enable-unity  \
--enable-certexpire --enable-radattr --enable-openssl --disable-gmp --enable-swanctl

make -j $(nproc)

make install

High recommend this article for anyone who wants to set up their own IPsec VPN using strongSwan.

https://raymii.org/s/tutorials/IPSEC_vpn_with_CentOS_7.html

使用Let‘s Encrypt证书后,win10客户端无法访问

使用Let‘s Encrypt证书最大的好处就是不用在客户端安装证书。准备好证书安装后,在同样的网络环境下,ipad和android的strongswan客户端都可以连接,唯独win10还是不行。不知有人成功过么?

用IP地址自签证书,倒是都能连接的。

Mac OSX 10.11.6 无法连接

安装完成之后iPhone和iPad是可以正常连接和上网的,Mac却不能连接成功,Mac上面证书已安装并且也设置了始终信任。 服务器为linode上面的CentOS 7。

请大神看下能有解决方法没,下面是部分Log,IP 110.110.110.110为本机IP,IP 120.120.120.120为VPN服务器IP

Nov 27 12:43:59 localhost charon: 09[NET] received packet: from 110.110.110.110[500] to 120.120.120.120[500] (604 bytes)

Nov 27 12:43:59 localhost charon: 09[ENC] parsed IKE_SA_INIT request 0 [ SA KE No N(REDIR_SUP) N(NATD_S_IP) N(NATD_D_IP) N(FRAG_SUP) ]

Nov 27 12:43:59 localhost charon: 09[IKE] 110.110.110.110 is initiating an IKE_SA

Nov 27 12:43:59 localhost charon: 09[IKE] remote host is behind NAT

Nov 27 12:43:59 localhost charon: 09[IKE] sending cert request for "C=com, O=myvpn, CN=VPN CA"

Nov 27 12:43:59 localhost charon: 09[ENC] generating IKE_SA_INIT response 0 [ SA KE No N(NATD_S_IP) N(NATD_D_IP) CERTREQ N(FRAG_SUP) N(MULT_AUTH) ]

Nov 27 12:43:59 localhost charon: 09[NET] sending packet: from 120.120.120.120[500] to 110.110.110.110[500] (473 bytes)

Nov 27 12:44:29 localhost charon: 16[JOB] deleting half open IKE_SA after timeout

提示成功,但是不能使用

服务器是openvz架构的,ubuntu系统,提示安装成功,但是ios设备连接不成功,有任何debug方法没有,日志输出等方式。

use real ssl for ikev2

Hello
i got a ssl from comodo
(ssl files are ca_bundle.crt , certificate.crt , private.key )
how can i set them for strongswan ikev2?
thanks

找到个bug,给你说下

centos 下,首次安装不重启服务器,工作正常。重启后无法翻墙。目测是路由表加的顺序问题,手动调整/etc/sysconfig/iptables,再重启,一切OK,代码这块你改下。另外交个朋友。加我好友,谢谢啦。

Script Doesn't Start After Server Restart

Hey man,

Thanks a lot for this awesome script, however I have some problem regarding the script startup.
After I restart the server, the VPN server does not respond anymore.
I have tried
ipsec restart
and
/usr/local/sbin/ipsec restart
still no go :(
Here is the windows 10 error:
The network connection between your computer and the VPN server could not be established because the remote server is not responding [...].
Server -> Ubuntu 16.04 OpenVZ X64

choose VPS type: wrong choice!

please choose the type of your VPS(Xen、KVM: 1 , OpenVZ: 2):
wrong choice!

Exit code: 1


echo "please choose the type of your VPS(Xen、KVM: 1 , OpenVZ: 2):"
read -p "your choice(1 or 2):" os_choice
if [ "$os_choice" = "1" ]; then
os="1"
os_str="Xen、KVM"
else
if [ "$os_choice" = "2" ]; then
os="2"
os_str="OpenVZ"
else
echo "wrong choice!"
exit 1
fi
fi


脚本的if 和else 好像没有对齐,是这个问题么?我有点小白,或者这样同样可以键入?

ios 连接问题

IOS 9下连接失败,查看日志发现是没有匹配到配置「no IKE config found」,怎么破?

安装的时候,确认服务器类型没有选错,id是默认的,c、o、cn都是默认。

macos sierra让ikev2无法工作了

苹果为了安全,不仅吧pptp拿掉了,而且那个eap-mschapv2也应该去掉了,,
目前vpn瘫痪中,,正在研究如何弄,大表哥看看咋解决呢

建议增加 eth0 是否为公网接口的判断

举个栗子,阿里云 eth0 是内网 IP,默认 eth0 的话会产生可以 VPN 连接,但是没有公网的问题。
get_my_ip 的时候判断一下 eth0 IP 是不是私有网段,或者直接加个输入网卡接口名的步骤。

无法生成证书

VPS OS 为 debian, 想到 ubuntu 也是debian系列的,于是我修改了检测系统的函数,其他的动,应该不是问题,但是有如下错误

ca.pem [not found]
auto create ca.pem ...
/usr/sbin/ipsec: unknown IPsec command pki' (ipsec --help' for list)
ca.cert.pem [not found]
auto create ca.cert.pem ...
/usr/sbin/ipsec: unknown IPsec command pki' (ipsec --help' for list)
/usr/sbin/ipsec: unknown IPsec command pki' (ipsec --help' for list)
/usr/sbin/ipsec: unknown IPsec command pki' (ipsec --help' for list)
/usr/sbin/ipsec: unknown IPsec command pki' (ipsec --help' for list)
/usr/sbin/ipsec: unknown IPsec command pki' (ipsec --help' for list)
/usr/sbin/ipsec: unknown IPsec command pki' (ipsec --help' for list)
/usr/sbin/ipsec: unknown IPsec command pki' (ipsec --help' for list)
configure the pkcs12 cert password(Can be empty):
unable to load private key
19241:error:0906D06C:PEM routines:PEM_read_bio:no start line:pem_lib.c:650:Expecting: ANY PRIVATE KEY

Press any key to install ikev2 VPN cert
net.ipv4.ip_forward = 1
/usr/sbin/ipsec: unknown IPsec command start' (ipsec --help' for list)

[Install Successful]
There is the default login info of your VPN
UserName: myUserName
PassWord: myUserPass
PSK: myPSKkey
you can change UserName and PassWord in /usr/local/etc/ipsec.secrets
you must copy the cert /root/my_key/ca.cert.pem to the client and install it.

查看文件夹 my_key里的所有文件都是空的0字节。

安装完成后连不上

我按照你的安装步骤一步一步安装成功了,但是当我尝试在 ios 手机上用 ikev2 连接的时候总也连不上! 不知道是怎么回事! 也不知道怎么调试!

每次连接的时候我想通过 tail -f /var/log/syslog 或 tail -f /var/log/auth.log 看不到任何连接信息!

ipsec 也启动了:
sudo ipsec status
Security Associations (0 up, 0 connecting):
none

letsencrypt生成的证书对不上号。

letsencrypt生成了4个证书文件。
但是不知道对应的证书文件是哪个。

ca.cert.pem 证书颁发机构的CA,比如Let‘s Encrypt的证书,或者其他链证书;
server.cert.pem 签发的域名证书;
server.pem 签发域名证书时用的私钥;

生成的4个证书文件不知道哪3个是对应这三个证书的,请问可以告知下吗?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.