Chapter. 3 Reference

장에서는 mod_ssl에서 사용되는 모든 설정 지시자(configuration directive) 함께 mod_ssl 제공하는 user visible feature들에 대하여 설명하며, 이를 통해 mod_ssl 어떤 특정한 기능이 실제로 어떻게 설정되는가 혹은 활성화되는가를 설명한다. directive Apache 문서에서 표준 Apache directive 설명하는 방식과 유사한 방식으로 기술되어지는데, 여기에는 directive syntax, default, context 등의 요소들이 기술된다.

Mod_ssl에서 사용하는 directive 크게 세가지 분류(class) 나눠진다. 먼저 Global Directive(context server config directive) server config 파일에서 <VirtualHost> 같은 sectioning command 밖에서만 사용될 있다. 번째는 Per-Server Directive(context server config, virtualhost directive)로서 server config 파일에서 <VirtualHost> 섹션의 밖이나 안에서 모두 사용될 있으며, <VirtualHost> 섹션의 밖에서 사용될 때는 메인(Default) 서버에 대한 설정이 된다. 번째는 Per-Directory Directive(context server config, virtual host, directory, .htaccess directive)로서 server config 파일과 per-directory .htaccess 파일의 어느 곳에서든 사용될 있다. 세가지 class들은 서로의 부분 집합이 되는데, per-directory directive per-server global context에서 사용될 있으며, 또한 per-server class directive global context에서 사용될 수도 있다.

다른 Apache SSL 숄류션들에 대한 backward compatibility 위해 mod_ssl 제공하는 부가적인 directive들과 환경 변수들은 Compatibility Chapter 기술되어져 있다.

 

Configuration Directives

SSLPassPhraseDialog

Name

SSLPassPhraseDialog

Description

Type of pass phrase dialog for encrypted private keys

Syntax

SSLPassPhraseDialog type

Default

SSLPassPhraseDialog builtin

Context

server config

Override

Not applicable

Status

Extension

Module

mod_ssl

Compatibility

mod_ssl 2.1

Apache 시동될 SSL 적용된 virtual host 대한 Certificate Private Key 읽어온다. 보안을 위해서 Private Key들은 암호화되어 있으며, 따라서 mod_ssld 관리자에게 암호화된 Private Key 복호화하기 위해서 Pass Phrase 요구한다. Pass Phare 요구하는 방식은 다음의 두가지 방식이 있다.

  • Builtin

Apache 구동할 관리자가 직접 암호화된 Private Key 대한 Pass Phrase 입력할 있는 interactive terminal dialog 보여주며, default 설정이다. SSL 적용할 virtual host 하나 이상 지정될 있기 때문에 dialog 수를 줄이기 위해서 다음과 같은 reuse-scheme 사용된다: 어떤 Private Key 복호화할 때까지 입력되었던 모든 Pass Phrase 시도해서 맞는 Pass Phrase 있으면 Private Key 대한 dialog 실행하지 않으며, 그렇지 않은 경우에만 새로운 Pass Phrase 요구하는 dialog 실행하고 입력받은 Pass Phrase 이후의 Private Key 위해서 기억되게 된다. N개의 암호화된 Private Key 파일에 대하여 N개의 서로 다른 Pass Phrase 사용할 경우 모든 N개의 Pass Phrase 입력하게 되며, 반면에 모든 N개의 Private Key 파일에 대하여 동일한 Pass Phrase 사용하였다면 단지 한번의 Pass Phrase 입력 dialog만이 실행되게 된다.

  • exec:/path/to/program

Apache 시동 시에 호출할 암호화된 Private Key 대한 external program 설정한다. 외부 프로그램은 servername:portnumber 인수로 입력받아서 해당되는 Pass Phrase stdout으로 출력하며, 시스템이 attacker 의하여 침해(compromise)되지 않았음을 확인하기 위해 먼저 security check 실행하게 되며, check 성공했을 때만 Pass Phrase 제공하게 된다.

Security check 하는 방식이나 Pass Phrase 결정하는 방식은 mod_ssl 결정하는 것이 아니며, mod_ssl 단지 interface(Pass Phrase stdout으로 제공하는 실행가능한 프로그램)만을 정의한다.

방식에서도 Reuse 알고리즘이 사용되며, 따라서 동일한 Pass Phrase 대해서는 external program 한번만 호출된다.

Example:

SSLPassPhraseDialog exec:/usr/local/apache/sbin/pp-filter

 

SSLMutex

Name

SSLMutex

Description

Semaphore for internal mutual exclusion of operations

Syntax

SSLMutex type

Default

SSLMutex none

Context

Server config

Override

Not applicable

Status

Extension

Module

Mod_ssl

Compatibility

Mod_ssl 2.1

directive fork되어진 Apache 서버 프로세스 간의 동기화되어 실행되어야 오퍼레이션들의 상호배제(mutual exclusion) 사용되는 SSL 엔진 세마포어(semaphore) 설정한다. 단지 하나의 global mutex만이 유효하기 때문에 directive global server context에서만 사용할 있다.

가능한 Mutext type 다음과 같다:

  • none

Mutext 사용하지 않으며, 기본 설정(default)이다. 그러나 현재 Mutex SSL Session Cache 대한 write access 동기화(Synchronizing)하는데 주로 사용되기 때문에 Session Cache 변경이 드물게 일어나는 경우에만 설정을 사용한다. 따라서 directive default 설정하는 것은 바람직하지 않으며, real Mutex 설정하는 것이 좋다.

  • file:/path/to/mutex

설정은 portable and always provided Mutex variant 지정하며, 물리적인 파일이 Mutext 사용된다. /path/to/mutex 로컬 디스크 파일시스템을 사용해야 하며, NFS AFS 파일시스템에 위치하는 파일을 사용해서는 않된다.

Notice: 내부적으로, Apache 부모 프로세스(parent process) Process ID(PID) PID 유일하게 만들기 위해 자동으로 /path/to/mutext 덧붙여(appended)짐으로써 PID 충돌을 막아준다.

  • sem

설정은 가장 훌륭한(elegant) 방법이지만 가장 non-portable Mutex variant이며, SysV IPC Semaphore (under Unix) Windows Mutex (under Win32) 사용된다. 경우 해당 platform(OS) 설정을 지원하여야만 한다.

Example:

SSLMutex file:/usr/local/apache/logs/ssl_mutex

SSLRandomSeed

Name

SSLRandomSeed

Description

Pseudo Random Number Generator (PRNG) seeding source

Syntax

SSLRandomSeed context source [bytes]

Default

None

Context

Server config

Override

Not applicable

Status

Extension

Module

Mod_ssl

Compatibility

Mod_ssl 2.2

directive 시동할 (context startup 경우) 혹은 새로운 SSL 연결(connection) 이루어질 (context connect 경우) SSLeay Pseudo Random Number Generator (PRNG) seeding 위한 하나 혹은 이상의 seed source 설정한다. PRNG global facility이므로 directive global server context에서만 사용될 있다.

가능한 source variant 다음과 같다:

  • builtin

언제든지 사용 가능한 builtin seeding source로서 경우 실행 (runtime) 최소한의 CPU cycle 소비하며, 아무런 결점(drawback)없이 사용될 있다. PRNG seeding 위해 사용될 있는 source로는 현재 시간, 현재의 process ID, Apache inter-process scoreboard struture로부터 임의로 선택된 1KB extract 등이 있다. 방법의 단점은 실질적으로 그다지 강력하지 못한 소스이며, 시동시(scoreboard 아직 사용가능하지 않은)에는 소스의 유동성(entropy) 바이트 밖에 되지 않는다는 것이다. 따라서 항상(최소한 startup 시에는) 부가적인 seeding source 지정하는 것이 좋다.

  • file:/path/to/source

PRNG seeding 위해 /path/to/source 지정한 외부 파일을 사용한다. Bytes 명시된 경우에는 지정된 byte 수만큼의 파일의 첫번째부터의 바이트가 entropy 생성하는데 사용되며, Bytes 명시되지 않은 경우에는 파일 전체가 entropy 형성한다. 설정은 특히 startup time seeding 사용되며, /dev/random 이나 /dev/urandom device 사용한다(FreeBSD 계열이나 Linux 같은 최근의 대부분의 Unix 시스템에 device들이 들어있다).

  • exec:/path/to/program

PRNG seeding 위한 소스로서 /path/to/program 지정된 실행가능한 외부 프로그램을 사용한다. Bytes 명시하는 경우에는 프로그램의 stdout contents에서 bytes 지정한 수만큼의 byte entropy 형성하는데 사용하며, bytes 명시되지 않은 경우에는 프로그램의 stdout으로 생성된 전체 데이터가 entropy 이루게 된다. 설정은 단지 startup time에만 사용하며, 매우 강력한 seeding 필요로 하는 경우에 사용된다. 설정을 connection context 사용하는 것은 서버의 속도를 매우 저하시키기 때문에 보통 connection context 외부 프로그램을 사용하는 것은 피해야 한다.

Example:

SSLRandomSeed startup builtin

SSLRandomSeed startup file:/dev/random

SSLRandomSeed startup file:/dev/urandom 1024

SSLRandomSeed startup exec:/usr/local/bin/truerand 16

SSLRandomSeed connect builtin

SSLRandomSeed connect file:/dev/random

SSLRandomSeed connect file:/dev/urandom 1024

 

SSLSessionCache

Name

SSLSessionCache

Description

Type of the global/inter-process SSL Session Cache

Syntax

SSLSessionCache type

Default

SSLSessionCache none

Context

server config

Override

Not applicable

Status

Extension

Module

mod_ssl

Compatibility

mod_ssl 2.1

directive global/inter-process SSL Session Cache storage type 지정하며, cache 병렬적인 요청 프로세스(parallel request processing) 속도를 개선해주는 역할을 한다. 동일한 서버 프로세스(HTTP keep-alive 통한) 대한 요청에 대해서 SSLeay SSL session information 로컬에 저장을 한다. 그러나 modern client 이미지나 다른 데이터들을 parallel request 통하여 요청하기 때문에(보통 4개까지의 parallel request), 이러한 요청들은 서로 다른 pre-forked process 의해 처리된다. Inter-process cache 필요없는 session handshake 피할 있게 해준다.

다음과 같은 2가지의 storage type 지원된다:

  • none

Global/inter-process Session Cache 사용하지 않으며, 기본 설정(default)이다. 기능 상의 문제는 없으나, 현저한 속도 저하가 생긴다.

  • dbm:/path/to/datafile

서버 프로세스들에 대한 local SSLeay memory cache 동기화(synchronizing)하기 위해 로컬 디스크에 있는 DBM hashfile 사용한다. 클라이언트의 요청에 대한 현저한 속도 향상이 생기며, 따라서 설정을 사용하는 것이 권장된다.

Example:

SSLSessionCache dbm:/usr/local/apache/logs/ssl_gcache_data

 

SSLSessionCacheTimeout

Name

SSLSessionCacheTimeout

Description

Number of seconds before an SSL session expires in the Session Cache

Syntax

SSLSessionCacheTimeout seconds

Default

SSLSessionCacheTimeout 300

Context

server config, virtual host

Override

Not applicable

Status

Extension

Module

mod_ssl

Compatibility

mod_ssl 2.0

directive global/inter-process SSL Session Cache SSLeay internal memory cache 저장된 정보들에 대한 timeout 초단위로 지정한다. 설정 값은 최저 15초이며 실제로 실행될 서버에서는 보통 300 이상을 지정한다.

Example:

SSLSessionCacheTimeout 600

 

SSLEngine

Name

SSLEngine

Description

SSL Engine Operation Switch

Syntax

SSLEngine on|off

Default

SSLEngine off

Context

Server config, virtual host

Override

Not applicable

Status

Extension

Module

Mod_ssl

Compatibility

Mod_ssl 2.1

directive SSL/TLS 프로토콜 엔진의 사용여부를 지정하며, 보통 <VirtualHost> 섹션 안에 사용되어 해당 virutal host SSL/TLS 사용할 것인가를 지정한다. 기본 설정은 주서버와 모든 virtual host 대하여 SSL/TLS 프로토콜을 사용하지 않는 것이다.

Example:

<VirtualHost _default_:443>

SSLEngine on

...

</VirtualHost>

 

SSLCipherSuite

Name

SSLCipherSuite

Description

Cipher Suite available for negotiation in SSL handshake

Syntax

SSLCipherSuite cipher-spec

Default

SSLCipherSuite

ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP

Context

server config, virtual host, directory, .htaccess

Override

AuthConfig

Status

Extension

Module

mod_ssl

Compatibility

mod_ssl 2.1

directive SSL handshake phrase 단계에서 클라이언트와 협상(negotiation) 있는 Cipher Suite 설정하며, 이를 위해 콜론(: )으로 구분되는 SSLeay cipher specification들로 이루어진 스트링을 directive 값으로 지정한다. directive per-server per-directory context 모두에서 사용될 있다. Per-server context 경우 directive connection 이루어질 표준 SSL handshake 적용되며, per-directory context 경우에는 HTTP request read 되었지만 HTTP response 보내지기 전에 재설정된 Cipher Suite 가지고 SSL renegotiation하게 된다.

Cipher-spec 지정되는 SSL cipher specification 4개의 주속성(major attribute) 가지의 부가적인 작은 속성(extra minor ones)들로 이루어진다:

  • Key Exchange Algorithm : RSA or Diffie-Hellman variants.

  • Authentication Algorithm : RSA, Diffie-Hellman, DSS or none.

  • Cipher/Encryption Algorithm : DES, Triple-DES, RC4, RC2, IDEA or none.

  • MAC Digest Algorithm : MD5, SHA or SHA1.

SSL cipher 또한 export cipher 되거나 혹은 SSLv2 SSLv3/TLSv1 cipher(여기서 TLSv1 SSLv3 동일하다) 중에 하나가 있다. 사용할 cipher 명시하는 방법으로는 모든 cipher 사용하거나, 한번에 한가지 cipher 사용하거나, 혹은 alias 지정하여 cipher 선호도와 사용 순서를 지정할 있다(Table 1 참조).

 

Tag

Description

Key Exchange Algorithm:

KRSA

RSA key exchange

KDHr

Diffie-Hellman key exchange with RSA key

KDHd

Diffie-Hellman key exchange with DSA key

KEDH

Ephemeral (temp.key) Diffie-Hellman key exchange (no cert)

Authentication Algorithm:

ANULL

No authentication

ARSA

RSA authentication

ADSS

DSS authentication

ADH

Diffie-Hellman authentication

Cipher Encoding Algorithm:

ENULL

No encoding

DES

DES encoding

3DES

Triple-DES encoding

RC4

RC4 encoding

RC2

RC2 encoding

IDEA

IDEA encoding

MAC Digest Algorithm:

MD5

MD5 hash function

SHA1

SHA1 hash function

SHA

SHA hash function

Aliases:

SSLv2

all SSL version 2.0 ciphers

SSLv3

all SSL version 3.0 ciphers

EXP

all export ciphers

LOW

all low strength ciphers (no export, single DES)

MEDIUM

all ciphers with 128 bit encryption

HIGH

all ciphers using Triple-DES

RSA

all ciphers using RSA key exchange

DH

all ciphers using Diffie-Hellman key exchange

EDH

all ciphers using Ephemeral Diffie-Hellman key exchange

ADH

all ciphers using Anonymous Diffie-Hellman key exchange

DSS

all ciphers using DSS authentication

NULL

all ciphers using no encryption

Table 1: SSLeay Cipher Specification Tags

사용하고자 하는 cipher 순서를 지정하기 위해서 여러 개의 tag들을 함께 지정할 있으며, 이를 위해 어떤 특정한 cipher들의 그룹을 의미하는 alias(SSLv2, SSLv3, EXP, LOW, MEDIUM, HIGH)들을 사용할 있다. tag들을 가지 접두사(prefix) 연결하여 cipher-spec 이룰 수도 있으며, 가능한 접두사(prefix) 다음과 같다:

  • none: 리스트에 cipher 포함시킨다

  • + : cipher 리스트에 포함시키며 또한 리스트의 현재 위치로 가져다 놓는다

  • - : 리스트로부터 cipher 제거한다(이후에 다시 포함시킬 있다)

  • ! : 리스트로부터 cipher 완전히 제거한다(이후에 다시 포함시킬 없다)

ssleay ciphers ?v 명령어로 모든 cipher-spec string 있다. 기본(default) cipher-spec string ALL:!ADH:RC4+RSA:+HIGN:+MEDIUM:+LOW:+SSLv2:+EXP이며 의미는 다음과 같다.

  1. Authenticate하지 않는 모든 cipher들을 고려(consideration)에서 제거한다. SSL 경우 단지 Anonymous Diffie-Hellman cipher만이 제거된다

  2. RC4 RSA 사용하는 cipher 포함시킨다.

  3. High security cipher, medium security cipher, 그리고 low security cipher 각각 포함시킨다.

  4. 마지막으로 모든 SSLv2 cipher export cipher들을 리스트의 마지막에 포함시키다.

$ ssleay ciphers -v 'ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP'

NULL-SHA SSLv3 Kx=RSA Au=RSA Enc=None Mac=SHA1

NULL-MD5 SSLv3 Kx=RSA Au=RSA Enc=None Mac=MD5

EDH-RSA-DES-CBC3-SHA SSLv3 Kx=DH Au=RSA Enc=3DES(168) Mac=SHA1

... ... ... ... ...

EXP-RC4-MD5 SSLv3 Kx=RSA(512) Au=RSA Enc=RC4(40) Mac=MD5 export

EXP-RC2-CBC-MD5 SSLv2 Kx=RSA(512) Au=RSA Enc=RC2(40) Mac=MD5 export

EXP-RC4-MD5 SSLv2 Kx=RSA(512) Au=RSA Enc=RC4(40) Mac=MD5 export

Table 2 SSL에서 사용되는 RSA DH cipher 대한 전체 리스트이다.

Example:

SSLCipherSuite RSA:!EXP:!NULL:+HIGH:+MEDIUM:-LOW

Cipher-Tag

Protocol

Key Ex.

Auth.

Enc.

MAC

Type

RSA Ciphers:

DES-CBC3-SHA

SSLv3

RSA

RSA

3DES(168)

SHA1

DES-CBC3-MD5

SSLv2

RSA

RSA

3DES(168)

MD5

IDEA-CBC-SHA

SSLv3

RSA

RSA

IDEA(128)

SHA1

RC4-SHA

SSLv3

RSA

RSA

RC4(128)

SHA1

RC4-MD5

SSLv3

RSA

RSA

RC4(128)

MD5

IDEA-CBC-MD5

SSLv2

RSA

RSA

IDEA(128)

MD5

RC2-CBC-MD5

SSLv2

RSA

RSA

RC2(128)

MD5

RC4-MD5

SSLv2

RSA

RSA

RC4(128)

MD5

DES-CBC-SHA

SSLv3

RSA

RSA

DES(56)

SHA1

RC4-64-MD5

SSLv2

RSA

RSA

RC4(64)

MD5

DES-CBC-MD5

SSLv2

RSA

RSA

DES(56)

MD5

EXP-DES-CBC-SHA

SSLv3

RSA(512)

RSA

DES(40)

SHA1

export

EXP-RC2-CBC-MD5

SSLv3

RSA(512)

RSA

RC2(40)

MD5

export

EXP-RC4-MD5

SSLv3

RSA(512)

RSA

RC4(40)

MD5

export

EXP-RC2-CBC-MD5

SSLv2

RSA(512)

RSA

RC2(40)

MD5

export

EXP-RC4-MD5

SSLv2

RSA(512)

RSA

RC4(40)

MD5

export

NULL-SHA

SSLv3

RSA

RSA

None

SHA1

NULL-MD5

SSLv3

RSA

RSA

None

MD5

Diffie-Hellman Ciphers:

ADH-DES-CBC3-SHA

SSLv3

DH

None

3DES(168)

SHA1

ADH-DES-CBC-SHA

SSLv3

DH

None

DES(56)

SHA1

ADH-RC4-MD5

SSLv3

DH

None

RC4(128)

MD5

EDH-RSA-DES-CBC3-SHA

SSLv3

DH

RSA

3DES(168)

SHA1

EDH-DSS-DES-CBC3-SHA

SSLv3

DH

DSS

3DES(168)

SHA1

EDH-RSA-DES-CBC-SHA

SSLv3

DH

RSA

DES(56)

SHA1

EDH-DSS-DES-CBC-SHA

SSLv3

DH

DSS

DES(56)

SHA1

EXP-EDH-RSA-DES-CBC-SHA

SSLv3

DH(512)

RSA

DES(40)

SHA1

Export

EXP-EDH-DSS-DES-CBC-SHA

SSLv3

DH(512)

DSS

DES(40)

SHA1

Export

EXP-ADH-DES-CBC-SHA

SSLv3

DH(512)

None

DES(40)

SHA1

Export

EXP-ADH-RC4-MD5

SSLv3

DH(512)

None

RC4(40)

MD5

export

Table 2: Particular SSL Ciphers

 

SSLCertificateFile

Name

SSLCertificateFile

Description

Server PEM-encoded X.509 Certificate file

Syntax

SSLCertificateFile filename

Default

None

Context

server config, virtual host

Override

Not applicable

Status

Extension

Module

mod_ssl

Compatibility

mod_ssl 2.0

서버에 대한 PEM-encoding되어진 증명서(Certificate) 파일을 지정하며, 부가적으로(optionally) 증명서에 대응하는 RSA 개인키를 지정한다(같은 파일에 개인키가 포함되어 있는 경우). 만약 증명서에 포함되어 있는 개인키가 암호화되어져 있는 경우 startup 시에 Pass Phrase 입력받는 dialog 실행된다.

Example:

SSLCertificateFile /usr/local/apache/conf/ssl.crt/server.crt

 

SSLCertificateKeyFile

Name

SSLCertificateKeyFile

Description

Server PEM-encoded RSA Private Key file

Syntax

SSLCertificateKeyFile filename

Default

None

Context

server config, virtual host

Override

Not applicable

Status

Extension

Module

mod_ssl

Compatibility

mod_ssl 2.0

서버에 대한 PEM-encoding되어진 개인키를 지정한다. 개인키가 SSLCertificateFile directive에서 지정한 증명서에 포함되어져 있지 않은 경우 따로 개인키를 저장하고 있는 파일을 지정하기 위해 부가적인 directive 사용하게 된다. 만약 SSLCertificateFile directive 사용되고 증명서 파일에 개인키도 포함되어 있는 경우에는 directive 사용할 필요가 없다. 그러나 증명서에 개인키를 포함하는 것은 실질적인 면에서 권장되지 않으며, 증명서와 개인키를 따로 분리해서 저장하는 것이 좋다. 만약 지정된 개인키가 암호화되어져 있다면 startup 시에 역시 Pass Phrase 물어보는 dialog 실행되게 된다.

Example:

SSLCertificateKeyFile /usr/local/apache/conf/ssl.key/server.key

 

SSLCACertificatePath

Name

SSLCACertificatePath

Description

Directory of PEM-encoded CA Certificates for Client Auth.

Syntax

SSLCACertificatePath directory

Default

None

Context

server config, virtual host

Override

Not applicable

Status

Extension

Module

mod_ssl

Compatibility

mod_ssl 2.0

Certificate Authority(CA) 증명서가 위치한 디렉토리를 지정하며, CA 증명서는 Client Authentication 클라이언트의 증명서를 확인(verify)하기 위해 사용된다.

디렉토리에 있는 파일들은 PEM-encoding되어져야 하며, hash filename 통하여 접근되어진다. 따라서 증명서 파일을 위치에 두어야 하는 것은 아니다. 경우 hash-value.N이라는 이름을 가지는 심볼릭 링크를 생성해야 하며, 항상 디렉토리가 적절한 심볼릭 링크를 가지고 있는가를 확인해야 한다. 이를 위해서는 mod_ssl 포함되어 있는 Makefile 사용한다.

Example:

SSLCACertificatePath /usr/local/apache/conf/ssl.crt/

 

SSLCACertificateFile

Name

SSLCACertificateFile

Description

File of concatenated PEM-encoded CA Certificates for Client Auth.

Syntax

SSLCACertificateFile filename

Default

None

Context

server config, virtual host

Override

Not applicable

Status

Extension

Module

mod_ssl

Compatibility

mod_ssl 2.0

directive 설정하고자 하는 모든 CA들의 증명서들을 모아둘 있는 all-in-one 파일을 지정하며, 증명서들은 Client Authentication 사용된다. 실제로 파일은 PEM-encoding되어 있는 여러 개의 증명서 파일들을 선호도(preference) 따라 연달아 덧붙여둔 것이다.

Example:

SSLCACertificateFile /usr/local/apache/conf/ssl.crt/ca-bundle-client.crt

 

SSLVerifyClient

Name

SSLVerifyClient

Description

Type of Client Certificate verification

Syntax

SSLVerifyClient level

Default

SSLVerifyClient none

Context

server config, virtual host, directory, .htaccess

Override

AuthConfig

Status

Extension

Module

mod_ssl

Compatibility

mod_ssl 2.0

Client Authentication 과정에서 수행할 증명서확인수준(Certificate Verification Level) 지정한다. directive per-server per-directory context 모두에서 사용되어질 있다. per-server context 사용되는 경우 connection 이루어질 표준 SSL handshake에서 사용되는 client authentication 적용되며, per-directory context에서 사용되는 경우 HTTP request read되어졌지만 HTTP response 보내지기 전에 재설정된(reconfigured) client verification level 가지고 재협상(renegotiation)하게 된다.

지정할 있는 level 다음과 같다:

  • none : no client Certificate is required at all

  • optional : the client may present a valid Certificate

  • require : the client has to present a valid Certificate

  • optional_no_ca : the client may present a valid Certificate but has not to be (successfully) verifyable.

4가지 level 모두가 모든 브라우져에서 동작하지는 않으며, optional_no_ca level 경우 실질적으로 인증의 개념과는 맞지 않기 때문에(SSL 테스트를 위한 목적으로나 사용될 있다) 실제로는 none require level만이 의미가 있다.

Example:

SSLVerifyClient require

 

SSLVerifyDepth

Name

SSLVerifyDepth

Description

Maximum depth of CA Certificates in Client Certificate verification

Syntax

SSLVerifyDepth number

Default

SSLVerifyDepth 1

Context

server config, virtual host, directory, .htaccess

Override

AuthConfig

Status

Extension

Module

mod_ssl

Compatibility

mod_ssl 2.0

directive 클라이언트가 유효한 증명서를 가지고 있지 않다고 결정하기 전에 얼마나 깊게 클라이언트를 verify 것인가를 지정한다. directive per-server per-directory context 모두에서 사용되어질 있다. per-server context 사용되는 경우 connection 이루어질 표준 SSL handshake에서 사용되는 client authentication 프로세스에 적용되며, per-directory context에서 사용되는 경우 HTTP request read되어졌지만 HTTP response 보내지기 전에 재설정된(reconfigured) client verification level 가지고 SSL 재협상(renegotiation) 하게 된다.

실질적으로 Depth 증명서에 서명한 바로 상위의 발행자(intermediate certificate issuer) 최대 개수, 클라이언트의 증명서에 서명한 CA 상위 CA들을 찾아갈 최대한 개의 CA 찾아갈 것인가를 의미한다. Depth 0으로 설정하는 것은 self-signed client certificate만을 허용한다는 의미이며, default depth 1 self-signed client certificate이거나 서버가 직접 알고 있는 CA(SSLCACertificatePaht 있는 CA certificate) 서명한 client certificate만을 허용한다는 의미이다.

Example:

SSLVerifyDepth 10

 

SSLLog

Name

SSLLog

Description

Where to write the dedicated SSL engine logfile

Syntax

SSLLog filename

Default

None

Context

Server config, virtual host

Override

Not applicable

Status

Extension

Module

mod_ssl

Compatibility

mod_ssl 2.1

SSL 프로토콜 엔진의 로그만을 기록할(dedicated) 로그 파일의 이름을 지정한다. 에러에 대한 메시지는 일반적인 Apache 에러로그 파일(ErrorLog directive 지정된 파일)에도 기록된다. 로그파일은 symlink attack 사용될 없는 (root만이 write 있는 ) 두어야 한다. 파일 이름이 슬래쉬(/) 시작하지 않으면 Server Root 대한 상대 경로로 인식되며, 파일 이름이 bar(|) 시작하는 경우에는 로그를 받아들이는 실행가능한 프로그램에 대한 경로로 인식된다. directive 하나의 virtual host config에서 한번만이 사용될 있다.

Example:

SSLLog /usr/local/apache/logs/ssl_engine_log

 

SSLLogLevel

Name

SSLLogLevel

Description

Logging level for the dedicated SSL engine logfile

Syntax

SSLLogLevel level

Default

SSLLogLevel none

Context

server config, virtual host

Override

Not applicable

Status

Extension

Module

mod_ssl

Compatibility

mod_ssl 2.1

directive SSL 프로토콜 엔진의 로그파일에 기록할 얼마나 자세하게 기록할 것인가를 지정한다. 지정할 있는 level 다음과 같다(아래로 갈수록 고수준의 level이며, 고수준의 level 저수준의 level 포함한다):

  • none

SSL 전용 로그파일에는 아무것도 남기지 않으며, 단지 에러에 관련된 메시지만이 Apache 에러 로그파일에 기록된다.

  • error

processing 멈추는 것과 같은 치명적인 상황에 대한 에러 메시지만을 기록하며, 메시지들은 Apache 에러 로그파일에도 기록된다.

  • warn

치명적이지 않은 문제에 대한 warning message까지 기록한다.

  • info

중요한 processing step 대한 informational message까지 기록한다.

  • trace

Minor processing step 대한 informational message까지 기록한다.

  • debug

Development low-level I/O information 위한 debugging message까지 기록한다.

Example:

SSLLogLevel warn

 

SSLOptions

Name

SSLOptions

Description

Configure various SSL engine run-time options

Syntax

SSLOptions [+-]option ...

Default

None

Context

server config, virtual host, directory, .htaccess

Override

Options

Status

Extension

Module

mod_ssl

Compatibility

mod_ssl 2.1

 

directive per-directory 수준에서의 다양한 run-time 옵션들을 조정한다. 여러 개의 SSLOption들이 하나의 directory 적용되는 경우 가장 specific 하나가 선택되어지며, 옵션들은 merge되지 않는다. 그러나 만약 SSLOptions directive 모든 옵션들이 plus(+) minus(-) 기호로 연결되어 있는 경우에는 모든 옵션들이 merge되어진다. +기호로 연결된 옵션들은 현재의 옵션에 포함되어지며, - 기호로 연결된 옵션들은 현재의 옵션으로부터 제외되어진다.

The available options are:

  • CompatEnvVars

다른 Apache SSL solution과의 backwardcompatibility 위한 부가적인 CGI/SSI 환경 변수들이 생성된다. 실제로 생성되어질 변수들에 대한 자세한 설명은 Compatibility 부분을 참조한다.

  • ExportCertData

두개의 부가적인 CGI/SSI 환경 변수, SSL_CLIENT_CERT SSL_SERVER_CERT 생성한다. 두개의 변수는 각각 현재의 HTTPS 연결(connection) 대한 클라이언트와 서버의 PEM-encoded X.509 Certificate 포함하게 되며, 고수준의 Certificate checking 위하여 CGI 스크립트에 의해 사용되어질 있다.

  • FakeBasicAuth

옵션이 사용되면 클라이언트 X.509 Certificate Subject DN(Distinguished Name) HPPT Basic Authentication username으로 변환되어지며, 이것은 표준 Apache 인증(authentication) 접근 제어(access control) 사용될 있음을 의미한다. user name Client X.509 Certificate Subject(이것은 SSLeay ssleay x509 ?noout ?subject ?in certificate.crt 명령을 실행할 얻어진다) 되며, 패스워드는 사용자로부터 얻어지는 것이 아니며 모든 user name 대한 패스워드는 password 단어를 암호화한 결과인 xxj31ZMTZzkVA 된다.

Example:

SSLOptions +FakeBasicAuth -CompatEnvVars

 

SSLRequireSSL

Name

SSLRequireSSL

Description

Deny access when SSL is not used for the HTTP request

Syntax

SSLRequireSSL

Default

None

Context

directory, .htaccess

Override

AuthConfig

Status

Extension

Module

mod_ssl

Compatibility

mod_ssl 2.0

directive 명시되면 현재의 연결이 SSL 위에서 이루어진 HTTP(, HTTPS) 아닌 경우 접근을 허용하지 않는다. directive SSL 적용할 virtual host 보호되어야 필요가 있는 디렉토리에 대한 설정 등에 매우 유용하며, directive 있으면 SSL 사용하지 않은 모든 요청(request)들은 거부되어진다.

Example:

SSLRequireSSL

 

SSLRequire

Name

SSLRequire

Description

Allow access only when an arbitrarily complex boolean expression is true

Syntax

SSLRequire expression

Default

None

Context

directory, .htaccess

Override

AuthConfig

Status

Extension

Module

mod_ssl

Compatibility

mod_ssl 2.1

directive 접근이 허용되기 위해 충족되어야 요구사항(access requirement) 지정하며, 요구 사항은 임의의 boolean expression들의 조합이 있다.

Boolean expression 다음의 문법(BNF grammar notation 따른 문법) 따라야 한다:

expr ::= "true" | "false"

| "!" expr

| expr "&&" expr

| expr "||" expr

| "(" expr ")"

| comp

comp ::= word "==" word | word "eq" word

| word "!=" word | word "ne" word

| word "<" word | word "lt" word

| word "<=" word | word "le" word

| word ">" word | word "gt" word

| word ">=" word | word "ge" word

| word "in" "{" wordlist "}"

| word "=~" regex

| word "!~" regex

wordlist ::= word

| wordlist "," word

word ::= digit

| cstring

| variable

| function

digit ::= [0-9]+

cstring ::= "..."

variable ::= "%{" varname "}"

function ::= funcname "(" funcargs ")"

여기서 varname Table 3 있는 어떠한 변수도 사용될 있으며, funcname에는 다음의 함수들이 가능하다:

  • file(filename)

함수는 filename 가리키는 하나의 문자열 인수를 받아서 파일의 content 확장된다. 함수는 파일의 content regular expression 대치시키는데 사용된다.

Expression 먼저 내부적으로 machine representation으로 parsing되며, 두번째 단계로서 evaluate되어진다. Global Per-Server context에서는 expression startup time parsing runtime에서만 machine representation 실행되어진다. Per-Directory context 경우에는 이와 다른데, 경우에는 expression 모든 request마다 parsing되고 곧바로 실행되어진다.

Example:

SSLRequire ( %{SSL_CIPHER} !~ m/^(EXP|NULL)-/ \

and %{SSL_CLIENT_S_DN_O} eq "Snake Oil, Ltd." \

and %{SSL_CLIENT_S_DN_OU} in {"Staff", "CA", "Dev"} \

and %{TIME_WDAY} >= 1 and %{TIME_WDAY} <= 5 \

and %{TIME_HOUR} >= 8 and %{TIME_HOUR} <= 20 ) \

or %{REMOTE_ADDR} =~ m/^192\.76\.162\.[0-9]+$/

Table 3: Available Variables for SSLRequire

 

Additional Features

Environment Variables

Mod_ssl 다양한 SSL 정보를 부가적인 환경 변수들을 통해 제공하며, mod_ssl 생성하는 변수들은 Table 4 정리되어 있다. Backward compatibility 위해서 정보들은 다른 이름으로 제공될 수도 있으며, compatibility 변수들에 대한 자세한 내용은 Compatibility 부분을 참조한다.

Variable Name:

Value Type

Description:

HTTPS

flag

HTTPS is being used.

SSL_PROTOCOL

string

The SSL protocol version (SSLv2, SSLv3, TLSv1)

SSL_CIPHER

string

The cipher specification name

SSL_CIPHER_USEKEYSIZE

number

Number of cipher bits (actually used)

SSL_CIPHER_ALGKEYSIZE

number

Number of cipher bits (possible)

SSL_VERSION_INTERFACE

string

The mod_ssl program version

SSL_VERSION_LIBRARY

string

string The SSLeay program version

SSL_CLIENT_M_VERSION

string

string The version of the client certificate

SSL_CLIENT_M_SERIAL

string

The serial of the client certificate

SSL_CLIENT_S_DN

string

Subject DN in client's certificate

SSL_CLIENT_S_DN_x509

string

Component of client's Subject DN

SSL_CLIENT_I_DN

string

Issuer DN of client's certificate

SSL_CLIENT_I_DN_x509

string

Component of client's Issuer DN

SSL_CLIENT_V_START

string

Validity of client's certificate (start time)

SSL_CLIENT_V_END

string

Validity of client's certificate (end time)

SSL_CLIENT_A_SIG

string

Algorithm used for the signature of client's certificate

SSL_CLIENT_A_KEY

string

Algorithm used for the public key of client's certificate

SSL_SERVER_M_VERSION

string

The version of the server certificate

SSL_SERVER_M_SERIAL

string

The serial of the server certificate

SSL_SERVER_S_DN

string

Subject DN in server's certificate

SSL_SERVER_S_DN_x509

string

Component of server's Subject DN

SSL_SERVER_I_DN

string

Issuer DN of server's certificate

SSL_SERVER_I_DN_x509

string

Component of server's Issuer DN

SSL_SERVER_V_START

string

Validity of server's certificate (start time)

SSL_SERVER_V_END

string

Validity of server's certificate (end time)

SSL_SERVER_A_SIG

string

Algorithm used for the signature of server's certificate

SSL_SERVER_A_KEY

string

Algorithm used for the public key of server's certificate

[ where x509 is a component of a X.509 DN: C, SP, L, O, OU, CN, Email ]

Table 4: SSI/CGI Environment Variables

 

Custom Log Formats

Mod_ssl Apache 적용되어지면 Custom Log Format 위한 부가적인 함수들이 존재하게 된다. 예를 들면 %{varname}x eXtension format function 어떤 모듈이 제공하는 변수(특히 Table 4 나열된 mod_ssl 제공하는 변수) 확장(extend)하는데 사용된다. 또한 Backward compatibility 위해 %{name}c cryptography format function 제공되며, 함수에 대한 정보는 Compatibility 부분을 참조한다.

Example:

CustomLog logs/ssl_request_log \

"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

Posted by Golmong
:


Chapter.2 Introduction

Cryptographic Techniques

SSL 이해하기 위해서는 암호화 알고리즘, 메시지 다이제스트(one-way or hash function), 전자서명에 대한 이해가 필요하다. technique들은 privacy, integrity, authentication 있어서의 basis 제공한다.

Cryptographic Algroithm

Alice 돈을 옮기기 위하여 자신의 은행에 메시지를 보낸다고 가정하자. 메시지에는 Alice 계좌번호, 송금액 등과 같은 정보가 포함되기 때문에 Alice 메시지가 private하기를 원한다. 이에 대한 해결책은 암호화 알고리즘을 사용하는 것이며, 암호화를 사용함으로써 Alice 메시지를 암호화된 형태로 전송하여 다른 사람들로 하여금 읽을 없도록 만든다.

메시지는 secret key 사용하여야만 해석되어질 있으며, key 없으면 메시지는 무용지물이 된다. 좋은 암호화 알고리즘은 공격자(intruder) 원래의 메시지로 decoding하는 것을 어렵게 만듦으로써 공격자의 수고를 가치 없게 만든다.

암호화 알고리즘에는 두가지 범주가 있다. : Conventional, Public key.

Conventional Cryptography

  • symmetric cryptography라고도 하며, 메시지의 송신자, 수신자가 동일한 key 공유하게 되며, key 메시지를 암호화하고 복호화하는데 사용되는 secret piece of information이다. key 안전하게 보관됨으로써 전송자와 수신자 이외에는 메시지를 읽지 못하게 된다. 만약 Alice 은행이 secret key 알고 있다면 그들은 서로에게 private message 전송할 있다. 그러나 통신 이전에 key private하게 공유하는 것이 문제가 있다.

Public Key Cryptography

  • asymmetric cryptography라고도 하며, 두개의 key 사용하는 알고리즘을 정의함으로써 key exchange 문제를 해결하며, 두개의 key 어느 것도 메시지를 암호화하는데 사용될 있다. 만약 하나의 키가 메시지를 암호화하는데 사용되었다면 다른 하나의 key 그것을 복호화하는데 사용되어져야 한다. 공개키 암호화는 단순히 하나의 (공개키) 공개하고 다른 하나의 (개인키) 보관함으로써 메시지를 안전하게 전달할 있게 해준다.

  • 누구나 공개키를 사용하여 메시지를 암호화할 있지만 해당되는 개인키를 가진 사람만이 메시지를 읽을 있다. 이러한 방식으로 Alice 은행의 공개키로 메시지를 암호화함으로써 키쌍의 주인인 은행으로 private message 보낼 있게 되며, 단지 은행만이 메시지를 복호화할 있다.

메시지 다이제스트

비록 Alice 자신의 메시지를 암호화함으로써 안전하게 만들 수는 있지만, 누군가가 돈을 가로채기 위하여 Alice original message 변조하거나 다른 message 바꿔치기 있다는 문제가 여전히 존재한다. Alice 메시지에 대한 무결성(integrity) 보장하는 하나의 방법은 Alice 메시지에 대한 간결한 요약(summary) 생성해서 메시지와 함께 은행으로 보내는 것이다. 메시지를 받게 되면 은행은 메시지의 summary 다시 생성해서 Alice 보낸 것과 비교하게 되며, 두개가 일치하면 메시지는 손상되지 않은 것이다.

이러한 summary 메시지 다이제스트, one-way function, 혹은 hash function이라고 부른다. Message digests are used to create short, fixed-length representations of longer, variable-length messages. 다이제스트 알고리즘은 서로 다른 메시지에 대하여 각각 유일한 다이제스트를 생성하도록 디자인되어진다. 또한 다이제스트로부터 원래의 메시지를 얻어내는 것이 매우 어렵게 되어 있으며, 동일한 다이제스트를 가지는 서로 다른 두개의 메시지를 찾는 것이 불가능하다. 따라서 어떤 메시지를 동일한 다이제스트를 가지는 다른 메시지로 바꿔치기할 가능성을 막아주게 된다.

Alice 직면하게 되는 다른 문제는 다이제스트를 은행으로 안전하게 보내는 방법이며, 문제가 해결되면 해당 메시지에 대한 무결성이 보장된다. 이를 위한 한가지 방법은 다이제스트를 전자 서명에 포함하는 것이다.

전자 서명(Digital Signatures)

Alice 은행으로 메시지를 전송하였을 은행은 공격자(intruder) Alice 계좌로부터 돈을 인출하는 것을 막기 위해 메시지가 정말로 Alice 보낸 것인가를 확인할 필요가 있다. 역할을 하는 것이 Alice 생성하여 메시지에 포함한 전자 서명이다.

전자 서명(Digital signatures) 메시지의 다이제스트와 다른 정보들(sequence number 같은) 전송자(sender) 개인키로 암호화함으로써 생성된다. 비록 누구나 전송자의 공개키를 가지고 서명을 복호화할 수는 있지만 단지 서명자만이 개인키를 알고 있을 뿐이며, 이것은 서명자만이 서명을 생성할 있음을 의미한다. 서명에 다이제스트를 포함한다는 것은 서명이 단지 메시지에 대해서만 유효함을 의미한다. 이것은 또한 누구도 다이제스트를 변경하지 못하며 서명을 없기 때문에 메시지의 무결성을 보장해준다.

Intruder 의한 가로채기(interception) 서명의 재사용을 막기 위하여 서명은 유일한 sequence number 포함하고 있으며, 이것은 은행으로 하여금 Alice 자신이 메시지를 보내지 않았다고 하는 부정하게(fraudulent) 클레임을 거는 것을 막아주게 된다. 이유는 단지 Alice만이 메시지에 서명할 있기 때문이다. 이를 부인봉쇄(non-repudiation)이라고 한다.

인증서(Certificates)

비록 Alice private message 은행으로 보내고, 메시지에 서명하고 또한 메시지의 무결성을 보장받을 있지만 여전히 Alice 자신이 정말로 은행과 통신(communicate)하고 있는가를 확인할 필요가 있다. 이것은 자신이 사용하는 공개키가 은행의 개인키와 대응되는가를 확인할 필요가 있음을 의미한다. 또한 은행 역시 메시지의 서명이 정말로 Alice 서명에 대응되는가를 확인할 필요가 있다.

만약 party 서로의 identity validate해주고 공개키를 confirm해주며, 또한 믿을 있는 agency 의해 서명된 증명서(certificate) 가진다면 그들은 자신이 생각하고 있는 올바른 상대방과 통신하고 있음을 확신할 있을 것이다. 이러한 믿을 있는 agency Certificate Authority라고 부르며, 증명서(certificate) 인증(authentication) 사용된다.

Certificate Contents

증명서는 하나의 공개키와 실재의 subject 보여지는 identity(individual, server 등등) 연관시킨다. subject 대한 정보는 identifying information(the distinguished name) 공개키를 포함한다. 또한 증명서는 증명서를 발급한 CA 대한 identification 서명, 그리고 증명서의 유효기간을 포함한다. 증명서에는 serial number 같이 CA 관리적 목적으로 사용하기 위한 administrative information 같은 부가적인 정보를 가질 수도 있다.

Subject:

Distinguished Name, Public Key

Issuer:

Distinguished Name, Signature

Period of Validity:

Not Before Date, Not After Date

Administrative Information:

Version, Serial Number

Extended Information:

Basic Contraints, Netscape Flags, etc.

Table 1: Certificate Information

Distinguished name 특정한 context 내에서 identity 제공하기 위해 사용된다. 예를 들어, 개인(individual) 개인 증명서(personal certificate) 뿐만 아니라 하나의 employee로서의 증명서을 가진다. Distinguished name X.509 표준[X509] 정의되어 있으며, 여기에는 field, field name, abbreviation(약어) 정의되어 있다.

A distinguished name is used to provide an identity in a specific context ? for instance, an individual might have a personal certificate as well as one for their identity as an employee. Distinguished names are defined by the X.509 standard [X509], which defines the fields, field names, and abbreviations used to refer to the fields (see Table 2).

DN Field:

Abbrev.:

Description:

Example:

Common Name

CN

Name being certified

CN=Joe Average

Organization or

Company

O

Name is associated with this organization

O=Snake Oil, Ltd.

Organizational Unit

OU

Name is associated with this organization unit, such as a department

OU=Research Institute

City/Locality

L

Name is located in this City

L=Snake City

State/Province

ST

Name is located in this State/Province

ST=Desert

Country

C

Name is located in this Country (ISO code)

C=XZ

Table 2: Distinguished Name Information

CA 어떤 DN name 필수적(required)이냐, 부가적(optional)이냐를 명시하는 정책(policy) 정의할 있으며, 또한 필드의 내용(field content) 대한 요구사항(requirement) 포함할 있다. 예를 들면, Netscape 브라우져는 어떤 서버에 대한 증명서의 Common Name 서버의 도메인 네임에 대한 wildcard pattern ( *.snakeoil.com 같은…) 부합(match)되는 이름을 가질 것을 요구한다.

증명서의 binary format ASN.1 notation [ X208] [PKCS] 사용하여 정의한다. notation content information binary form으로 변환하는 방법을 정의하는 encoding rule들을 어떻게 specify하는가를 정의한다. 증명서의 binary encoding Distinguished Encoding Rules(DER) 사용하여 정의하며, DER 일반적인 Basic Encoding Rules(BER) 기반을 두고 있다. Binary 다루지 못하는(cannot handle) transmission 위하여 binary form Base64 encoding [MIME] 사용하여 ASCII form으로 변환될 수도 있다. 이렇게 encoding 버전을 PEM(“Privacy Enhanced Mail”에서 얻어진 이름) encoded라고 부르며, [Table3]에서와 같이 begin delimiter line end delimiter line 사이에 놓여진다.

-----BEGIN CERTIFICATE-----

MIIC7jCCAlegAwIBAgIBATANBgkqhkiG9w0BAQQFADCBqTELMAkGA1UEBhMCWFkx

FTATBgNVBAgTDFNuYWtlIERlc2VydDETMBEGA1UEBxMKU25ha2UgVG93bjEXMBUG

A1UEChMOU25ha2UgT2lsLCBMdGQxHjAcBgNVBAsTFUNlcnRpZmljYXRlIEF1dGhv

cml0eTEVMBMGA1UEAxMMU25ha2UgT2lsIENBMR4wHAYJKoZIhvcNAQkBFg9jYUBz

bmFrZW9pbC5kb20wHhcNOTgxMDIxMDg1ODM2WhcNOTkxMDIxMDg1ODM2WjCBpzEL

MAkGA1UEBhMCWFkxFTATBgNVBAgTDFNuYWtlIERlc2VydDETMBEGA1UEBxMKU25h

a2UgVG93bjEXMBUGA1UEChMOU25ha2UgT2lsLCBMdGQxFzAVBgNVBAsTDldlYnNl

cnZlciBUZWFtMRkwFwYDVQQDExB3d3cuc25ha2VvaWwuZG9tMR8wHQYJKoZIhvcN

AQkBFhB3d3dAc25ha2VvaWwuZG9tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKB

gQDH9Ge/s2zcH+da+rPTx/DPRp3xGjHZ4GG6pCmvADIEtBtKBFAcZ64n+Dy7Np8b

vKR+yy5DGQiijsH1D/j8HlGE+q4TZ8OFk7BNBFazHxFbYI4OKMiCxdKzdif1yfaa

lWoANFlAzlSdbxeGVHoT0K+gT5w3UxwZKv2DLbCTzLZyPwIDAQABoyYwJDAPBgNV

HRMECDAGAQH/AgEAMBEGCWCGSAGG+EIBAQQEAwIAQDANBgkqhkiG9w0BAQQFAAOB

gQAZUIHAL4D09oE6Lv2k56Gp38OBDuILvwLg1v1KL8mQR+KFjghCrtpqaztZqcDt

2q2QoyulCgSzHbEGmi0EsdkPfg6mp0penssIFePYNI+/8u9HT4LuKMJX15hxBam7

dUHzICxBVC1lnHyYGjDuAMhe396lYAn8bCld1/L4NMGBCQ==

-----END CERTIFICATE-----

Table 3: Example of a PEM-encoded certificate (snakeoil.crt)

인증기관(Certificate Authorities)

CA 증명서를 발급하기 전에 먼저 증명서에 있는 정보를 확인(verify)함으로써 키쌍의 개인키의 identity 확인(assure)한다. 예를 들어 만약 Alice 개인 증명서(personal certificate) 요청하는 경우 CA 반드시 먼저 Alice 정말로 증명서를 요청한 사람인가를 확인하여야 한다.

Certificate Chains

CA 다른 CA 대한 증명서을 발급(issue) 있다. 증명서를 examining Alice Alice 신뢰할 있는 CA 도달할 때까지 parent CA 대한 issuer 증명서를 examine해야 필요가 있을 있다. Alice chain안의 “bad” certificate 대한 위험을 줄이기 위하여 제한된 chain(limited chain of issuers) 가진 증명서만을 신뢰할 것을 결정할 수도 있다.

Creating a Root-Level CA

위에서 언급된 바와 같이, certificate들은 top-level CA 도달할 때까지 certificate subject identity 대한 유효성(validity) certificate issuer 보증해야 한다. 이것은 하나의 문제를 발생시키는데, 그것은 issuer 가지지 않는 top-level authority certificate 누가 보증하는가의 문제이다. 이런 특정한 경우, top-level authority certificate “self-signed”되어지며, 증명서의 issuer subject 동일하게 된다. 결과로서 self-signed certificate 신뢰에 대한 문제가 생긴다. Root authority 의한 공개키의 wide publication 공개키의 신뢰에 대한 위험을 줄여줄 있는데, 누군가가 자신이 authority 되겠다고 하면서 키를 공표함으로써 문제를 해결할 있다. 보통 브라우져들은 well-known CA들을 신뢰할 있도록 미리 설정되어있다(preconfigured).

Thawte이나 VeriSign 같은 몇몇 회사들이 자신을 Certificate Authority로서 입지를 굳혀왔으며, 이들은 다음과 같은 서비스를 제공한다:

  • 증명서 요청에 대한 확인(Verifying certificate requests)

  • 증명서 요청의 처리(Processing certificate requests)

  • 증명서의 발급과 관리(Issuing and managing certificates)

자기 자신만의 CA(one’s own CA) 생성하는 것도 가능한데, 비록 인터넷 환경에서는 위험하긴 하지만 어떤 조직 내에서 개인이나 서버들을 확인(verify)하기 위한 목적의 인트라넷 환경에서는 매우 유용할 있다.

Certificate Management

CA 설립(establishing)하는 것은 믿을 있는 관리적(administrative), 기술적(technical), 관리(management) framework 요구하는 일이다. CA 증명서를 발급할 뿐만 아니라 증명서를 관리해야 한다. , 증명서가 어느 기간 동안 유효한가를 결정하고, 증명서를 갱신하며, 발급은 되었지만 이상 유효하지 않은 증명서들의 리스트(Certificate Revocation Lists - CRL) 관리해야 한다. 만약 Alice에게 어떤 회사의 직원으로서의 증명서를 발급하였다면 Alice 회사를 떠날 증명서는 취소되어야 필요가 있다. 그러나 증명서는 돌아다니는 것이기 때문에 증명서 자체만으로는 그것이 취소되었다는 것을 알려줄 없다. 따라서 증명서의 유효성(validity) 확인하고자 CRL 체크하기 위해서 증명서를 발급한 CA 문의(contact) 필요가 있다(보통 이것은 자동으로 되는 프로세스가 아니다-- this is not usually an automated part of the process).

Note:

브라우져에 디폴트로 설정되어져 있지 않은 CA 사용하는 경우, 브라우져로 하여금 CA 서명한 server certificate 확인(validate) 있도록 하기 위해 CA certificate 브라우져에 load해야 하는데, 이것은 브라우져가 일단 한번 CA certificate load하면 CA 서명한 모든 certificate 받아들이게 되기 때문에 위험할 있다.

 

Secure Sockets Layer (SSL)

Secure Sockets Layer protocol Reliable connection-oriented network layer protocol (e.g. TCP/IP) Application protocol layer (e.g. HTTP) 사이에 위치하는 Protocol Layer이다. SSL 상호 인증, 무결성을 위한 전자 서명의 사용, privacy 위한 암호화 등을 이용하여 클라이언트와 서버간의 안전한 통신을 제공한다.

프로토콜은 암호화, 다이제스트, 서명을 위한 특정 알고리즘의 선택을 지원하도록 디자인되어졌다. 이것은 특정 서버의 알고리즘 선택이 법적인 문제나 수출법과 같은 문제에 기반하여 이루어질 있도록 해주며, 또한 프로토콜로 하여금 새로운 알고리즘의 채택을 가능하게 해준다. 알고리즘의 선택은 프로토콜 세션이 시작될 클라이언트와 서버 간에 협상(negotiation)된다.

Version:

Source:

Description:

Browser Support:

SSL v2.0

Vendor Standard

(from Netscape Corp.)

[SSL2]

First SSL protocol for which implementations exists

- NS Navigator 1.x/2.x

- MS IE 3.x

- Lynx/2.8+SSLeay

SSL v3.0

Expired Internet Draft

(from Netscape Corp.)

[SSL3]

Revisions to prvent specific security attacks, add non-RSA ciphers, and support for certificate chains

- NS Navigator 2.x/3.x/4.x

- MS IE 3.x/4.x

- Lynx/2.8+SSLeay

TLS v1.0

Proposed Internet Standard

(from IETF)

[TLS1]

Revision of SSL 3.0 to update the MAC layer to HMAC, add block padding for block ciphers, message order standardization and more alert messages.

- Lynx/2.8+SSLeay

Table 4: Versions of the SSL protocol

[Table 4] 보여지는 바와 같이 몇가지 버전의 SSL 프로토콜이 있다. 위에 기술된 바처럼, SSL 3.0 장점 하나는 certificate chain loading 지원한다는 것이며, 이것은 서버가 브라우져에게 issuer certificate 함께 서버의 certificate 넘겨주는 것을 가능하게 해준다. 또한 Chain loading 기능은 해당 서버 certificate 서명한 issuer CA certificate 브라우져에 설치되어 있지 않은 경우에도 server certificate certificate chain 포함되어 있기 때문에 브라우져가 server certificate 확인(validate) 있도록 해준다. Transport Layer Security [TLS] protocol standard SSL 3.0 기반으로 하였으며, 현재 Internet Engineering Task Force (IETF) 의해 개발되고 있다.

Session Establishment

SSL 세션은 [Figure 1]에서와 같이 클라이언트와 서버 간의 handshake sequence 따라 이루어진다. sequence 서버가 server certificate 제공하느냐, 혹은 client certificate 요구하는가에 따라 달라질 있다. Cipher information 관리를 위해 부가적인 handshake step 요구되는 경우도 존재하지만 여기서는 하나의 일반적인 시나리오를 정리한다: 가능한 모든 경우에 대한 설명은 SSL specification 참조하라

Note

일단 SSL 세션이 이루어지면 이것은 재사용되어질 있으며, 이로 인하여 세션을 시작하기 위해 필요한 많은 단계들을 반복함으로써 발생하는 performance penalty 피할 있다. Reusing 기능을 위하여 서버는 SSL 세션마다 유일한 session identifier 할당하며, identifier 서버에 저장되어서 이후에 클라이언트가 다시 연결할 이를 사용함으로써 handshake 줄일 있다(session identifier 서버의 캐쉬에서 지워지기 이전까지 사용할 있다).
 

Figure 1: Simplified SSL Handshake Sequence
 

Handshake sequence 요소는 다음과 같다.

  1. 데이터 전송 시에 사용할 Cipher Suite 협상(negotiation)한다.( Negotiate the Cipher Suite to be used during data transfer)

  2. 클라이언트와 서버 간의 세션키를 공유한다.( Establish and share a session key between client and server)

  3. 부가적으로(Optionally) 클라이언트에게 서버를 인증한다.(authenticate the server to the client)

  4. 부가적으로(Optionally) 서버에게 클라이언트를 인증한다.(authenticate the client to the server)

첫번째 단계인 Cipher Suite Negotiation에서 클라이언트와 서버는 양측 모두가 지원할 있는 Cipher Suite 선택한다. SSL 3.0 프로토콜 규격은 31개의 Cipher Suite 정의되어 있다. 하나의 Cipher Suite 다음의 요소들로 정의된다:

  • Key Exchange Method

  • Cipher for Data Transfer

  • Message Digest for creating the Message Authentication Code (MAC)

Key Exchange Method

Key exchange method 어플리케이션 데이터의 전송에 사용할 공유 비밀키를 어떻게 클라이언트와 서버간에 동의(agree) 것인가를 정의한다. SSL 2.0 RSA 교환만을 지원하지만 SSL 3.0 가지 교환 알고리즘(RSA key exchange, Diffie-Hellman key exchange) 중에 선택할 있도록 지원한다. RSA 교환은 certificate 사용되는 경우에 선택되며, Diffie-Hellman 교환은 certificate 없고 클라이언트와 서버 간의 통신이 이전에 한번도 없는 경우에 선택된다.

Key exchange method 선택에 있어서 하나의 변수는 전자 서명을 사용할 것인가 사용하지 않을 것인가, 그리고 사용한다면 어떤 종류의 서명을 사용할 것인가이다. 개인키를 이용한 서명을 사용함으로써 공유키를 생성하는데 사용되는 정보를 교환할 man-in-the-middle-attack 막을 있다 [AC96, p516].

Cipher for Data Transfer

SSL 세션 내의 메시지를 암호화하기 위해서 위에서 기술된 conventional cryptography algorithm(대칭형 암호화) 사용한다. 암호화를 하지 않는 경우를 포함해서 9가지의 선택이 가능하다:

No encryption

Stream Ciphers

  • RC4 with 40-bit keys

  • RC4 with 128-bit keys

CBC Block Ciphers

  • RC2 with 40 bit key

  • DES with 40 bit key

  • DES with 54 bit key

  • Triple-DES with 168 bit key

  • Idea (128 bit key)

  • Fortezza (96 bit key)

“CBC” Cipher Block Chaining 의미하며, 모드에서는 바로 이전에 암호화된 암호문의 일부가 현재 block 암호화에 사용되어진다. “DES” Data Encryption Standard 의미하며, 여러가지의 variant(DES40, 3DES_EDE) 있다. "Idea" 암호학적으로 가장 강력한 알고리즘이며, "RC2" RSA DSI에서 개발한 독점적인 알고리즘이다.

Digest Function

Digest Function 선택은 record unit으로부터 어떻게 다이제스트가 생성되어지는가를 결정하며, SSL 다음을 지원한다:

  • No digest (Null choice)

  • MD5, a 128-bit hash

  • Secure Hash Algorithm (SHA-1), a 160-bit hash

메시지 다이제스트는 Message Authentication Code (MAC) 생성하는데 사용된다. MAC 메시지와 함께 암호화됨으로써 메시지의 무결성을 제공하며 또한 replay attack 막아준다.

Handshake Sequence Protocol

Handshake sequence 가지의 프로토콜을 사용한다:

  • 클라이언트와 서버 간 SSL 세션 수립을 위한  SSL Handshake 프로토콜.

  • 세션에 사용될 암호 수트(Cipher Suite)를 결정하기 위한 SSL Change Cipher Spec 프로토콜.

  • 클라이언트와 서버 간 에러 메시지를 전달하기 위한 SSL Alert 프로토콜.

Figure 2: SSL Protocol Stack

어플리케이션 프로토콜 데이터 및 이 프로토콜 자체는 Figure 2와 같이, SSL Record 프로토콜에 의해 싸여지며(encapsulated), 아래 계층의 프로토콜은 위의 싸여진 데이터가 무엇인지 상관하지 않고 일반적인 데이터로서 취급하여 전달하게 된다. 프로토콜 계층에서 상위의 싸여진 프로토콜 역시 아래 계층의 프로토콜이 무엇인지 상관하지 않는다.

Record 프로토콜에 의한 SSL 제어 프로토콜의 캡슐화는 만약 활성화된 세션이 재협상(renegotiated)되는 경우 제어 프로토콜이 안전하게 전달될 것임을 의미한다. 만약 이전에 세션이 존재하지 않았다면 널(NULL) 암호 수트가 사용되며, 이는 세션이 수립되기 전까지는 Integrity digest를 가지지 않는 암호화 및 메시지가 존재하지 않는다는 것을 의미한다.
 

Data Transfer


Figure 3: SSL Record Protocol


SSL Record 프로토콜 어플리케이션 데이터와 SSL 관리 데이터 작은 unit 쪼개거나, 복수의 상위 계층 프로토콜 데이터 메시지들을 하나의 unit 결합하여 클라이언트와 서버 간에 전송한다. 이 단계에서 데이터를 압축하고, 전자 서명을 붙이고, Unit들을 암호화한 후 하위의 프로토콜에 실어서 전송하게 된다. (Note: 현재 모든 주요 SSL 구현은 압축을 지원하지 않고 있다). 
 

Securing HTTP Communication

SSL 보통 브라우져와 서버 간의 HTTP 통신을 안전하게 만드는데 사용되며, 경우 non-secure HTTP 사용하지 않는 것이 아니라, SSL 위에서 일반적인 plain HTTP 구현한다(HTTPS라고 한다). 한가지 중요한 차이는 HTTPS 이용할 http 다른 서버 포트(디폴트 443) 사용하는 것이 아니라 https라는 URL scheme 사용한다는 것이며, 이것이 mod_ssl Apche 웹서버에 제공하는 주요한 기능이다.

References

[AC96] Bruce Schneier, Applied Cryptography, 2nd Edition, Wiley, 1996. See

http://www.counterpane.com/ for various other materials by Bruce Schneier.

[X208] ITU-T Recommendation X.208, Specification of Abstract Syntax Notation One (ASN.1), 1988.

See for instance ftp://ftp.neda.com/pub/itu/x.series/x208.ps.

[X509] ITU-T Recommendation X.509, The Directory ? Authentication Framework, 1988.

See for instance ftp://ftp.bull.com/pub/OSIdirectory/ITUnov96/X.509/97x509final.doc.

[PKCS] Kaliski, Burton S., Jr., An Overview of the PKCS Standards, An RSA Laboratories Technical Note, revised November 1, 1993. See http://www.rsa.com/rsalabs/pubs/PKCS/.

[MIME] N. Freed, N. Borenstein, ultipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies, RFC2045. See for instance ftp://ftp.isi.edu/in-notes/rfc2045.txt.

[SSL2] Kipp E.B. Hickman, The SSL Protocol, 1995.

See http://www.netscape.com/eng/security/SSL_2.html.

[SSL3] Alan O. Freier, Philip Karlton, Paul C. Kocher, The SSL Protocol Version 3.0, 1996. See

http://www.netscape.com/eng/ssl3/draft302.txt.

[TLS1] Tim Dierks, Christopher Allen, The TLS Protocol Version 1.0, 1997. See

ftp://ftp.ietf.org/internet-drafts/draft-ietf-tls-protocol-06.txt.

Posted by Golmong
:


90년대 후반 우리나라에도 인터넷이 보편화되고 다양한 IT 기술들이 등장하고 사용되지만 당시에는 많은 IT 기술 문서들이 대부분 영문들이고 한글로 된 기술문서들이 부족했던 시절이었는데, 이에 따라서 KLDP와 같은 다양한 기술문서 한글화 작업 프로젝트들이 많이 시작되었으며 젊은 엔지니어들은 오픈소스 프로젝트와 더불어 이러한 한글화 프로젝트에 contribution 하는 의무감이 유행하던 적이 있었다.
당시 나도 공부도 할겸 RFC나 암호 관련 문서들을 꽤 많이 번역하고 일부는 KLDP 등에 쾌척하면서 스스로 뿌듯함을 느끼던 적도 많았는데, 점점 나이를 먹고 조직에서 직급도 올라가면서 소위 관리 업무들이 많아지니 점점 예전의 그러한 열정을 잃어가고 그 때는 그렇게 재미있게 느껴지던 공부들이 이젠 관심조차 가지 않는 나를 보며 스스로 많이 느슨하게 살고 있다는 느낌을 받을 때가 많아진다.
지금도 예전의 그 열정을 유지할 수 있다면 삶이 조금은 더 나아질 수 있지 않을까....

오랜만에 PC 정리하다가 찾은 그 시절에 아르바이트 겸 공부 겸 해서 번역했었던 Mod_SSL 기술 문서들...
지금 올라와 있는 문서들과 비교하면 introduction 정도 변경이 있는 것 같긴 하지만 핵심 내용은 거의 변경이 없는 듯 하니 혹시나 도움이 되실 분들이 있을까 하여 한번 정리해 올려본다.
지금 보면 짧은 지식에 번역하면서 해석이 이상한 것도 많고 대충 대충 한 것도 많지만 다 과거의 기록이라는 핑계로, 귀찮기도 하니 그냥 올리니 혹시 이상한 부분이 있으면 댓글로 남겨주시면 감사하겠다.

mod_ssl의 최종 문서 주소는 아래와 같다.

http://www.modssl.org/docs/2.8/index.html 

암호 기술 분야의 좋은 점 중 하나는 15년이 지나도 사용되는 기술이 변하지 않는다는 점이 아닐까 싶다. 기껏해야 보안성 강화를 위해 RSA의 키 길이를 1024에서 2048 bit 로 올리는 정도의 변화가 있었을 뿐...
아마도 단언하건데 앞으로 15년 후에도 지금과 동일한 스키마에 동일한 알고리즘이 그대로 사용되고 있을 것이라고 강하게 추정하는 바이다.

Chapter1 OverView

module Eric A. Young Tim Hudson 구현한 SSL/TLS 라이브러리인 SSLeay 이용하여 Secure Socket Layer(SSL v2/v3) Transport Layer Security(TLS v1) 통한 Apache 웹서버의 강력한 암호화 기능을 제공한다.

mod_ssl package 1998 4 Ralf S. Engelschall 의하여 만들어졌으며, Ben Laurie 개발한 Apache-SSL package로부터 구현되었다. Mod_ssl Apache Group 사용한 라이센스와 동일한 BSD 스타일의 라이센스가 적용되며, author copyright 적절한 credit 표시하는 상업적, 비상업적 목적에 모두 사용될 있음을 의미한다.

Module Architecture


Mod_ssl package SSL module mod_ssl 사용하는데 필수적인 요소인 EAPI(Extended API) Apache add하기 위한 소스 패치들의 모음(set)으로 구성된다. Apache 핵심코드(core code) EAPI 포함하고 있어야만 mod_ssl 사용할 있다. 그러나 mod_ssl Apache 소스 트리에 적용할 EAPI 자동으로 add되기 때문에 보통 이것에 신경을 필요는 없으며, 이부분은 Apache 다른 package들과 mod_ssl building하고자 하는 package vendor들에게 중요한 부분이다. Mod_ssl Apache 소스 트리에 적용하는 방법에 대한 자세한 내용은 mod_ssl 배포판 안에 있는 INSTALL 파일을 참조한다.

 

Module Building

SSL module(mod_ssl) Apache 소스 트리의 src/modules/ssl 디렉토리에 위치하게 되며, 이것은 일반적인 Apache module이다. 이는 mod_ssl 다른 Apache module처럼 configure, build, install 있음을 의미한다. 보통 과정은 APACI command 사용하여 수행된다.

$ cd apache_1.3.x/

$ SSL_BASE=/path/to/ssleay ./configure --enable-module=ssl

혹은 src/Configuration 파일에서 SSB_BASE 변수를 직접 수정하고 해당 AddModule directive 주석처리를 없앤 후에 다음의 명령으로 수행할 수도 있다.

$ cd apache_1.3.x/src

$ ./Configure

다른 방법으로 APACI configure command line에서 ?enable-shared=ssl 옵션을 주거나 src/Configuration 파일에서 AddModule ssl_module module/ssl/libssl.a 라인을 SharedModule ssl_module modules/ssl/libssl.so 수정함으로써 Dynamic Shared Object(DSO) 지원을 가능하게 있다.

Mod_ssl DSO building하는 것은 run-time flexibility 향상시킬 있는데 예를 들면 build-time 아니라 run-time에서 SSL 사용할 것인가 사용하지 않을 것인가를 결정할 있다. 그러나 mod_ssl DSO building하는 것은 OS compiler DSO 지원하는가에 따라 달라지며, 모든 platform DSO 지원하지는 않는다.



  
Posted by Golmong
: