<!--
   $FML$
-->

<chapter id="apache">

<title> apache </title>

<sect1>
   <title> apache + mod_ssl を作る </title>

<para>
まず、これらのソースを手に入れる。

	apache_1.3.9.tar.gz
	mod_ssl-2.4.8-1.3.9.tar.gz 
	openssl-0.9.4.tar.gz

そして、解凍する。
<screen>
% tar zxvf apache_1.3.9.tar.gz
% tar zxvf mod_ssl-2.4.8-1.3.9.tar.gz 
% tar zxvf openssl-0.9.4.tar.gz
</screen>
</para>

<para>
まず、openssl を作る。

<screen>
% cd openssl-0.9.4 
% ./config
% make
% su
# make install
</screen>
</para>

<para>
openssl を使えるようにするパッチを当てて、apache を compile する。
<screen>
% cd mod_ssl-2.4.8-1.3.9
% sh configure --with-apache=../apache_1.3.9
% cd ../apache_1.3.9
% env BASE_SSL=/usr/local/ssl ./configure --enable-module=ssl 
% make
</screen>
</para>

</sect1>


<sect1>
   <title> apache + mod_ssl をインストールする </title>

<para>
apache をインストールする際に
CA (Certificate Agent) を作らなければなりません。
<screen>
% make certificate TYPE=custom
% make install
</screen>
</para>

<para>
apache がパスワードなしに起動できるようにパスフレーズを消します。
そうしないと非対称鍵を読めないからねい。
<screen>
# cd /usr/local/apache/conf/ssl.key
# openssl rsa -in server.key -out server.key
# chmod 400 server.key
</screen>
</para>

<para>
apache を SSL モードでスタートさせます。
<screen>
# /usr/local/apache/bin/apachectl startssl
</screen>
</para>

</sect1>

<sect1>
   <title> CA の例 </title>

<screen>
RESULT: CA and Server Certification Files

o  conf/ssl.key/ca.key
   The PEM-encoded RSA private key file of the CA which you can
   use to sign other servers or clients. KEEP THIS FILE PRIVATE!

o  conf/ssl.crt/ca.crt
   The PEM-encoded X.509 certificate file of the CA which you use to
   sign other servers or clients. When you sign clients with it (for
   SSL client authentication) you can configure this file with the
   'SSLCACertificateFile' directive.

o  conf/ssl.key/server.key
   The PEM-encoded RSA private key file of the server which you configure
   with the 'SSLCertificateKeyFile' directive (automatically done
   when you install via APACI). KEEP THIS FILE PRIVATE!

o  conf/ssl.crt/server.crt
   The PEM-encoded X.509 certificate file of the server which you configure
   with the 'SSLCertificateFile' directive (automatically done
   when you install via APACI).

o  conf/ssl.csr/server.csr
   The PEM-encoded X.509 certificate signing request of the server file which
   you can send to an official Certificate Authority (CA) in order
   to request a real server certificate (signed by this CA instead
   of our own CA) which later can replace the conf/ssl.crt/server.crt
   file.

Congratulations that you establish your server with real certificates.
</screen>

</sect1>

<sect1>
   <title> SSL を使った CGI セッションの例 </title>

<screen>
ENV: SSL_SESSION_ID =&gt; DBEB0B1448B2CA5E2ED7A3FF76CFC0F8B65328FD4951814193257C7106C33C96
ENV: SSL_SERVER_ICN =&gt; beth.fml.org
ENV: SERVER_SOFTWARE =&gt; Apache/1.3.9 (Unix) mod_ssl/2.4.8 OpenSSL/0.9.4
ENV: SSL_SERVER_I_DN_C =&gt; jp
ENV: SSL_CIPHER_ALGKEYSIZE =&gt; 128
ENV: REMOTE_ADDR =&gt; 10.1.1.3
ENV: SSL_SSLEAY_VERSION =&gt; OpenSSL/0.9.4
ENV: REQUEST_METHOD =&gt; POST
ENV: SSL_SERVER_KEY_SIZE =&gt; Not supported by mod_ssl
ENV: SSL_SERVER_C =&gt; jp
ENV: REMOTE_USER =&gt; admin
ENV: SSL_VERSION_LIBRARY =&gt; OpenSSL/0.9.4
ENV: SSL_SERVER_S_DN =&gt; /C=jp/ST=Hokkaido/L=sapporo/O=FML.ORG sapporo/OU=Technical Div./CN=beth.fml.org/Email=fukachan@fml.org
ENV: SSL_SERVER_CERT_END =&gt; Nov  7 12:23:31 2000 GMT
ENV: SSL_SERVER_I_DN_L =&gt; sapporo
ENV: HTTPS_CIPHER =&gt; EXP-RC4-MD5
ENV: SSL_SERVER_I_DN_O =&gt; FML.ORG Sapporo
ENV: HTTP_ACCEPT =&gt; image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png, */*
ENV: HTTP_ACCEPT_LANGUAGE =&gt; en
ENV: SSL_SERVER_L =&gt; sapporo
ENV: SSL_SERVER_ISP =&gt; hokkaido
ENV: HTTPS =&gt; on
ENV: SSL_SERVER_IOU =&gt; Technical Division
ENV: SCRIPT_FILENAME =&gt; /usr/local/fml/www/cgi-bin/admin/makefml.cgi
ENV: SSLEAY_VERSION =&gt; OpenSSL/0.9.4
ENV: SSL_SERVER_O =&gt; FML.ORG sapporo
ENV: SERVER_NAME =&gt; beth.fml.org
ENV: SSL_SERVER_CN =&gt; beth.fml.org
ENV: SSL_SERVER_M_VERSION =&gt; 3
ENV: SSL_SECRETKEYSIZE =&gt; 40
ENV: SERVER_PORT =&gt; 443
ENV: SSL_CLIENT_CERT =&gt; 
ENV: SSL_CLIENT_KEY_ALGORITHM =&gt; Not supported by mod_ssl
ENV: SSL_SERVER_IDN =&gt; /C=jp/ST=hokkaido/L=sapporo/O=FML.ORG Sapporo/OU=Technical Division/CN=beth.fml.org/Email=fukachan@fml.org
ENV: SERVER_SIGNATURE =&gt; &le;ADDRESS&gt;Apache/1.3.9 Server at beth.fml.org Port 443&le;/ADDRESS&gt;

ENV: SSL_SERVER_V_START =&gt; Nov  8 12:23:31 1999 GMT
ENV: SSL_SERVER_SP =&gt; Hokkaido
ENV: SSL_SERVER_OU =&gt; Technical Div.
ENV: SSL_CIPHER =&gt; EXP-RC4-MD5
ENV: HTTP_CONNECTION =&gt; Keep-Alive
ENV: SSL_SERVER_I_DN_CN =&gt; beth.fml.org
ENV: SSL_SERVER_S_DN_Email =&gt; fukachan@fml.org
ENV: SSL_SERVER_CERT =&gt; -----BEGIN CERTIFICATE-----
MIIDTjCCAregAwIBAgIBATANBgkqhkiG9w0BAQQFADCBsTELMAkGA1UEBhMCanAx
SUogU2FwcG9ybzEbMBkGA1UECxMSVGVjaG5pY2FsIERpdmlzaW9uMR8wHQYDVQQD
ExZiZXRoLnNhcHBvcm8uaWlqLmFkLmpwMSkwJwYJKoZIhvcNAQkBFhpmdWthY2hh
bkBzYXBwb3JvLmlpai5hZC5qcDAeFw05OTExMDgxMjIzMzFaFw0wMDExMDcxMjIz
MzFaMIGtMQswCQYDVQQGEwJqcDERMA8GA1UECBMISG9ra2FpZG8xEDAOBgNVBAcT
B3NhcHBvcm8xFDASBgNVBAoTC0lJSiBzYXBwb3JvMRcwFQYDVQQLEw5UZWNobmlj
SIb3DQEJARYaZnVrYWNoYW5Ac2FwcG9yby5paWouYWQuanAwgZ8wDQYJKoZIhvcN
AQEBBQADgY0AMIGJAoGBAJ1/0it3TZQIoiTT9WQFdtssV25SCZEGeR/hwkmv7wPv
XBng82cesCwpixGog4EGVQGIghCN6/6o9QYg8t1BY+C7IHjtHSn/GNWeim9TFQ/Y
rEtf/TtbgJvnDh3PQuP+Z/MYjSwNCmyNP37LSehtztteoaUofL44TxQlVKD4vs6x
AgMBAAGjeDB2MCUGA1UdEQQeMByBGmZ1a2FjaGFuQHNhcHBvcm8uaWlqLmFkLmpw
MDoGCWCGSAGG+EIBDQQtFittb2Rfc3NsIGdlbmVyYXRlZCBjdXN0b20gc2VydmVy
IGNlcnRpZmljYXRlMBEGCWCGSAGG+EIBAQQEAwIGQDANBgkqhkiG9w0BAQQFAAOB
gQBBYnVVF7ILyCP/oSjJFvje9XUN25O9RNovnkYe/XQfsEeJZ2/wsuaX62aEY18x
Y7cWn40sUEfDCQNGbUFNTkNjEOXgftYaQ3KANSAi/6PyWOP2eyGR8eQcBUJ4H7VE
o4eS8dODzXmjyrNzxMCM0gfXvsIDLlbQPsDzf3t0m6YkzA==
-----END CERTIFICATE-----

ENV: SSL_KEYSIZE =&gt; 128
ENV: SSL_SERVER_KEY_ALGORITHM =&gt; Not supported by mod_ssl
ENV: HTTPS_KEYSIZE =&gt; 128
ENV: REQUEST_URI =&gt; /cgi-bin/fml/admin/makefml.cgi
ENV: SSL_SERVER_IEMAIL =&gt; fukachan@fml.org
ENV: SSL_SERVER_DN =&gt; /C=jp/ST=Hokkaido/L=sapporo/O=FML.ORG sapporo/OU=Technical Div./CN=beth.fml.org/Email=fukachan@fml.org
ENV: SSL_SERVER_S_DN_CN =&gt; beth.fml.org
ENV: CONTENT_LENGTH =&gt; 67
ENV: SSL_SERVER_I_DN =&gt; /C=jp/ST=hokkaido/L=sapporo/O=FML.ORG Sapporo/OU=Technical Division/CN=beth.fml.org/Email=fukachan@fml.org
ENV: GATEWAY_INTERFACE =&gt; CGI/1.1
ENV: DOCUMENT_ROOT =&gt; /usr/local/apache/htdocs
ENV: SSL_SERVER_CERT_START =&gt; Nov  8 12:23:31 1999 GMT
ENV: SSL_PROTOCOL =&gt; SSLv3
ENV: SSL_SERVER_I_DN_SP =&gt; hokkaido
ENV: SSL_SERVER_I_DN_OU =&gt; Technical Division
ENV: SSL_PROTOCOL_VERSION =&gt; SSLv3
ENV: SSL_SERVER_A_SIG =&gt; md5WithRSAEncryption
ENV: QUERY_STRING =&gt; 
ENV: SSL_SERVER_S_DN_SP =&gt; Hokkaido
ENV: SSL_SERVER_S_DN_C =&gt; jp
ENV: SSL_CIPHER_EXPORT =&gt; true
ENV: SSL_SERVER_S_DN_OU =&gt; Technical Div.
ENV: REMOTE_PORT =&gt; 58991
ENV: SSL_SERVER_A_KEY =&gt; rsaEncryption
ENV: SERVER_ADDR =&gt; 10.1.1.3
ENV: SSL_SERVER_IC =&gt; jp
ENV: HTTPS_EXPORT =&gt; true
ENV: HTTP_ACCEPT_ENCODING =&gt; gzip
ENV: SSL_SERVER_CERTFILE =&gt; Not supported by mod_ssl
ENV: SSL_SERVER_S_DN_L =&gt; sapporo
ENV: HTTP_PRAGMA =&gt; no-cache
ENV: SSL_SERVER_S_DN_O =&gt; FML.ORG sapporo
ENV: SSL_SERVER_IL =&gt; sapporo
ENV: HTTPS_SECRETKEYSIZE =&gt; 40
ENV: SSL_CIPHER_USEKEYSIZE =&gt; 40
ENV: SSL_SERVER_IO =&gt; FML.ORG Sapporo
ENV: SERVER_ADMIN =&gt; fukachan@beth.fml.org
ENV: SSL_CLIENT_KEY_EXP =&gt; Not supported by mod_ssl
ENV: SSL_CLIENT_VERIFY =&gt; NONE
ENV: SSL_VERSION_INTERFACE =&gt; mod_ssl/2.4.8
ENV: SERVER_PROTOCOL =&gt; HTTP/1.0
ENV: SSL_SERVER_I_DN_Email =&gt; fukachan@fml.org
ENV: SSL_SERVER_SESSIONDIR =&gt; Not supported by mod_ssl
ENV: HTTP_REFERER =&gt; https://beth/cgi-bin/fml/admin/menu.cgi
ENV: SSL_SERVER_CERTIFICATE =&gt; -----BEGIN CERTIFICATE-----
MIIDTjCCAregAwIBAgIBATANBgkqhkiG9w0BAQQFADCBsTELMAkGA1UEBhMCanAx
ETAPBgNVBAgTCGhva2thaWRvMRAwDgYDVQQHEwdzYXBwb3JvMRQwEgYDVQQKEwtJ
SUogU2FwcG9ybzEbMBkGA1UECxMSVGVjaG5pY2FsIERpdmlzaW9uMR8wHQYDVQQD
bkBzYXBwb3JvLmlpai5hZC5qcDAeFw05OTExMDgxMjIzMzFaFw0wMDExMDcxMjIz
MzFaMIGtMQswCQYDVQQGEwJqcDERMA8GA1UECBMISG9ra2FpZG8xEDAOBgNVBAcT
B3NhcHBvcm8xFDASBgNVBAoTC0lJSiBzYXBwb3JvMRcwFQYDVQQLEw5UZWNobmlj
YWwgRGl2LjEfMB0GA1UEAxMWYmV0aC5zYXBwb3JvLmlpai5hZC5qcDEpMCcGCSqG
SIb3DQEJARYaZnVrYWNoYW5Ac2FwcG9yby5paWouYWQuanAwgZ8wDQYJKoZIhvcN
XBng82cesCwpixGog4EGVQGIghCN6/6o9QYg8t1BY+C7IHjtHSn/GNWeim9TFQ/Y
rEtf/TtbgJvnDh3PQuP+Z/MYjSwNCmyNP37LSehtztteoaUofL44TxQlVKD4vs6x
AgMBAAGjeDB2MCUGA1UdEQQeMByBGmZ1a2FjaGFuQHNhcHBvcm8uaWlqLmFkLmpw
MDoGCWCGSAGG+EIBDQQtFittb2Rfc3NsIGdlbmVyYXRlZCBjdXN0b20gc2VydmVy
IGNlcnRpZmljYXRlMBEGCWCGSAGG+EIBAQQEAwIGQDANBgkqhkiG9w0BAQQFAAOB
gQBBYnVVF7ILyCP/oSjJFvje9XUN25O9RNovnkYe/XQfsEeJZ2/wsuaX62aEY18x
Y7cWn40sUEfDCQNGbUFNTkNjEOXgftYaQ3KANSAi/6PyWOP2eyGR8eQcBUJ4H7VE
o4eS8dODzXmjyrNzxMCM0gfXvsIDLlbQPsDzf3t0m6YkzA==
-----END CERTIFICATE-----

ENV: SSL_SERVER_CERTIFICATELOGDIR =&gt; Not supported by mod_ssl
ENV: HTTP_USER_AGENT =&gt; Mozilla/4.61 [en] (X11; I; NetBSD 1.4D i386; Nav)
ENV: PATH =&gt; /sbin:/usr/sbin:/bin:/usr/bin:/usr/pkg/sbin:/usr/pkg/bin:/usr/X11R6/bin:/usr/local/sbin:/usr/local/bin
ENV: SSL_STRONG_CRYPTO =&gt; Not supported by mod_ssl
ENV: SSL_SERVER_EMAIL =&gt; fukachan@fml.org
ENV: SSL_SERVER_KEYFILE =&gt; Not supported by mod_ssl
ENV: SSL_SERVER_KEYFILETYPE =&gt; Not supported by mod_ssl
ENV: SSL_CLIENT_KEY_SIZE =&gt; Not supported by mod_ssl
ENV: SSL_SERVER_V_END =&gt; Nov  7 12:23:31 2000 GMT
ENV: SSL_SERVER_M_SERIAL =&gt; 01
ENV: AUTH_TYPE =&gt; Basic
ENV: SSL_EXPORT =&gt; true
ENV: SSL_SERVER_CERT_SERIAL =&gt; 01
ENV: SCRIPT_NAME =&gt; /cgi-bin/fml/admin/makefml.cgi
ENV: HTTP_ACCEPT_CHARSET =&gt; iso-8859-1,*,utf-8
ENV: SSL_SERVER_KEY_EXP =&gt; Not supported by mod_ssl
ENV: CONTENT_TYPE =&gt; application/x-www-form-urlencoded
ENV: HTTP_HOST =&gt; beth
ENV: SSL_SERVER_SIGNATURE_ALGORITHM =&gt; md5WithRSAEncryption
Config: submit-p =&gt; Remove
Config: ML =&gt; sayori
Config: PROC =&gt; destructml
Config: LANGUAGE =&gt; Japanese
Config: ML_DEF =&gt; 
メーリングリスト: sayori
を削除します。

    makefml destructml mailing-list

arguments of mailing-list is required
</screen>

</sect1>

</chapter>
