HTTPS Basic Configuration

Source: Internet
Author: User

HTTPS is an abbreviation for HTTP over SSL . Listening on the TCP 443 port, the HTTP protocol can be transmitted securely based on the SSL or TLS protocol . can help the client to complete the server authentication, can ensure that the server access is the server to be accessed, but also to ensure the integrity of data transmission, confidentiality.

When the user and server side of the session based on HTTPS , the first to establish an SSL session, the following figure is the process of establishing an SSL session:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6E/09/wKiom1VxezGR_qyuAAEdQ2pKmyg132.jpg "title=" 1.png " alt= "Wkiom1vxezgr_qyuaaedq2pkmyg132.jpg"/>

One, which establishes SSL The process is:

(1) the client sends to the server side to choose the encryption method, and requests the certificate to the server;

(2) the server side sends the certificate and the selected encryption method to the client;

(3) Certificate verification:

If you trust the certificate to which you are issuing the CA:

(a) the legality of the source of the certificate of verification; a digital signature on the CA's public key decryption certificate;

(b) legality of the contents of a positive certificate: completeness of verification

(c) Check the validity period of the certificate;

(d) Check if the certificate has been revoked;

(e) the name of the owner of the certificate, consistent with the target host to be accessed;

(4) The client generates a temporary session key (symmetric key) and uses the server-side public key to encrypt the data sent to the server to complete the key exchange;

(5) The service uses this key to encrypt the resource requested by the user, responding to the client;

Note: SSL session is based on IP address creation; So the single IP on the host, you can use only one HTTPS virtual host;

Second, the configuration httpd support HTTPS:

(1) apply for a digital certificate for the server;

testing: Through private building CA Issued certificate

(a) creating a private CA

(b) create a certificate signing request on the server

(c) CA Visa

(2) Configure httpd to support the use of SSL, and the use of certificates;

# yum-y Install Mod_ssl

configuration file:/etc/httpd/conf.d/ssl.conf

DocumentRoot

ServerName

Sslcertificatefile

Sslcertificatekeyfile

(3) The test is based on HTTPS access to the corresponding host;

# OpenSSL S_client [-connecthost:port] [-cert filename] [-capath directory] [-cafile filename]

Example:

three virtual machines are prepared here, V1 as a Web server side,V2 is a client,V3 is a Certificate server.

1. Establish a private CA onthe V3 host:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6E/05/wKioL1VxfOeRf_BUAAB0iDI6B5s224.jpg "title=" 2.png " alt= "Wkiol1vxfoerf_buaab0idi6b5s224.jpg"/>

2, the establishment of self-visa books:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6E/09/wKiom1Vxe1WjsOMvAADri5mSKnU205.jpg "title=" 3.png " alt= "Wkiom1vxe1wjsomvaadri5msknu205.jpg"/>

3. Fill in the CA information:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6E/05/wKioL1VxfQiBTETxAACLqG-5Af8486.jpg "title=" 4.png " alt= "Wkiol1vxfqibtetxaaclqg-5af8486.jpg"/>

4. Create a database index file and serial number for the certificate:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6E/05/wKioL1VxfReDcVmcAAAly4KtBuI552.jpg "title=" 5.png " alt= "Wkiol1vxfredcvmcaaaly4ktbui552.jpg"/>

The certificate is now complete. The established CA is Cacert.pem.

5. Create a secret key on the V1 side:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6E/09/wKiom1Vxe4agXrwJAABuyKXjfWA075.jpg "title=" 6.png " alt= "Wkiom1vxe4agxrwjaabuykxjfwa075.jpg"/>

6, establish a certificate signing request ( hostname must be consistent with the server's hostname, otherwise it will verify that does not pass ):

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6E/05/wKioL1VxfTfQOG1uAAFU_R0pkYE254.jpg "title=" 7.png " alt= "Wkiol1vxftfqog1uaafu_r0pkye254.jpg"/>

(e-mail address and polygon can be selected)

7, on the V1 on the V1 certificate signing request to the Certificate Server V3 , casually placed in a directory can:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6E/05/wKioL1VxfU-Dy0YlAADA0EQn_XA586.jpg "title=" 8.png " alt= "Wkiol1vxfu-dy0ylaada0eqn_xa586.jpg"/>

8 . sign The V1 certificate request on V3:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6E/09/wKiom1Vxe8LDnIn8AAHYl54L1Qs155.jpg "title=" 9.png " alt= "Wkiom1vxe8ldnin8aahyl54l1qs155.jpg"/>

9, on the V3 on the V3 signed certificate issued to V1

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6E/05/wKioL1VxfXijBKLzAAC50U7z2As166.jpg "title=" 10.png "alt=" Wkiol1vxfxijbklzaac50u7z2as166.jpg "/>

In this way, the certificate signing is complete.

below start the configuration on zai V1 httpd

because http does not have an SSL module by default , install the component (be sure to configure the Yum repository!!! )

Yuminstall–y Mod_ssl

modifying The ssl.conf configuration file

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6E/09/wKiom1Vxe_Ch4Mv5AADnE9sX4ww026.jpg "style=" float: none; "title=" 11.png "alt=" Wkiom1vxe_ch4mv5aadne9sx4ww026.jpg "/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6E/05/wKioL1VxfZPwIx4wAADL8tKYpb8538.jpg "style=" float: none; "title=" 12.png "alt=" Wkiol1vxfzpwix4waadl8tkypb8538.jpg "/>

re-edit V1 httpd configuration file /etc/httpd/conf/httpd.conf Modify the virtual host and modify the V2/etc/host file, This editing method in the previous article has, no longer repeat;

start httpd Server service httpd start

See if the 443 port is open SS–TNL 1 | grep 443

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6E/09/wKiom1VxfAjB95xGAAAqLTqeeqM760.jpg "title=" 13.png "alt=" Wkiom1vxfajb95xgaaaqltqeeqm760.jpg "/>

in the V1 after editing the page with V3 to send a certificate to V2.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6E/09/wKiom1VxfBfD3xjzAACkU8yW0ZE520.jpg "title=" 14.png "alt=" Wkiom1vxfbfd3xjzaacku8yw0ze520.jpg "/>

and in Access V1 test with OpenSSL on V2

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6E/05/wKioL1VxfeqRbJvZAAAizRQvFdU644.jpg "title=" 15.png "alt=" Wkiol1vxfeqrbjvzaaaizrqvfdu644.jpg "/>

at this point, you can access the SSL - based HTTP server ^_^ ~

If the above content is biased, look in time to correct me!


HTTPS Basic Configuration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.