웹 서비스 보안 기본 구성

웹 서비스 보안(WS-Security) 구성은 런타임 시 WS-Security 정책을 보완하는 구성입니다. WS-Security 구성은 CXF 이름 및 값 쌍 스타일을 따르며 CXF 특성 이름을 유지합니다. 일부 특성에는 기본값이 있지만 일부 특성에는 없습니다.

server.xml 파일에서 WebSphere® Application Server Liberty는 모든 서비스에 적용되는 서버 레벨 구성을 제공합니다. 이러한 구성을 기본 WS-Security 구성이라고 합니다.

server.xml 파일에는 두 가지의 기본 웹 서비스 보안 구성이 있습니다. 클라이언트 애플리케이션에 대한 구성과 제공자 애플리케이션에 대한 구성입니다. 다른 WS-Security 구성은 server.xml 파일에 존재할 수 없습니다. 기본값에서 벗어나는 애플리케이션에 대한 사용자 정의 WS-Security 구성이 필요한 경우 구성은 프로그래밍 방식으로 완료되어야 합니다.

다음 예제는 기본 클라이언트 구성을 보여줍니다.
<wsSecurityClient id="default"
                  ws-security.username="user2"
                  ws-security.password="security">
  <signatureProperties org.apache.ws.security.crypto.merlin.keystore.type="jks"
                       org.apache.ws.security.crypto.merlin.keystore.password="LibertyX509Client"
                       org.apache.ws.security.crypto.merlin.keystore.alias="x509ClientCert"
                       org.apache.ws.security.crypto.merlin.file="${server.config.dir}/x509ClientDefault.jks"/>
</wsSecurityClient>
다음 예제는 기본 제공자 구성을 보여줍니다.
<wsSecurityProvider id="default"
                    ws-security.username="user2">
  <encryptionProperties org.apache.ws.security.crypto.merlin.keystore.type="jks"
                        org.apache.ws.security.crypto.merlin.keystore.password="LibertyX509Server"
                        org.apache.ws.security.crypto.merlin.keystore.alias="x509ServerCert"
                        org.apache.ws.security.crypto.merlin.file="${server.config.dir}/x509ServerDefault.jks"/>
</wsSecurityProvider>
다음 표에서는 Liberty의 기본 WS-Security 사용자 특성을 보여줍니다. 이와 같은 특성은 CXF에서도 볼 수 있습니다.
표 1. Liberty 및 CXF의 기본 WS-Security 사용자 특성
Liberty/CXF 특성 기본값
ws-security.username none
ws-security.password none
ws-security.signature.username none
ws-security.encryption.username none
다음 표는 Liberty의 WS-Security 콜백 핸들러 클래스 및 암호화 특성과 함께 이와 동등한 CXF 특성(다른 경우)을 보여줍니다.
표 2. Liberty의 WS-Security 콜백 핸들러 클래스 및 암호화 특성과 함께 이와 동등한 CXF 특성
Libertyproperty CXF 특성 기본값
ws-security.callback-handler   none
<signatureProperties> ws-security.signature.properties none
<encryptionProperties> ws-security.encryption.properties none
WebSphere Application Server에서 wss4j 특성은 signatureProperties 또는 encryptionProperties 요소의 속성으로 지정됩니다. 다음 예제는 wss4j 특성을 보여줍니다.
<signatureProperties org.apache.ws.security.crypto.merlin.keystore.type="jks"
                     org.apache.ws.security.crypto.merlin.keystore.password="LibertyX509Client"
                     org.apache.ws.security.crypto.merlin.keystore.alias="x509ClientDefault"
                     org.apache.ws.security.crypto.merlin.file="${server.config.dir}/x509ClientDefault.jks">
</signatureProperties>
다음 표는 Libertywss4j 암호화 특성을 보여줍니다. 이와 같은 특성은 CXF에서도 볼 수 있습니다.
표 3. Liberty 및 CXF의 wss4j 암호화 특성
Liberty/CXF 특성 기본값
org.apache.ws.security.crypto.provider

org.apache.ws.security.components.
crypto.Merlin

org.apache.ws.security.crypto.
merlin.keystore.provider

설치된 제공자로 기본 설정됨

org.apache.ws.security.crypto.
merlin.cert.provider

키 저장소 제공자로 기본 설정됨

org.apache.ws.security.crypto.
merlin.x509crl.file

none
다음 표는 Libertywss4j 키 저장소 특성을 보여줍니다. 이와 같은 특성은 CXF에서도 볼 수 있습니다.
표 4. Liberty 및 CXF의 wss4j 키 저장소 특성
Liberty/CXF 특성 기본값

org.apache.ws.security.crypto.
merlin.keystore.file

none

org.apache.ws.security.crypto.
merlin.keystore.password

none

org.apache.ws.security.crypto.
merlin.keystore.type

none

org.apache.ws.security.crypto.
merlin.keystore.alias

none

org.apache.ws.security.crypto.
merlin.keystore.private.password

none
다음 표는 Libertywss4j 신뢰 저장소 특성을 보여줍니다. 이와 같은 특성은 CXF에서도 볼 수 있습니다.
표 5. Liberty 및 CXF의 wss4j 신뢰 저장소 특성
Libertyproperty 기본값

org.apache.ws.security.crypto.
merlin.truststore.file

none

org.apache.ws.security.crypto.
merlin.truststore.password

none

org.apache.ws.security.crypto.
merlin.truststore.type

none
다음 표는 Liberty의 WS-Security 기타 특성을 보여줍니다. 이와 같은 특성은 CXF에서도 볼 수 있습니다.
표 6. Liberty 및 CXF의 WS-Security 기타 특성
Liberty/CXF 특성 기본값
ws-security.enable.nonce.cache true
ws-security.cache.config.file none
다음 표는 Liberty에서만 지원되는 특성을 보여줍니다.
표 7. Liberty에서만 지원되는 특성
Libertyproperty CXF 특성 기본값
callerToken none none

추가 특성 구성

WS-Security 런타임 환경에 추가 구성 정보를 제공하기 위해 몇몇 추가 특성을 설정할 수 있습니다. 이 특성에 관한 자세한 정보는 다음 링크를 참조하십시오.

추가 특성은 server.xml 파일의 기본 WS-Security 구성에 지정할 수 있습니다.

예를 들어, 추가 특성을 지정하려면 wsSecurityClient 또는 wsSecurityProvider 섹션이나 둘 다를 지정하십시오.
<wsSecurityProvider id="default"
  <signatureProperties ... />
  <encryptionProperties ... />
  ws-security.cache.config.file = "${server.config.dir}/resources/ws-security/new_cxf-ehcache.xml"
</wsSecurityProvider>

<wsSecurityClient id="default"
  <signatureProperties ... />
  <encryptionProperties ... />
  ws-security.username-token.always.encrypted="false"
</wsSecurityClient>

캐시 구성

WS-Security는 UsernameToken의 nonce, created 시간소인 및 보안 토큰에 대한 기본 캐싱 구현을 제공합니다. 기본 캐시 구현은 다음 기본 설정의 ehCache를 기반으로 합니다.
maxEntriesLocalHeap="5000"
timeToIdleSeconds="3600"
timeToLiveSeconds="3600"
overflowToDisk="true"
maxElementsOnDisk="10000000"
diskPersistent="false"
diskExpiryThreadIntervalSeconds="120"
memoryStoreEvictionPolicy="LRU"

기본 캐시 설정을 수정하기 위해 ehCache 구성 XML 파일을 제공할 수 있습니다. 기본 설정에서 벗어나도록 할 사용자 정의 특성이 있는 파일 이름을 지정하려면 ws-security.cache.config.file 사용자 정의 특성을 사용하십시오. 이 파일은 서버 프로파일에 두어야 합니다. http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/resources/cxf-ehcache.xml?view=markup에서 추가 샘플 캐시 설정 구성 파일을 찾을 수 있습니다.

더 강력한 서명 알고리즘 구성

SHA1 서명 알고리즘은 약하므로, US NIST(National Institute of Standards and Technology)에서는 더 강력한 서명 알고리즘을 사용할 것을 권장합니다.

그러나, WS-Security 정책 1.3은 유일한 서명 알고리즘으로 HmacSha1 또는 RsaSha1(전체적으로 sha1이라고 함)을 정의합니다. Liberty의 WS-Security에는 다음의 보다 강력한 서명 알고리즘을 사용하기 위한 구성 옵션이 있습니다.
  • RSA-SHA-256
  • RSA-SHA-384
  • RSA-SHA-512
  • HMAC-SHA-256
  • HMAC-SHA-384
  • HMAC-SHA-512

보다 강력한 서명 알고리즘을 지원하도록 Liberty의 WS-Security를 구성하려면, signatureAlgorithm 속성을 사용하여 server.xml 파일의 <signatureProperties> 요소 내에 필수 알고리즘을 정의하십시오. signatureAlgorithm 속성의 올바른 값은 sha256, sha384 및 sha512입니다. 예를 들어, 당신이 signatureAlgorithm 속성의 값으로 sha512를 지정하는 경우 비대칭 키가 있는 서명에서 사용되는 서명 알고리즘은 RSA-SHA-512이고 대칭 키가 있는 서명에서 사용되는 서명 알고리즘은 HMAC-SHA-512입니다.

다음 예제는 sha256 서명 알고리즘이 필요한 샘플 클라이언트 측 구성을 보여줍니다.
<wsSecurityClient id="default"
  ws-security.password="security"
  ws-security.username="user1"
  ws-security.callback-handler="com.ibm.ws.wssecurity.example.cbh.CommonPasswordCallback"
  ws-security.signature.username="soaprequester">
  <signatureProperties 
    signatureAlgorithm="sha256"
    org.apache.ws.security.crypto.merlin.keystore.type="jks"
    org.apache.ws.security.crypto.merlin.keystore.password="client"
    org.apache.ws.security.crypto.merlin.keystore.alias="soaprequester"
    org.apache.ws.security.crypto.merlin.file="${server.config.dir}/dsig-sender.ks" />
</wsSecurityClient>
다음 예제는 sha256 서명 알고리즘이 필요한 샘플 제공자 측 구성을 보여줍니다.
<wsSecurityProvider id="default"
  ws-security.callback-handler="com.ibm.ws.wssecurity.example.cbh.CommonPasswordCallback"
  ws-security.signature.username="soapprovider">
  <signatureProperties 
    signatureAlgorithm="sha256"
    org.apache.ws.security.crypto.merlin.keystore.type="jks"
    org.apache.ws.security.crypto.merlin.keystore.password="server"
    org.apache.ws.security.crypto.merlin.keystore.alias="soapprovider"
    org.apache.ws.security.crypto.merlin.file="${server.config.dir}/dsig-receiver.ks" /> 
</wsSecurityProvider>

주제의 유형을 표시하는 아이콘 개념 주제

파일 이름: cwlp_wssec_defaultconfig.html