客户端通过https访问服务过程详解: 1,客户机会通过https访问web服务器,web服务器向客户机出示自己的证书。 2,客户机验证证书的有效性,包括发证时间,发证机构,执行者标示。 3,如果客户机验证证书通过,客户机随机产生128为的key,再利用证书文件传递的public key对该随机key进行加密。 4,加密后传送至服务器端,服务器再利用自己的public key对加密的key进行解密,得到客户机的随机key值。 5,这时两端的key值相同,利用该key进行加密通讯。
实验: 拓扑图:
实验环境: Client:windows server 2003 webserver:redhat 5.4 安装包:httpd-2.2.3-31.el5.i386.rp mod_ssl-2.2.3-31.el5.i386.rpm
1,建立服务器密钥: [iyunv@localhost ~]# cd /etc/pki/tls/certs/ [iyunv@localhost certs]# make server.key
[iyunv@localhost certs]# openssl rsa -inserver.key -out server.key (为了安全,删除密钥中的密码)
2,建立服务器公钥: [iyunv@localhost certs]# make server.csr
3,建立服务器证书: [iyunv@localhost certs]# openssl x509 -inserver.csr -out server.pem -req -signkey server.key -days 365
[iyunv@localhost certs]# chmod 600 server.*(修改权限,否则会报错)
4,设置ssl: [iyunv@localhost certs]# vim/etc/httpd/conf.d/ssl.conf #DocumentRoot “/var/www/html” //找到这一行,将行首的#去掉
5,重新启动http服务,使ssl生效:
6,安装mod_ssl 因为此安装包有依赖包关系,所以建立本地yum安装
安装: [iyunv@localhost certs]# yum -y installmod_ssl 捆绑证书文件和钥匙文件:
7,测试: 输入web服务器的ip地址,显示如下
linux的https搭建成功
|