CentOS 에서는 racoon 을 사용한 IPsec 연결을 제공합니다. 일반적인 고정아이피 끼리의 host-to-host, net-to-net 연결방식은 다음 링크를 참고하시기 바랍니다.

http://www.centos.org/docs/5/html/5.2/Deployment_Guide/s2-networkscripts-interfaces-ipsec.html
http://www.centos.org/docs/5/html/5.2/Deployment_Guide/ch-vpn.html

http://www.linuxtopia.org/online_books/centos_linux_guides/centos_linux_security_guide/s1-ipsec-host2host.html


여기에 설명되어 있지 않은 IPsec 연결방식 중 road-warrior 는 유동 아이피와 IPsec 연결을 만들 때 사용됩니다. 유동 아이피를 가진 서버에게 실제 고정 아이피를 할당할 때 사용하는데요, CentOS 는 기본적으로 road-warrior 를 지원하지 않기 때문에 추가 설정이 필요합니다.

이 포스팅에서는 일반적인 IPsec 설정보다는 road-warrior 설정에 필요한 방법만을 설명합니다. IPsec에 대한 이해가 있고 CentOS 에서 일반적인 host-to-host, 또는 net-to-net 설정이 가능한 독자층을 대상으로 하고 있으니 자세한 설정 내용은 위 링크를 참고하기기 바랍니다.

일단 클라이언트쪽의 /etc/sysconfig/network-scripts/ifcfg-ipsec0 설정은 일반적인 설정과 크게 다르지 않습니다. DST 항목은 IPsec 을 연결할 서버가 되어야 합니다. SRC는 유동아이피이므로 지정하지 않습니다. SRCNET, DSTNET 을 지정하면 SRCNET -> DSTNET 의 연결에 대해 IPsec 을 통하도록 policy를 생성합니다.

서버쪽의 /etc/sysconfig/network-scripts/ifcfg-ipsec0 에서는 반대로 DST=anonymous 로 지정합니다. SRC는 지정하지 않아도 됩니다. 어차피 policy 는 클라이언트 -> 서버 방향으로 SA 생성 단계에서 자동으로 만들어지는 것이 목표입니다.

클라이언트, 서버 양쪽 모두 IKE_METHOD=X509 를 사용합니다. PSK 방식을 많이 사용하시겠지만, PSK는 CentOS ifup-ipsec 스크립트 구조상 identifier가 address로 고정되기 때문에 road-warrior 방식에서는 적합하지 않습니다. 다음 커맨드를 서버에서 사용하여 X509 인증을 설정합니다.

sudo openssl req -x509 -new -keyout /etc/racoon/certs/<서버키이름>.private -out /etc/racoon/certs/<서버키이름>.public -nodes -days 3650
chmod 600 /etc/racoon/certs/<서버키이름>.private
그리고 /etc/racoon/certs/<서버키이름>.public 파일을 클라이언트의 /etc/racoon/certs/ 로 복사해줍니다.
클라이언트에서도 똑같은 방법으로 <클라이언트키이름> 을 사용하여 키페어를 생성 후, <클라이언트키이름>.public 파일을 서버쪽으로 복사합니다.

이제 서버의 /etc/racoon/certs/ 에는 <서버키이름>.private <서버키이름>.public <클라이언트키이름>.public 파일이 있을겁니다.
클라이언트의 /etc/racoon/certs/ 에는 <클라이언트키이름>.private <클라이언트키이름>.public <서버키이름>.public 파일이 있어야 합니다.
그러면 서버의 ifcfg-ipsec0 에서 cert 파일 설정을 다음과 같이 해 줄 수 있습니다. .public, .private 는 붙이지 않습니다.

IKE_CERTFILE=<서버키이름>
IKE_PEER_CERTFILE=<클라이언트키이름>
클라이언트에서는 반대로 입력하면 됩니다.

그러면 ifcfg-ipsec0 준비는 끝났습니다. ifup ipsec0 으로 ipsec0 인터페이스를 올리면 /etc/racoon/racoon.conf 파일과 해당 DST 에 대한 conf 파일이 자동으로 생성됩니다. 라우팅, 폴리시 추가에서 에러가 주르륵 나지만 동작에는 큰 문제가 없습니다.

이제 마지막으로 서버의 /etc/racoon/anonymous.conf 파일을 수정해 generate_policy on; 옵션을 다음과 같이 추가해줍니다.
remote anonymous
{
        generate_policy on;
        exchange_mode aggressive, main;
        my_identifier asn1dn;
        peers_identifier asn1dn;
...생략...

위 설정이 없으면 다음과 같은 에러가 발생합니다.
2009-11-29 09:13:07: INFO: respond new phase 2 negotiation: xxx.xxx.xxx.xxx[500]<=>yyy.yyy.yyy.yyy[500]
2009-11-29 09:13:07: ERROR: no policy found: aaa.aaa.aaa.0/n[0] bbb.bbb.bbb.bbb/m[0] proto=any dir=in
2009-11-29 09:13:07: ERROR: failed to get proposal for responder.
2009-11-29 09:13:07: ERROR: failed to pre-process packet.

다시 ifdown ipsec0; ifup ipsec0 을 통해 인터페이스를 재시작하고 클라이언트에서 서버로 IPsec 접속이 되나 확인합니다.

설정 후에는 다음과 같은 에러가 발생하나, 정상적인 동작입니다.
2009-11-29 09:14:58: INFO: respond new phase 2 negotiation: xxx.xxx.xxx.xxx[500]<=>yyy.yyy.yyy.yyy[500]
2009-11-29 09:14:58: INFO: no policy found, try to generate the policy : aaa.aaa.aaa.0/n[0] bbb.bbb.bbb.bbb/m[0] proto=any dir=in
2009-11-29 09:14:58: INFO: IPsec-SA established: ESP/Tunnel 211.215.9.154[500]->165.132.148.222[500] spi=216702467(0xcea9e03)
2009-11-29 09:14:58: INFO: IPsec-SA established: ESP/Tunnel yyy.yyy.yyy.yyy[500]<=>xxx.xxx.xxx.xxx[500] spi=~~(0x~~~)
2009-11-29 09:14:58: ERROR: such policy does not already exist: "aaa.aaa.aaa.0/n[0] bbb.bbb.bbb.bbb/m[0] proto=any dir=in"
2009-11-29 09:14:58: ERROR: such policy does not already exist: "aaa.aaa.aaa.0/n[0] bbb.bbb.bbb.bbb/m[0] proto=any dir=fwd"
2009-11-29 09:14:58: ERROR: such policy does not already exist: "bbb.bbb.bbb.bbb/m[0] aaa.aaa.aaa.0/n[0] proto=any dir=out"

만일 서버의 /etc/sysconfig/network-scripts/ifcfg-ipsec0 파일을 수정했다면, /etc/racoon/anonymous.conf 이 재생성되므로 generate_policy on; 를 다시 추가해줘야 합니다. 서버에 있는 /etc/sysconfig/network-scripts/ifup-ipsec 파일을 수정하여 자동적으로 추가하게 만드는 방법도 있지만, 배포판 업데이트시 충돌을 야기하기 때문에 추천하지는 않습니다.



CentOS provides IPsec with racoon IKE and scripts. It's well documented in following official and other links, if you are using host-to-host or net-to-net connection between two hosts which have fixed ip-address on both side.

http://www.centos.org/docs/5/html/5.2/Deployment_Guide/s2-networkscripts-interfaces-ipsec.html
http://www.centos.org/docs/5/html/5.2/Deployment_Guide/ch-vpn.html

http://www.linuxtopia.org/online_books/centos_linux_guides/centos_linux_security_guide/s1-ipsec-host2host.html


But, there are another way to use IPsec, which is called as "road-warrior" is used to make secure IPsec connection from client with dynamic ip-address to server. We need to configure a bit more to use this way, because CentOS do NOT support road-warrior officially.

In this post, the specific how-to about road-warrior will be explained, aiming who understand basics of IPsec and can setup generic host-to-host or net-to-net connection in CentOS. If you are not familiar with these topics, please refer above links.


First, the configuration in "/etc/sysconfig/network-scripts/ifcfg-ipsec0" is not significantly differ with generic IPsec setting. "DST" must be set with ip-address of server, and "SRC" should be omitted because the address is dynamic. Packets from "SRCNET" to "DSTNET" will be relayed via IPsec with the policy created by script.

On the contrary,  server should use "DST=anonymous" in "/etc/sysconfig/network-scripts/ifcfg-ipsec0", this is magic keyword for road-warrior. "SRC" should be excluded, policies will be generated with the generation of SA.

For authentication, "IKE_METHOD=X509" would be set in this case. PSK is popular, but CentOS use address as default identifier when PSK is used which is not suitable with road-warrior. Use following commands to produce X509 key-pair.

sudo openssl req -x509 -new -keyout /etc/racoon/certs/<server_key_name>.private -out /etc/racoon/certs/<server_key_name>.public -nodes -days 3650
chmod 600 /etc/racoon/certs/<server_key_name>.private
Next, copy /etc/racoon/certs/<server_key_name>.public file to client at the location of /etc/racoon/certs/.

Vice versa, make key-pair in the client with <client_key_name> and copy <client_key_name>.public file to server side.

In summary, server's /etc/racoon/certs/ should have following files: <server_key_name>.private <server_key_name>.public <client_key_name>.public
And client's /etc/racoon/certs/ does <client_key_name>.private <client_key_name>.public <server_key_name>.public

Then the certification setting in ifcfg-ipsec0 can be set like this:
IKE_CERTFILE=<server_key_name>
IKE_PEER_CERTFILE=<client_key_name>
 .public, .private are excluded in this files. The client use reversed order of there key.

Now ifcfg-ipsec0 is ready for ifup. Use "ifup ipsec0" command to activate ipsec0 interface, and "/etc/racoon/racoon.conf", "DST.conf " file will be generated. You will see several errors while getting routes and generating policies, but it is not problem on operation.

Finally, modify server's "/etc/racoon/anonymous.conf" to add "generate_policy on;" option.
remote anonymous
{
        generate_policy on;
        exchange_mode aggressive, main;
        my_identifier asn1dn;
        peers_identifier asn1dn;
...omitted...

Following errors will be occur if you don't add above configuration:
2009-11-29 09:13:07: INFO: respond new phase 2 negotiation: xxx.xxx.xxx.xxx[500]<=>yyy.yyy.yyy.yyy[500]
2009-11-29 09:13:07: ERROR: no policy found: aaa.aaa.aaa.0/n[0] bbb.bbb.bbb.bbb/m[0] proto=any dir=in
2009-11-29 09:13:07: ERROR: failed to get proposal for responder.
2009-11-29 09:13:07: ERROR: failed to pre-process packet.

Toggle the ipsec0 interface down and up with "ifdown ipsec0; ifup ipsec0" command. The IPsec will work functionally when client connect to server!

Some other error can be found in log, but it's just usual error message.
2009-11-29 09:14:58: INFO: respond new phase 2 negotiation: xxx.xxx.xxx.xxx[500]<=>yyy.yyy.yyy.yyy[500]
2009-11-29 09:14:58: INFO: no policy found, try to generate the policy : aaa.aaa.aaa.0/n[0] bbb.bbb.bbb.bbb/m[0] proto=any dir=in
2009-11-29 09:14:58: INFO: IPsec-SA established: ESP/Tunnel 211.215.9.154[500]->165.132.148.222[500] spi=216702467(0xcea9e03)
2009-11-29 09:14:58: INFO: IPsec-SA established: ESP/Tunnel yyy.yyy.yyy.yyy[500]<=>xxx.xxx.xxx.xxx[500] spi=~~(0x~~~)
2009-11-29 09:14:58: ERROR: such policy does not already exist: "aaa.aaa.aaa.0/n[0] bbb.bbb.bbb.bbb/m[0] proto=any dir=in"
2009-11-29 09:14:58: ERROR: such policy does not already exist: "aaa.aaa.aaa.0/n[0] bbb.bbb.bbb.bbb/m[0] proto=any dir=fwd"
2009-11-29 09:14:58: ERROR: such policy does not already exist: "bbb.bbb.bbb.bbb/m[0] aaa.aaa.aaa.0/n[0] proto=any dir=out"

If you change "/etc/sysconfig/network-scripts/ifcfg-ipsec0" file on the server, you have to insert "generate_policy on;" again because "/etc/racoon/anonymous.conf" is regenerated while interface up.

You can modify the server's "/etc/sysconfig/network-scripts/ifup-ipsec" to avoid the repetition on change of configuration, but this workaround make another possibility of conflicting while update or upgrading system. So I do not recommend this workaround.

Posted by Arcy

2009/11/30 01:54 2009/11/30 01:54
,
Response
No Trackback , No Comment
RSS :
http://arcy.org/tc/rss/response/86

Trackback URL : http://arcy.org/tc/trackback/86

Internet Explorer 7 혹은 8에서 검색 공급자를 추가하려면 아래 링크를 누르시면 됩니다.
( 안의 이름은 추가되는 공급자 이름입니다.)

  1. google.co.kr 한국어 검색을 검색 공급자로 추가하기 (구글)
  2. google.com 한국어 검색을 검색 공급자로 추가하기 (Google (한국어))
  3. google.com 영어 검색을 검색 공급자로 추가하기 (Google)
링크를 클릭하시면 다음과 같은 화면이 뜹니다.
사용자 삽입 이미지
저기 뜨는 시작: URL 은 지금 이 블로그를 에서 설치를 한다는 확인입니다. 공급자가 잘 추가되었는지 레지스트리에서 확인하셔도 되고, 불안하시면 지우셔도 됩니다.

기본 검색 공급자로 지정 체크하면 기본으로 설정됩니다. 현재 Internet Explorer 의 icon 설정, 추천 검색어가 적용되어 있습니다.




위에 요약 해놨으니 아래는 포스팅 계기입니다.

사용자 삽입 이미지
윈도우를 새로 깔린 컴퓨터에서 Internet Explorer 를 켜면, 오른쪽 위의 검색창은 Live Search 로 연결이 됩니다. 요즘은 Bing 으로 검색되죠.

전 메인 검색엔진으로 구글을 쓰기 때문에, 이걸 바꾸는게 작업의 시작입니다.

하지만 저기 화살표키를 눌러 추가 공급자 검색에 가봐도, 한국에서 구글은 트래픽이 적다는 이유로 쉽게 추가할 수 없습니다.

검색 공급자를 어떻게 추가하나 검색해봐도 대부분 저기서 URL어쩌구=TEST 넣어서 하는 방법이 대부분입니다. 하지만 여기도 조금 쉽게 추가하는 방법이 존재합니다.

http://winnwe.com/windowsweblog/perma/400/

위 블로그에서 검색자 추가 링크를 봤던 기억이 나서 다시 찾아봤습니다. 그런데 영어 검색링크밖에 없군요. -_-; 그래서 간만에 구글 검색자 추가에 완결을 맺고자 이 포스트를 씁니다. 제발 이 포스트가 검색 상위에 랭크돼서, 다들 삽질 안하고 쉽게 검색자를 추가할 수 있으면 좋겠습니다.

xml 은 Microsoft 에서 제공하는 opensearch xml 을 기본으로 언어만 한글, 영어로 고정시켜놨습니다.

혹시 구글 외에 더 원하는 검색 공급자가 있으면 리플 달아주세요.


참조 사이트:

http://www.opensearch.org/Specifications/OpenSearch/1.1

Posted by Arcy

2009/11/24 23:41 2009/11/24 23:41
Response
No Trackback , No Comment
RSS :
http://arcy.org/tc/rss/response/97

Trackback URL : http://arcy.org/tc/trackback/97


블로그 이미지

- Arcy

Notices

Archives

Authors

  1. Arcy

Calendar

«   2009/11   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30          

Site Stats

Total hits:
77642
Today:
16
Yesterday:
96