IT System Management/Security

strongSwan과 상용 방화벽 제품 간 IPsec 연결 구성

iseop 2021. 12. 15. 21:06   인쇄용 버전

기본적으로 IKE/IPsec은 산업 표준이므로 해당 표준을 잘 구현한 구현체들은 큰 문제 없이 연동이 됩니다.

혹시나 필요할 수도 있을까봐, 오픈소스 IKE 데몬 strongSwan과 Cisco ASA간의 순수 IPsec 터널 설정을 정리해서 올려둡니다.

 

192.168.0.0/24 - [SWAN] - WAN - [ASA] - 192.168.1.0/24

 

strongSwan ipsec.conf

config setup
	# strictcrlpolicy=yes
	# uniqueids = no
    
# 연결 설정 기본값으로, 다른 connection에게 상속된다.
conn %default
	ikelifetime=1440m	# IKE Phase 1의 수명으로, 기본 1일.
	keylife=60m		# IKE Phase 2의 수명으로, 기본 1시간.
	rekeymargin=3m		# Phase 1 및 2의 SA 만료 전 n분에 SA 협상을 실행.
	authby=secret

# ASA 연결을 위한 connection 추가
conn ASA
	left=100.10.10.1		# SWAN의 외부 주소.
	leftsubnet=192.168.0.0/24	# SWAN 내부 네트워크.
	leftid=100.10.10.1		# SWAN의 식별자.
	right=100.10.10.2		# ASA의 외부 주소.
	rightsubnet=192.168.1.0/24	# ASA 내부 네트워크.
	rightid=100.10.10.2		# ASA의 식별자.
	auto=add			# SWAN 실행 시 해당 conn을 로드하고 연결 대기.
	ike=aes128-sha1-modp1536	# 보안 매개변수.
	esp=aes128-sha1			# 터널 모드이므로 esp.
	keyexchange=ikev2		# Phase 1에서 IKEv2 사용.

 

strongSwan ipsec.secrets

100.10.10.1 : PSK "passwordpassword"
100.10.10.2 : PSK "passwordpassword"

 

Cisco ASA

ASA(config)# crypto ikev2 policy 5
ASA(config-ikev2-policy)# encryption aes
ASA(config-ikev2-policy)# group 5
ASA(config-ikev2-policy)# prf sha
ASA(config-ikev2-policy)# lifetime seconds 86400

ASA(config)# crypto ipsec ikev2 ipsec-proposal SWAN_PROPOSAL
ASA(config-ipsec-proposal)# protocol esp encryption aes
ASA(config-ipsec-proposal)# protocol esp integrity sha-1

ASA(config)# access-list ASA_SWAN extended permit ip 192.168.1.0 255.255.255.0
192.168.0.0 255.255.255.0

ASA(config)# crypto map SWAN_CRYPTO_MAP 1 match address ASA_SWAN
ASA(config)# crypto map SWAN_CRYPTO_MAP 1 set peer 100.10.10.1
ASA(config)# crypto map SWAN_CRYPTO_MAP 1 set ikev2 ipsec-proposal SWAN_PROPOSAL
ASA(config)# crypto map SWAN_CRYPTO_MAP interface OUTSIDE

ASA(config)# tunnel-group 100.10.10.1 type ipsec-l2l
ASA(config)# tunnel-group 100.10.10.1 ipsec-attributes
ASA(config-tunnel-ipsec)# ikev2 local-authentication pre-shared-key passwordpassword
ASA(config-tunnel-ipsec)# ikev2 remote-authentication pre-shared-key passwordpassword

ASA(config)# crypto ikev2 enable OUTSIDE
ASA(config)# route OUTSIDE 192.168.0.0 255.255.255.0 100.10.10.1