
strongswan v6.1.0
strongSwan - IPsec 기반 VPN
strongSwan 구성
개요
strongSwan은 오픈소스 IPsec 기반 VPN 솔루션입니다.
이 문서는 최신 vici Versatile IKE Configuration Interface를 사용하는 strongSwan swanctl 명령에 대한 간단한 소개일 뿐입니다. 레거시 stroke 구성 인터페이스를 사용하는 더 이상 사용되지 않는 ipsec 명령은 여기에 설명되어 있습니다. 더 자세한 정보는 매뉴얼 페이지, 새로운 문서 사이트 및 레거시 wiki를 참조하십시오.
빠른 시작
사용자, 호스트 및 게이트웨이용 인증서는 가상의 strongSwan CA에서 발급됩니다. 예제 시나리오에서 CA 인증서 strongswanCert.pem은 피어를 인증할 수 있도록 모든 VPN 엔드포인트에 있어야 합니다. 특정 VPN 애플리케이션의 경우 타사 CA의 인증서를 사용하거나 아래 섹션 중 하나에서 설명할 strongSwan pki 도구를 사용하여 필요한 개인 키와 인증서를 직접 생성할 수 있습니다.
사이트 간(Site-to-Site) 사례
이 시나리오에서는 두 보안 게이트웨이 _moon_과 _sun_이 두 게이트웨이 사이에 설정된 VPN 터널을 통해 두 서브넷 _moon-net_과 _sun-net_을 서로 연결합니다:
10.1.0.0/16 -- | 192.168.0.1 | === | 192.168.0.2 | -- 10.2.0.0/16
moon-net moon sun sun-net
게이트웨이 _moon_의 구성:
/etc/swanctl/x509ca/strongswanCert.pem
/etc/swanctl/x509/moonCert.pem
/etc/swanctl/private/moonKey.pem
/etc/swanctl/swanctl.conf:
connections {
net-net {
remote_addrs = 192.168.0.2
local {
auth = pubkey
certs = moonCert.pem
}
remote {
auth = pubkey
id = "C=CH, O=strongSwan, CN=sun.strongswan.org"
}
children {
net-net {
local_ts = 10.1.0.0/16
remote_ts = 10.2.0.0/16
start_action = trap
}
}
}
}
게이트웨이 _sun_의 구성:
/etc/swanctl/x509ca/strongswanCert.pem
/etc/swanctl/x509/sunCert.pem
/etc/swanctl/private/sunKey.pem
/etc/swanctl/swanctl.conf:
connections {
net-net {
remote_addrs = 192.168.0.1
local {
auth = pubkey
certs = sunCert.pem
}
remote {
auth = pubkey
id = "C=CH, O=strongSwan, CN=moon.strongswan.org"
}
children {
net-net {
local_ts = 10.2.0.0/16
remote_ts = 10.1.0.0/16
start_action = trap
}
}
}
}
이 시나리오에서 사용되는 로컬 및 원격 ID는 최종 엔터티 인증서에 포함된 subjectDistinguishedNames입니다. 인증서와 개인 키는 다음 명령으로 charon 데몬에 로드됩니다:
swanctl --load-creds
반면에
swanctl --load-conns
swanctl.conf에 정의된 연결을 로드합니다. start_action = trap을 사용하면 IPsec 연결은 터널을 통과하려는 첫 번째 일반 텍스트 페이로드 IP 패킷과 함께 자동으로 설정됩니다.
호스트 간(Host-to-Host) 사례
이것은 뒤에 서브넷이 없는 두 단일 호스트 간의 구성입니다. 호스트 간 연결에는 IPsec 전송 모드로 충분하지만 기본 IPsec 터널 모드를 사용하겠습니다.
| 192.168.0.1 | === | 192.168.0.2 |
moon sun
호스트 _moon_의 구성:
/etc/swanctl/x509ca/strongswanCert.pem
/etc/swanctl/x509/moonCert.pem
/etc/swanctl/private/moonKey.pem
/etc/swanctl/swanctl.conf:
connections {
host-host {
remote_addrs = 192.168.0.2
local {
auth=pubkey
certs = moonCert.pem
}
remote {
auth = pubkey
id = "C=CH, O=strongSwan, CN=sun.strongswan.org"
}
children {
net-net {
start_action = trap
}
}
}
}
호스트 _sun_의 구성:
/etc/swanctl/x509ca/strongswanCert.pem
/etc/swanctl/x509/sunCert.pem
/etc/swanctl/private/sunKey.pem
/etc/swanctl/swanctl.conf:
connections {
host-host {
remote_addrs = 192.168.0.1
local {
auth = pubkey
certs = sunCert.pem
}
remote {
auth = pubkey
id = "C=CH, O=strongSwan, CN=moon.strongswan.org"
}
children {
host-host {
start_action = trap
}
}
}
}
Roadwarrior 사례
이것은 strongSwan 게이트웨이가 일반적으로 동적 IP 주소를 가진 임의의 수의 원격 VPN 클라이언트에 서비스를 제공하는 매우 일반적인 사례입니다.
10.1.0.0/16 -- | 192.168.0.1 | === | x.x.x.x |
moon-net moon carol
게이트웨이 _moon_의 구성:
/etc/swanctl/x509ca/strongswanCert.pem
/etc/swanctl/x509/moonCert.pem
/etc/swanctl/private/moonKey.pem
/etc/swanctl/swanctl.conf:
connections {
rw {
local {
auth = pubkey
certs = moonCert.pem
id = moon.strongswan.org
}
remote {
auth = pubkey
}
children {
net-net {
local_ts = 10.1.0.0/16
}
}
}
}
roadwarrior _carol_의 구성:
/etc/swanctl/x509ca/strongswanCert.pem
/etc/swanctl/x509/carolCert.pem
/etc/swanctl/private/carolKey.pem
/etc/swanctl/swanctl.conf:
connections {
home {
remote_addrs = moon.strongswan.org
local {
auth = pubkey
certs = carolCert.pem
id = [email protected]
}
remote {
auth = pubkey
id = moon.strongswan.org
}
children {
home {
local_ts = 10.1.0.0/16
start_action = start
}
}
}
}
remote_addrs에는 호스트 이름 moon.strongswan.org이 선택되었으며, 이는 런타임에 DNS에 의해 해당 IP 대상 주소로 확인됩니다. 이 시나리오에서 roadwarrior carol의 ID는 이메일 주소 [email protected]이며, 이는 roadwarrior 인증서 carolCert.pem에 subjectAlternativeName으로 포함되어야 합니다.
가상 IP를 사용하는 Roadwarrior 사례
Roadwarrior는 일반적으로 현재 연결된 ISP가 할당한 동적 IP 주소를 가지고 있습니다. _moon-net_에서 원격 액세스 클라이언트 _carol_로의 라우팅을 단순화하려면 roadwarrior가 사전 정의된 풀에서 선택된 내부 IP 주소를 가지는 것이 바람직합니다.
10.1.0.0/16 -- | 192.168.0.1 | === | x.x.x.x | -- 10.3.0.1
moon-net moon carol virtual IP
이 예제에서 가상 IP 주소는 주소 풀 10.3.0.0/16에서 선택되며, 이는 게이트웨이의 swanctl.conf에 다음 섹션을 추가하여 구성할 수 있습니다:
pools {
rw_pool {
addrs = 10.3.0.0/16
}
}
이 풀은 다음 명령을 사용하여 charon 데몬에 로드됩니다:
swanctl --load-pools
이 풀에서 IP 주소를 요청하기 위해 roadwarrior는 IKEv1 모드 구성 또는 IKEv2 구성 페이로드를 사용할 수 있습니다. 둘 다 구성은 동일합니다:
vips = 0.0.0.0
게이트웨이 _moon_의 구성:
/etc/swanctl/x509ca/strongswanCert.pem
/etc/swanctl/x509/moonCert.pem
/etc/swanctl/private/moonKey.pem
/etc/swanctl/swanctl.conf:
connections {
rw {
pools = rw_pool
local {
auth = pubkey
certs = moonCert.pem
id = moon.strongswan.org
}
remote {
auth = pubkey
}
children {
net-net {
local_ts = 10.1.0.0/16
}
}
}
}
pools {
rw_pool {
addrs = 10.30.0.0/16
}
}
roadwarrior _carol_의 구성:
/etc/swanctl/x509ca/strongswanCert.pem
/etc/swanctl/x509/carolCert.pem
/etc/swanctl/private/carolKey.pem
/etc/swanctl/swanctl.conf: