1、详细描述一次加密通讯的过程,结合图示最佳。
2、描述创建私有CA的过程,以及为客户端发来的证书请求进行办法证书。
以下操作使用的2台服务器完成:
服务器 | 主机名 | IP |
CA服务器 | ca | 192.168.2.30 |
httpd服务器 | httpd | 192.168.2.80 |
在CA服务器上操作:
创建所需要的文件
[root@ca ~]# cd /etc/pki/CA/ #进入/etc/pki/CA/目录下 [root@ca CA]# pwd /etc/pki/CA [root@ca CA]# touch index.txt #创建文件 [root@ca CA]# echo 01 > serial [root@ca CA]# ls #查看创建的二个文件 certs crl index.txt newcerts private serial
创建CA私钥文件
[root@ca CA]# (umask 077; openssl genrsa -out private/cakey.pem 2048) Generating RSA private key, 2048 bit long modulus .......................+++ ..............................+++ e is 65537 (0x10001)
创建自签名证书
参数描述:
-new:生成新证书签署请求
-x509:生成自签证书
-key:生成请求时用到的私钥文件
-days:证书的有效期限
-out /PATH/TO/SOMECERTFILE:证书的保存路径
[root@ca CA]# openssl req -new -x509 -key private/cakey.pem -days 7300 -out cacert.pem 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) [XX]:CN #依次填写国家地区等信息 State or Province Name (full name) []:Beijing Locality Name (eg, city) [Default City]:Beijing Organization Name (eg, company) [Default Company Ltd]:Zhaodongwei Organizational Unit Name (eg, section) []:Ops Common Name (eg, your name or your server's hostname) []:ca Email Address []:342076957@qq.com [root@ca CA]# ll total 24 -rw-r--r-- 1 root root 1399 Nov 11 09:58 cacert.pem drwxr-xr-x. 2 root root 4096 May 9 2016 certs drwxr-xr-x. 2 root root 4096 May 9 2016 crl -rw-r--r-- 1 root root 0 Nov 11 09:34 index.txt drwxr-xr-x. 2 root root 4096 May 9 2016 newcerts drwx------. 2 root root 4096 Nov 11 09:41 private -rw-r--r-- 1 root root 3 Nov 11 09:39 serial
在httpd服务器上操作
在需要证书的http服务器上生成私钥文件
[root@httpd ~]# mkdir /etc/httpd/ssl [root@httpd ~]# cd /etc/httpd/ssl/ [root@httpd ssl]# pwd /etc/httpd/ssl [root@httpd ssl]# (umask 077; openssl genrsa -out /etc/httpd/ssl/httpd.key 2048) Generating RSA private key, 2048 bit long modulus .......................................................+++ .................................................................+++ e is 65537 (0x10001)
创建证书请求
[root@httpd ssl]# openssl req -new -key httpd.key -days 365 -out httpd.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) [XX]:CN State or Province Name (full name) []:Beijing Locality Name (eg, city) [Default City]:Beijing Organization Name (eg, company) [Default Company Ltd]:Zhaodongwei Organizational Unit Name (eg, section) []:Ops Common Name (eg, your name or your server's hostname) []:www.magedu.com Email Address []:333@magedu.com Please enter the following 'extra' attributes to be sent with your certificate request A challenge password []:cix123@ An optional company name []:cix123@
将请求文件传给CA服务器
[root@httpd ssl]# /usr/bin/scp httpd.csr root@192.168.2.30:/tmp #出现下面的错误是因为对方没有安装scp命令 root@192.168.2.30's password: bash: scp: command not found lost connection [root@ca CA]# yum install openssh-clients -y #在CA上安装scp [root@httpd ssl]# scp httpd.csr root@192.168.2.30:/tmp #再次传输,已成功 root@192.168.2.30's password: httpd.csr 100% 1123 1.1KB/s 00:00 [root@httpd ssl]#
在CA服务器上操作
签署CA证书
[root@ca CA]# ls /tmp/ httpd.csr yum.log [root@ca CA]# openssl ca -in /tmp/httpd.csr -out /tmp/httpd.crt -days 365 Using configuration from /etc/pki/tls/openssl.cnf Check that the request matches the signature Signature ok Certificate Details: Serial Number: 1 (0x1) Validity Not Before: Nov 11 03:41:24 2016 GMT Not After : Nov 11 03:41:24 2017 GMT Subject: countryName = CN stateOrProvinceName = Beijing organizationName = Zhaodongwei organizationalUnitName = Ops commonName = www.magedu.com emailAddress = 333@magedu.com X509v3 extensions: X509v3 Basic Constraints: CA:FALSE Netscape Comment: OpenSSL Generated Certificate X509v3 Subject Key Identifier: 2F:D3:DB:9C:2D:4B:7D:77:F4:F1:A0:8A:53:D8:87:34:C2:D0:63:32 X509v3 Authority Key Identifier: keyid:95:86:1C:EA:BF:C2:4C:24:D6:27:51:BC:46:38:80:74:50:BB:28:82 Certificate is to be certified until Nov 11 03:41:24 2017 GMT (365 days) Sign the certificate? [y/n]:y 1 out of 1 certificate requests certified, commit? [y/n]y Write out database with 1 new entries Data Base Updated
将签署过的证书发到请求证书的httpd服务器
[root@ca CA]# ls /tmp/ httpd.crt httpd.csr .ICE-unix/ yum.log [root@ca CA]# scp /tmp/httpd.crt root@192.168.2.80:/etc/httpd/ssl/ The authenticity of host '192.168.2.80 (192.168.2.80)' can't be established. RSA key fingerprint is 39:44:7a:5c:7f:ac:64:dd:01:09:89:2d:b0:79:9d:1f. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '192.168.2.80' (RSA) to the list of known hosts. root@192.168.2.80's password: httpd.crt 100% 4597 4.5KB/s 00:00 [root@ca CA]#
至此完成全部操作
3、搭建一套DNS服务器,负责解析magedu.com域名(自行设定主机名及IP)
(1)、能够对一些主机名进行正向解析和逆向解析;
(2)、对子域cdn.magedu.com进行子域授权,子域负责解析对应子域中的主机名;
(3)、为了保证DNS服务系统的高可用性,请设计一套方案,并写出详细的实施过程
4、请描述一次完整的http请求处理过程;
(1)建立或处理连接:接收请求或拒绝请求
(2)接收请求:
接收来自于网络的请求报文中对某资源的一次请求过程;
并发访问响应模型(Web I/O);
单进程I/O结构:启动一个进程处理用户请求,而且一次只处理一个,多个请求被串行响应;
多进程I/O结构:并行启动多个进程,每个进程响应一个请求;
复用I/O结构:一个进程响应n个请求;
事线程模型:一个进程生成N个线程,每个线程响应一个用户请求;
事件驱动:event-dirven
复用的多进程I/O结构:启动多个(m)进程,每个进程响应n个请求;
(3)处理请求:对请求报文进行解析,并获取请求的资源及请求方法等相关信息
元数据:请求报文首部
<methon><URL><VERSION>
Host:www.magedu.com 请求的主机名称
Connection
(4)访问资源:获取请求报文中的请求的资源
web服务器,即存放了web资源的服务器,负责向请求者提供对方请求的静态资源,或动态运行后生成的资源,这些资源放置于本地文件系统某路径下,此路径通常称为DocRoot
/var/www/html/
p_w_picpaths/1.jpg
http://www.magedu.com/p_w_picpaths/1.jpg
web服务器资源路径映射方式:
(a)docroot
(b)alias
(c)虚拟机docroot
(d)用户家目录docroot
(5)构建响应报文
资源的MIME类型:
显式分类
魔法分类
协商分类
(6)发送响应报文
(7)记录日志
5、httpd所支持的处理模型有哪些,他们的分别使用于哪些环境。
httpd处理模型包括:prefork、worker、event
prefork:多进程模型,每个进程响应一个请求。
一个主进程;负责生成n个子进程,子进程也称为工作进程,每个子进程处理一个用户的请求。即使没有用户请求,也会预先生成多个空闲进程,随时等待请求到达,最大不会超过1024个。
worker:多线程模型,每个线程响应一个请求
一个主进程;生成多个子进程,每个子进程负责生成多个线程,每个线程响应一个请求;
m进程,n线程:m*n个请求
event:事件驱动模型,每个线程响应n个请求
一个主进程;生成m个子进程,每个子进程可以响应n个请求;
m*n
6、建立httpd服务器(基于编译的方式进行),要求:
提供两个基于名称的虚拟主机:
(a)www1.stuX.com,页面文件目录为/web/vhosts/www1;错误日志为/var/log/httpd/www1.err,访问日志为/var/log/httpd/www1.access;
(b)www2.stuX.com,页面文件目录为/web/vhosts/www2;错误日志为/var/log/httpd/www2.err,访问日志为/var/log/httpd/www2.access;
(c)为两个虚拟主机建立各自的主页文件index.html,内容分别为其对应的主机名;
(d)通过www1.stuX.com/server-status输出httpd工作状态相关信息,且只允许提供帐号密码才能访问(status:status);
7、为第6题中的第2个虚拟主机提供https服务,使得用户可以通过https安全的访问此web站点;
(1)要求使用证书认证,证书中要求使用的国家(CN)、州(HA)、城市(ZZ)和组织(MageEdu);
(2)设置部门为Ops,主机名为www2.stuX.com,邮件为admin@stuX.com;
8、建立samba共享,共享目录为/data,要求:(描述完整的过程)
1)共享名为shared,工作组为magedu;
2)添加组develop,添加用户gentoo,centos和ubuntu,其中gentoo和centos以develop为附加组,ubuntu不属于develop组;密码均为用户名;
3)添加samba用户gentoo,centos和ubuntu,密码均为“mageedu”;
4)此samba共享shared仅允许develop组具有写权限,其他用户只能以只读方式访问;
5)此samba共享服务仅允许来自于172.16.0.0/16网络的主机访问;
9、搭建一套文件vsftp文件共享服务,共享目录为/ftproot,要求:(描述完整的过程)
1)基于虚拟用户的访问形式;
2)匿名用户只允许下载,不允许上传;
3)禁锢所有的用户于其家目录当中;
4)限制最大并发连接数为200:;
5)匿名用户的最大传输速率512KB/s
6)虚拟用户的账号存储在mysql数据库当中。
7)数据库通过NFS进行共享。
转载于:https://blog.51cto.com/zhaodongwei/1867690