HTTPS Service Setup

Source: Internet
Author: User

Background:

HTTP mode: Client to server in clear text transmission, anyone can easily intercept or tamper with confidential data

HTTPS mode: Privacy data with ciphertext transmission, even if intercepted can not be decrypted


Environment:

1 servers (one host can be shared with the issuing authority)

1 certification authorities

1 Client computers




650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M00/8D/F2/wKiom1iv4g3xQgj9AAA7Q7tMC9w751.png "title=" 1.png "alt=" Wkiom1iv4g3xqgj9aaa7q7tmc9w751.png "/>


Process:

The first step: The Web server generates the secret key and sends the public key to the certification authority CA for the certificate

The second step: the CA according to its own secret key algorithm, combined with the public key to generate CRT certificate files, and issued to the Web server

Step three: After the client sends the request to the server, the server will send the certificate information to the client browser

Fourth step: The client checks whether the received certificate is a trusted authority certificate, yes, the point trust indicates that the certificate is authorized



First, the authority host, find the OpenSSL tool, Mr. Root certificate file secret key Cakey.pem

Description: Umask is used to restrict general user access, call to OpenSSL tool, RSA algorithm, and generate and output cakey. pem file with a key length of 2048

Command: (umask 077;openssl genrsa-out/etc/pki/ca/private/cakey.pem 2048)

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M02/8D/F0/wKioL1iv4umClcUXAAAgbGnN-90130.png "style=" float : none; "title=" 10.png "alt=" Wkiol1iv4umclcuxaaagbgnn-90130.png "/>

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M01/8D/F0/wKioL1iv4unx7MfyAAAIdFto6e0570.png "style=" float : none; "title=" 11.png "alt=" Wkiol1iv4unx7mfyaaaidfto6e0570.png "/>


Second, modify the OpenSSL profile/etc/pki/tls/openssl.cnf, set the key default value when generating self-signed certificate

Description: State, province, city, organization, organizational unit

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M00/8D/F0/wKioL1iv4w_T5Jd1AABc70rl_l0592.png "title=" 2.png "alt=" Wkiol1iv4w_t5jd1aabc70rl_l0592.png "/>



Third, create the root certificate file Cacert.pem

Description: Adopt req format, new application document, international standard 509; generated by Cakey.pem key; output name Cacert.pem; valid for 365 days; config file default, fill in Domain name and admin mailbox

command OpenSSL req-new-x509-key/etc/pki/ca/private/cakey.pem-out/etc/pki/ca/cacert.pem-days 365

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M00/8D/F0/wKioL1iv43rwWjHIAABcq7qP1r4465.png "style=" float : none; "title=" 30.png "alt=" Wkiol1iv43rwwjhiaabcq7qp1r4465.png "/>

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M01/8D/F2/wKiom1iv43uje_UcAAAKE9r50gM074.png "style=" float : none; "title=" 31.png "alt=" Wkiom1iv43uje_ucaaake9r50gm074.png "/>



Iv. Web server Host

Description: Some modules that the server needs to enable (such as Apache installed, yum installation mod_ssl and OpenSSL, dynamic mode loading module)

--with-included-apr--enable-so--enable-deflate=shared--enable-expires=share--enable-rewrite=shared--enable-ssl


1. Generate a secret key Httpd.key

Command (umask 077;/usr/bin/openssl genrsa >httpd.key)

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M02/8D/F2/wKiom1iv453hjoh0AAA8B2SiaIQ776.png "title=" 41. PNG "alt=" Wkiom1iv453hjoh0aaa8b2siaiq776.png "/>


2. Create a new certificate request file with the Httpd.key key Httpd.crq

Description: Fill in the Authority information, the domain name can only select one valid (if there are more than one), no additional encryption to improve security, directly enter the

command /usr/bin/openssl req-new-key httpd.key-out httpd.crq

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M01/8D/F2/wKiom1iv48-zRzKQAABtvztxGwQ604.png "style=" float : none; "title=" 420.png "alt=" Wkiom1iv48-zrzkqaabtvztxgwq604.png "/>

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M00/8D/F0/wKioL1iv48_TP254AAAGcZdGt-Q555.png "style=" float : none; "title=" 421.png "alt=" Wkiol1iv48_tp254aaagczdgt-q555.png "/>

3. Submit the certificate request file to the certification authority

650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M02/8D/F0/wKioL1iv4_SyMKriAAAUV0kcjJ8123.png "title=" 43. PNG "alt=" Wkiol1iv4_symkriaaauv0kcjj8123.png "/>



V. Authority host creation: Index.txt, which is used to store the records that issued the certificate store, serial used to describe the certificate number

Note: The/ETC/PKI/TLS/OPENSSL.CNF must be indicated in the OpenSSL configuration file

Command Touch index.txt

command echo "xx" >>serial

650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M00/8D/F0/wKioL1iv5AiCJeSvAAAZqAOYNUY939.png "style=" float : none; "title=" 50.png "alt=" Wkiol1iv5aicjesvaaazqaoynuy939.png "/>

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M01/8D/F2/wKiom1iv5AmypgvFAAARdamOACs852.png "style=" float : none; "title=" 51.png "alt=" Wkiom1iv5amypgvfaaardamoacs852.png "/>

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M01/8D/F0/wKioL1iv5AmzwNAKAABA8Rmel_E143.png "style=" float : none; "title=" 52.png "alt=" Wkiol1iv5amzwnakaaba8rmel_e143.png "/>



VI. Generate certificate file Http.crt

Description: Use CA command; Specify application file, output, expiry date, check whether the website server request information is consistent with the issuing authority, if the audit is not a problem, reply y sign; After successful certificate generation, serial and index.txt automatically record values

command /usr/bin/openssl ca-in/tmp/httpd.crq-out/tmp/http.crt-days 365

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M00/8D/F2/wKiom1iv5DTwuENQAACVXLtSeYM192.png "style=" float : none; "title=" 60.png "alt=" Wkiom1iv5dtwuenqaacvxltseym192.png "/>

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M00/8D/F0/wKioL1iv5DSTD8JlAAAdbine38I253.png "style=" float : none; "title=" 61.png "alt=" Wkiol1iv5dstd8jlaaadbine38i253.png "/>



Vii. Pass the generated certificate HTTP.CRT to the Web server

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M01/8D/F2/wKiom1iv5FySFZuoAAAwZYLzqVA172.png "title=" 7.png "alt=" Wkiom1iv5fysfzuoaaawzylzqva172.png "/>



Viii. Web server Modify configuration file

1. As Apache, Master config file/usr/local/apache2/conf/httpd.conf

Description: Enable SSL encryption to load the SSL module

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M01/8D/F2/wKiom1iv5HGTFMPmAAAJjugbc0o957.png "style=" float : none; "title=" 810.png "alt=" Wkiom1iv5hgtfmpmaaajjugbc0o957.png "/>

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M01/8D/F0/wKioL1iv5HHwoiVDAAAgzl0GUO0082.png "style=" float : none; "title=" 811.png "alt=" Wkiol1iv5hhwoivdaaagzl0guo0082.png "/>

2. Continue to modify the configuration file/usr/local/apache2/conf/extra/httpd-ssl.conf

Description: Port number default 443; Set root directory, domain name; open engine; Specify certificate file and secret key file directory

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M00/8D/F2/wKiom1iv5I_Cw6oBAAAqcyuldbw063.png "style=" float : none; "title=" 820.png "alt=" Wkiom1iv5i_cw6obaaaqcyuldbw063.png "/>

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M00/8D/F2/wKiom1iv5JDxPzaGAAA7WsJyvVY372.png "style=" float : none; "title=" 821.png "alt=" Wkiom1iv5jdxpzagaaa7wsjyvvy372.png "/>



Nine, the client test

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M01/8D/F0/wKioL1iv5Lri7lFBAAAK8UINKqc326.png "title=" 9.png "alt=" Wkiol1iv5lri7lfbaaak8uinkqc326.png "/>

This article is from "A horse on the Plains" blog, please be sure to keep this source http://huangzp.blog.51cto.com/12434999/1900957

HTTPS Service Setup

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.