Strongswan(스트롱스완)은 오픈소스 멀티플랫폼 IPsec 기반 VPN 솔루션으로 IKEv1과 IKEv2 키 교환 프로토콜, X.509 인증서 혹은 사전 공유키 기반 인증 그리고 안전한 IKEv2 EAP 사용자 인증을 지원하며 강력한 인증 메커니즘에 중점을 두었다.
이 글에서는 Strongswan과 EAP-MSCHAPv2 인증, Letsencrypt 인증서를 사용하는 IKEv2/IPsec 서버를 리눅스 CentOS 7에 설치하는 과정을 담아내었다.
이 글에 쓰인 CentOS 7 서버는 미국 뉴저지주에 위치했으며 test.vorcloud.com 도메인을 사용했다.
모든 명령은 root 계정에서 실행되었으며 보라색 글씨는 그대로 써도 되는 부분을 의미하고 빨간 글씨는 바꿔줘야 함을 의미한다.
1. Strongswan 설치하기
EPEL 패키지 저장소와 Strongswan을 설치한다.
# yum -y install epel-release
# yum -y install strongswan
[root@test ~]# yum -y install epel-release
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: centos.mirror.constant.com
* epel: epel.mirror.constant.com
* extras: centos.mirror.constant.com
* updates: centos.mirror.constant.com
Package epel-release-7-11.noarch already installed and latest version
Nothing to do
※ epel-release 패키지가 이미 설치된 서버이다.
[root@test ~]# yum -y install strongswan
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: centos.mirror.constant.com
* epel: epel.mirror.constant.com
* extras: centos.mirror.constant.com
* updates: centos.mirror.constant.com
Resolving Dependencies
--> Running transaction check
---> Package strongswan.x86_64 0:5.7.2-1.el7 will be installed
--> Processing Dependency: libtspi.so.1()(64bit) for package: strongswan-5.7.2-1.el7.x86_64
--> Running transaction check
---> Package trousers.x86_64 0:0.3.14-2.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=============================================
Package Arch Version Repository
Size
=============================================
Installing:
strongswan x86_64 5.7.2-1.el7 epel 1.4 M
Installing for dependencies:
trousers x86_64 0.3.14-2.el7 base 289 k
Transaction Summary
=============================================
Install 1 Package (+1 Dependent package)
Total download size: 1.7 M
Installed size: 4.8 M
Downloading packages:
(1/2): trousers-0.3.14- | 289 kB 00:00
(2/2): strongswan-5.7.2 | 1.4 MB 00:00
---------------------------------------------
Total 3.8 MB/s | 1.7 MB 00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : trousers-0.3.14-2.el7.x 1/2
Installing : strongswan-5.7.2-1.el7. 2/2
Verifying : trousers-0.3.14-2.el7.x 1/2
Verifying : strongswan-5.7.2-1.el7. 2/2
Installed:
strongswan.x86_64 0:5.7.2-1.el7
Dependency Installed:
trousers.x86_64 0:0.3.14-2.el7
Complete!
2. Let's encrypt를 이용한 SSL 인증서 만들기
'test.vorcloud.com' 도메인 주소에 대한 인증서를 만들기 위해 letsencrypt 툴 certbot을 설치한다.
# yum -y install certbot
[root@vpn ~]# yum -y install certbot
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: centos.mirror.constant.com
* epel: epel.mirror.constant.com
* extras: centos.mirror.constant.com
* updates: centos.mirror.constant.com
Resolving Dependencies
--> Running transaction check
---> Package certbot.noarch 0:0.30.2-1.el7 will be installed
--> Processing Dependency: python2-certbot = 0.30.2-1.el7 for package: certbot-0.30.2-1.el7.noarch
--> Processing Dependency: /usr/sbin/semanage for package: certbot-0.30.2-1.el7.noarch
--> Running transaction check
---> Package policycoreutils-python.x86_64 0:2.5-29.el7_6.1 will be installed
--> Processing Dependency: setools-libs >= 3.3.8-4 for package: policycoreutils-python-2.5-29.el7_6.1.x86_64
--> Processing Dependency: libsemanage-python >= 2.5-14 for package: policycoreutils-python-2.5-29.el7_6.1.x86_64
--> Processing Dependency: audit-libs-python >= 2.1.3-4 for package: policycoreutils-python-2.5-29.el7_6.1.x86_64
--> Processing Dependency: python-IPy for package: policycoreutils-python-2.5-29.el7_6.1.x86_64
--> Processing Dependency: libqpol.so.1(VERS_1.4)(64bit) for package: policycoreutils-python-2.5-29.el7_6.1.x86_64
--> Processing Dependency: libqpol.so.1(VERS_1.2)(64bit) for package: policycoreutils-python-2.5-29.el7_6.1.x86_64
--> Processing Dependency: libcgroup for package: policycoreutils-python-2.5-29.el7_6.1.x86_64
--> Processing Dependency: libapol.so.4(VERS_4.0)(64bit) for package: policycoreutils-python-2.5-29.el7_6.1.x86_64
--> Processing Dependency: checkpolicy for package: policycoreutils-python-2.5-29.el7_6.1.x86_64
--> Processing Dependency: libqpol.so.1()(64bit) for package: policycoreutils-python-2.5-29.el7_6.1.x86_64
--> Processing Dependency: libapol.so.4()(64bit) for package: policycoreutils-python-2.5-29.el7_6.1.x86_64
---> Package python2-certbot.noarch 0:0.30.2-1.el7 will be installed
--> Processing Dependency: python2-acme >= 0.26.0 for package: python2-certbot-0.30.2-1.el7.noarch
--> Processing Dependency: python-parsedatetime for package: python2-certbot-0.30.2-1.el7.noarch
--> Processing Dependency: python-setuptools for package: python2-certbot-0.30.2-1.el7.noarch
--> Processing Dependency: python-zope-component for package: python2-certbot-0.30.2-1.el7.noarch
--> Processing Dependency: python-zope-interface for package: python2-certbot-0.30.2-1.el7.noarch
--> Processing Dependency: python2-configargparse for package: python2-certbot-0.30.2-1.el7.noarch
--> Processing Dependency: python2-cryptography for package: python2-certbot-0.30.2-1.el7.noarch
--> Processing Dependency: python2-future for package: python2-certbot-0.30.2-1.el7.noarch
--> Processing Dependency: python2-josepy for package: python2-certbot-0.30.2-1.el7.noarch
--> Processing Dependency: python2-mock for package: python2-certbot-0.30.2-1.el7.noarch
--> Processing Dependency: python2-pyrfc3339 for package: python2-certbot-0.30.2-1.el7.noarch
--> Processing Dependency: pytz for package: python2-certbot-0.30.2-1.el7.noarch
--> Running transaction check
---> Package audit-libs-python.x86_64 0:2.8.4-4.el7 will be installed
---> Package checkpolicy.x86_64 0:2.5-8.el7 will be installed
---> Package libcgroup.x86_64 0:0.41-20.el7 will be installed
---> Package libsemanage-python.x86_64 0:2.5-14.el7 will be installed
---> Package python-IPy.noarch 0:0.75-6.el7 will be installed
---> Package python-setuptools.noarch 0:0.9.8-7.el7 will be installed
--> Processing Dependency: python-backports-ssl_match_hostname for package: python-setuptools-0.9.8-7.el7.noarch
---> Package python-zope-component.noarch 1:4.1.0-3.el7 will be installed
--> Processing Dependency: python-zope-event for package: 1:python-zope-component-4.1.0-3.el7.noarch
---> Package python-zope-interface.x86_64 0:4.0.5-4.el7 will be installed
---> Package python2-acme.noarch 0:0.30.2-1.el7 will be installed
--> Processing Dependency: pyOpenSSL >= 0.13 for package: python2-acme-0.30.2-1.el7.noarch
--> Processing Dependency: python-ndg_httpsclient for package: python2-acme-0.30.2-1.el7.noarch
--> Processing Dependency: python-requests-toolbelt for package: python2-acme-0.30.2-1.el7.noarch
--> Processing Dependency: python2-pyasn1 for package: python2-acme-0.30.2-1.el7.noarch
--> Processing Dependency: python2-requests for package: python2-acme-0.30.2-1.el7.noarch
--> Processing Dependency: python2-six for package: python2-acme-0.30.2-1.el7.noarch
---> Package python2-configargparse.noarch 0:0.11.0-1.el7 will be installed
---> Package python2-cryptography.x86_64 0:1.7.2-2.el7 will be installed
--> Processing Dependency: python-six >= 1.4.1 for package: python2-cryptography-1.7.2-2.el7.x86_64
--> Processing Dependency: python-idna >= 2.0 for package: python2-cryptography-1.7.2-2.el7.x86_64
--> Processing Dependency: python-cffi >= 1.4.1 for package: python2-cryptography-1.7.2-2.el7.x86_64
--> Processing Dependency: python-ipaddress for package: python2-cryptography-1.7.2-2.el7.x86_64
--> Processing Dependency: python-enum34 for package: python2-cryptography-1.7.2-2.el7.x86_64
---> Package python2-future.noarch 0:0.16.0-6.el7 will be installed
---> Package python2-josepy.noarch 0:1.1.0-1.el7 will be installed
---> Package python2-mock.noarch 0:1.0.1-10.el7 will be installed
---> Package python2-parsedatetime.noarch 0:2.4-5.el7 will be installed
---> Package python2-pyrfc3339.noarch 0:1.0-2.el7 will be installed
---> Package pytz.noarch 0:2016.10-2.el7 will be installed
---> Package setools-libs.x86_64 0:3.3.8-4.el7 will be installed
--> Running transaction check
---> Package pyOpenSSL.x86_64 0:0.13.1-4.el7 will be installed
---> Package python-backports-ssl_match_hostname.noarch 0:3.5.0.1-1.el7 will be installed
--> Processing Dependency: python-backports for package: python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch
---> Package python-cffi.x86_64 0:1.6.0-5.el7 will be installed
--> Processing Dependency: python-pycparser for package: python-cffi-1.6.0-5.el7.x86_64
---> Package python-enum34.noarch 0:1.0.4-1.el7 will be installed
---> Package python-idna.noarch 0:2.4-1.el7 will be installed
---> Package python-ipaddress.noarch 0:1.0.16-2.el7 will be installed
---> Package python-ndg_httpsclient.noarch 0:0.3.2-1.el7 will be installed
---> Package python-requests-toolbelt.noarch 0:0.8.0-1.el7 will be installed
--> Processing Dependency: python-requests for package: python-requests-toolbelt-0.8.0-1.el7.noarch
---> Package python-six.noarch 0:1.9.0-2.el7 will be installed
---> Package python-zope-event.noarch 0:4.0.3-2.el7 will be installed
---> Package python2-pyasn1.noarch 0:0.1.9-7.el7 will be installed
---> Package python2-requests.noarch 0:2.6.0-0.el7 will be installed
---> Package python2-six.noarch 0:1.9.0-0.el7 will be installed
--> Running transaction check
---> Package python-backports.x86_64 0:1.0-8.el7 will be installed
---> Package python-pycparser.noarch 0:2.14-1.el7 will be installed
--> Processing Dependency: python-ply for package: python-pycparser-2.14-1.el7.noarch
---> Package python-requests.noarch 0:2.6.0-1.el7_1 will be installed
--> Processing Dependency: python-urllib3 >= 1.10.2-1 for package: python-requests-2.6.0-1.el7_1.noarch
--> Processing Dependency: python-chardet >= 2.2.1-1 for package: python-requests-2.6.0-1.el7_1.noarch
--> Running transaction check
---> Package python-chardet.noarch 0:2.2.1-1.el7_1 will be installed
---> Package python-ply.noarch 0:3.4-11.el7 will be installed
---> Package python-urllib3.noarch 0:1.10.2-5.el7 will be installed