It’s me

January 23, 2008

SSL용 증명서의 인스톨 작업

Filed under: Server — rothmans @ 6:21 pm

 
1. CA용 비밀열쇠(cakey.pem)와 CA용 증명서(cacert.pem)의 작성

* 주의점 *

입력을 잘못했을 경우에는 Ctrl+C 로 종료하시고

C:\SpaceTag\server\openssl\etc

아래에 있는 demoCA 폴더를 삭제하고 나서 다시 처음부터 작업을 다시해 주시기 바랍니다.

시작 -> 실행 -> cmd

의 명령으로 명령프롬프트(Command Prompt)를 열어서

C:\SpaceTag\server\openssl\bin 디렉터리로 이동합니다

cd C:\SpaceTag\server\openssl\bin

명령프롬프트에서 다음의 명령을 실행 합니다.

perl CA.pl -newca

아래와 같은 메세지가 표시되면 ENTER 키를 누릅니다

CA certificate filename (or enter to create)

CA용의 파스프레이즈를 입력합니다 (입력해도 화면상에는 표시되지 않습니다)

Enter PEM pass phrase:SPACETAG

아래와 같은 메세지가 표시되었을 경우 입력한 CA용의 파스프레이즈를 다시 입력합니다 (입력해도 화면상에는 표시되지 않습니다)

Verifying – Enter PEM pass phrase:SPACETAG

나라 코드를 입력합니다.

Country Name (2 letter code) [AU]:KR

지역이름을 입력합니다.

State or Province Name (full name) [Some-State]:

시도를 입력합니다.

Locality Name (eg, city) []:Daejeon

조직명 또는 회사명을 입력합니다.

Organization Name (eg, company) [Internet Widgits Pty Ltd]:SpaceTag, Inc.

조직내 유니트명을 입력합니다.

Organizational Unit Name (eg, section) []:R&D

조직명, 서버명 또는 유저명중에 하나를 입력합니다.

Common Name (eg, YOUR name) []:OkStart

관리자 메일 주소를 입력합니다.

Email Address []:info@spacetag.jp

아래는 명령을 입력한 예 입니다.

—————————————–

C:\SpaceTag\server\openssl\bin>perl CA.pl -newca
CA certificate filename (or enter to create)

Making CA certificate …
Loading ’screen’ into random state – done
Generating a 1024 bit RSA private key
….++++++
……..++++++
writing new private key to ‘C:/spacetag/server/openssl/etc/demoCA/private/cakey.pem’
Enter PEM pass phrase:
Verifying – Enter PEM pass phrase:
—–
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter ‘.’, the field will be left blank.
—–
Country Name (2 letter code) [AU]:KR
State or Province Name (full name) [Some-State]:
Locality Name (eg, city) []:Daejeon
Organization Name (eg, company) [Internet Widgits Pty Ltd]:SpaceTag, Inc.
Organizational Unit Name (eg, section) []:R&D
Common Name (eg, YOUR name) []:OkStart
Email Address []:info@spacetag.jp

C:\SpaceTag\server\openssl\bin>

—————————————–

2. CA증명서를 브라우저에 임포트하기 위한 ca.der 파일의 작성

아래의 명령을 실행 합니다.

openssl x509 -inform pem -in C:\SpaceTag\server\openssl\etc\demoCA\cacert.pem -outform der -out C:\SpaceTag\server\openssl\etc\demoCA\ca.der

3. 서버용 비밀열쇠(server.key)의 작성

시작 -> 실행 -> cmd

의 명령으로 명령프롬프트(Command Prompt)를 열어서 아래의 명령을 실행 합니다.

openssl genrsa -out C:\SpaceTag\server\openssl\etc\demoCA\server.key 1024

아래는 명령을 입력한 예 입니다.

—————————————–

C:\SpaceTag\server\openssl\bin>openssl genrsa -out C:\SpaceTag\server\openssl\etc\demoCA\server.key 1024
Loading ’screen’ into random state – done
Generating RSA private key, 1024 bit long modulus
..++++++
………………..++++++
e is 65537 (0×10001)

C:\SpaceTag\server\openssl\bin>

—————————————–

4. 서버용 공개열쇠(server.csr)의 작성

* 주의점 *

입력을 잘못했을 경우에는 Ctrl+C 로 종료하시고

C:\SpaceTag\server\openssl\etc

아래에 있는 demoCA 폴더를 삭제하고 나서 다시 처음부터(1번부터) 작업을 다시해 주시기 바랍니다.

아래의 명령을 실행 합니다.

openssl req -new -key C:\SpaceTag\server\openssl\etc\demoCA\server.key -out C:\SpaceTag\server\openssl\etc\demoCA\server.csr

나라 코드를 입력합니다.

Country Name (2 letter code) [AU]:JP

지역이름을 입력합니다.

State or Province Name (full name) [Some-State]:

지역이름을 입력합니다.

Locality Name (eg, city) []:Daejeon

조직명 또는 회사명을 입력합니다.

Organization Name (eg, company) [Internet Widgits Pty Ltd]:SpaceTag, Inc.

조직내 유니트명을 입력합니다

Organizational Unit Name (eg, section) []:R&D

도메인명을 입력합니다.

*주의점*
1. CA용 비밀열쇠(cakey.pem)와 CA용 증명서(cacert.pem)의 작성에서 입력한 키와 다르게 입력합니다.

Common Name (eg, YOUR name) []:online.spacetag.jp

관리자 메일 주소를 입력합니다

Email Address []:info@spacetag.jp

이하의 표시가 되면 ENTER 키를 누릅니다

A challenge password []:

이하의 표시가 되면 다시한번 ENTER 키를 누릅니다

An optional company name []:

아래는 명령을 입력한 예 입니다.

—————————————–

C:\SpaceTag\server\openssl\bin>openssl req -new -key C:\SpaceTag\server\openssl\etc\demoCA\server.key -out C:\SpaceTag\server\openssl\etc\demoCA\server.csr
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter ‘.’, the field will be left blank.
—–
Country Name (2 letter code) [AU]:KR
State or Province Name (full name) [Some-State]:
Locality Name (eg, city) []:Daejeon
Organization Name (eg, company) [Internet Widgits Pty Ltd]:SpaceTag, Inc.
Organizational Unit Name (eg, section) []:R&D
Common Name (eg, YOUR name) []:online.spacetag.jp
Email Address []:info@spacetag.jp

Please enter the following ‘extra’ attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:

C:\SpaceTag\server\openssl\bin>

—————————————–

5. 서버용 증명서(server.crt)의 작성

아래의 명령을 실행 합니다.

echo 01 > C:\SpaceTag\server\openssl\etc\demoCA\ca-cert.srl

아래의 명령을 실행 합니다.

openssl x509 -CA C:\SpaceTag\server\openssl\etc\demoCA\cacert.pem -CAkey C:\SpaceTag\server\openssl\etc\demoCA\private\cakey.pem -CAserial C:\SpaceTag\server\openssl\etc\demoCA\ca-cert.srl -req -days 365 -in C:\SpaceTag\server\openssl\etc\demoCA\server.csr -out C:\SpaceTag\server\openssl\etc\demoCA\server.crt

이하의 메세지가 표시되면 이전 작업(1번)에서 입력한 CA용 패스 프레이즈를 입력합니다

Enter pass phrase for C:\SpaceTag\server\openssl\etc\demoCA\private\cakey.pem:SPACETAG

아래는 명령을 입력한 예 입니다.

—————————————–

C:\SpaceTag\server\openssl\bin>openssl x509 -CA C:\SpaceTag\server\openssl\etc\demoCA\cacert.pem -CAkey C:\SpaceTag\server\openssl\etc\demoCA\private\cakey.pem -CAserial C:\SpaceTag\server\openssl\etc\demoCA\ca-cert.srl -req -days 365 -in C:\SpaceTag\server\openssl\etc\demoCA\server.csr -out C:\SpaceTag\server\openssl\etc\demoCA\server.crt
Loading ’screen’ into random state – done
Signature ok
subject=/C=KR/ST=Some-State/L=Daejeon/O=SpaceTag, Inc./OU=R&D/CN=online.spacetag.jp/emailAddress=info@spacetag.jp
Getting CA Private Key
Enter pass phrase for C:\SpaceTag\server\openssl\etc\demoCA\private\cakey.pem:

C:\SpaceTag\server\openssl\bin>

—————————————–

6. SpaceTag Server 에 적용

Web 관리툴의 주소인 https://127.0.0.1:5880 에 접속할 때에 키가 필요하게 되므로

C:\SpaceTag\server\openssl\etc\demoCA 디렉터리에 있는

server.crt , server.key

의 두개의 파일을 C:\SpaceTag\etc\admin 디렉터리에 복사 합니다.

일반 웹 페이지에서의 SSL 접속으로 필요한 server.crt 파일을

C:\SpaceTag\etc\httpd\ssl.crt 디렉터리에 복사 합니다.

일반 Web에서의 SSL 접속으로 필요한 server.key 파일을

C:\SpaceTag\etc\httpd\ssl.key 디렉터리에 복사 합니다.

복사가 완료 되면 웹 관리, Apache2 이렇게 두개의 서버를 다시 시작 합니다.

7. SSL용 증명서의 인스톨

내 컴퓨터를 열어서

C:\SpaceTag\server\openssl\etc\demoCA 디렉터리로 이동합니다.

ca.der를 더블 클릭 합니다.

증명서의 인스톨 버튼을 클릭합니다.

위저드가 실행되면 다음, 또 다음페이지도 다음을 클릭합니다.

로컬의 SSL의 페이지( https://127.0.0.1/ )에 접속합니다.

시큐러티의 경고 화면이 표시되면 증명서 표시 버튼을 클릭합니다.

증명서의 인스톨 버튼을 클릭합니다.
위저드가 실행되면 다음, 또 다음페이지도 다음을 클릭합니다.

이 작업을 실시하면 시큐러티 경고 화면이 나오지 않게 됩니다.

이것으로 SSL용 증명서의 인스톨 작업은 완료입니다.
 

January 21, 2008

Apache Path Permission

Filed under: Apache — rothmans @ 10:06 am

chcon -R -t httpd_user_content_t {PATH}

January 2, 2008

XMLHTTP

Filed under: AJAX — rothmans @ 5:15 pm

<script language=”javascript”>
function xmlHTTP() {
    var x = new ActiveXObject(“Microsoft.XMLHTTP”)
    x.open(“get”,”http://www.sample.com/page.htm”,false);
    x.send();
    var strv = x.responseBody;
    document.all.xmlhttpBody.innerHTML = BinDecode(strv);
}
</script>

<script language=”vbscript”>
‘—————————————–
‘ BinDecode (바이너리 -> 아스키 변환)
‘ mongmong – 2003. 2
‘—————————————–
    Public Function BinDecode(byVal binData)
        Dim i, byteChr, strV
        For i = 1 to LenB(binData)
            byteChr = AscB(MidB(binData,i,2))
            If byteChr > 127 Then
                i = i + 1
                strV = strV & Chr(“&H” & Hex(byteChr) & Hex(AscB(MidB(binData,i,2))))
            Else
                strV = strV & Chr(byteChr)
            End if
        Next
        BinDecode = strV
    End Function
</script>
 
<div id=xmlhttpBody></div>
var strv = x.responseText; 을 사용하면
HTML소스를 긁어올수 있으나 한글문자에서 깨져버리는군요.
그래서 위 소스에선 var strv = x.responseBody;을 사용하여 바이너리 형태로 데이타를 가져와서 BinDecode() 라는 vbScript를 만들어 바이너리를 아스키로 변환해서 출력해 주네요.

Blog at WordPress.com.