1、詳細描述一次加密通訊的過程,結合圖示最佳。
-
單向加密:只能加密,不能解密,提取數據指紋(特征碼),來保證數據的完整性,如上圖的第二步,單向加密的協議有MD5,SHA等
-
非對稱加密:公鑰和私鑰成對出現,私鑰必須本機器保存,用公鑰加密的數據,只能使用與之配對兒的私鑰解密;反之亦然,數字簽名是私鑰加密特征碼,如上圖的第三步;實現對稱秘鑰交換,如上圖第五步
-
對稱加密:加密和解密使用同樣的秘鑰,實現數據加密,產生對稱秘鑰,如上圖的第四步
2、描述創建私有CA的過程,以及為客戶端發來的證書請求進行辦法證書
-
openssl的配置文件:/etc/pki/tls/openssl.cnf,創建所需要的文件;
[root@centos CA]# ls certs crl newcerts private [root@centos CA]# touch index.txt serial [root@centos CA]# echo "01" >serial [root@centos CA]# cat serial 01 [root@centos CA]# (umask 077;openssl genrsa -out /etc/pki/CA/private/cakey.pem 1024) Generating RSA private key, 1024 bit long modulus 私鑰cakey.pem .++++++ ....++++++
-
CA自簽證書;
[root@centos CA]# openssl req -new -x509 -key /etc/pki/CA/private/cakey.pem -days 3650 -out /etc/pki/CA/cacert.pem cacert.pem 是CA證書,內含CA公鑰
-
發證;
[root@localhost tmp]# (umask 077;openssl genrsa -out /tmp/test.key 1024) Generating RSA private key, 1024 bit long modulus .++++++ ............++++++ e is 65537 (0x10001) [root@localhost tmp]# openssl req -new -key /tmp/test.key -days 365 -out /tmp/test.csr 證書請求 [root@localhost tmp]# scp /tmp/test.csr root@192.168.40.128:/tmp/ root@192.168.40.128's password: test.csr 100% 684 0.7KB/s 00:00 [root@centos private]# openssl ca -in /tmp/test.csr -out /tmp/test.crt -days 365 Using configuration from /etc/pki/tls/openssl.cnf Check that the request matches the signature Signature ok Certificate Details: [root@centos CA]# cat index.txt serial V170604033819Z01unknown/C=CN/ST=BJ/O=BJorg/OU=BJorg/CN=centos.localhost/emailAddress=admin@bat.com 02
3、描述DNS查詢過程以及DNS服務器類別
-
DNS:域名解析系統,使用tcp/53進行區域傳輸,udp/53進行查詢操作;根域名全球13臺服務器,頂級域名(國家級cn uk… ,通用級org com net…,反向域),二級域名,三級域名
-
DNS查詢方法:遞歸查詢(要求DNS直接給出域名對應的IP),迭代查詢(通常是發生在DNS服務器間,當請求的域名不再自己所負責的解析范圍內,便開始從根迭代直到查詢到相應解析為止)
-
DNS查詢過程:Client –> hosts文件 –> DNS Service–>Local Cache –> DNS Server (recursion) –> Server Cache –> iteration(迭代) –>其他DNS服務器
-
DNS服務器類別:主DNS(維護所負責解析的域內解析庫服務器,解析庫由管理維護),從DNS(從主DNS服務器或其它的從DNS服務器那里區域傳輸一份解析庫),緩存DNS服務器(為客戶端緩存客戶端曾經查詢的記錄,找不到時,DNS服務器去迭代查詢),轉發器(當請求的DNS記錄不在自己所負責的解析區域時,交給轉發器處理,轉發器去迭代查詢)
4、搭建一套DNS服務器,負責解析magedu.com域名(自行設定主機名及IP)
(1)、能夠對一些主機名進行正向解析和逆向解析;
[root@centos named]# host -t NS magedu.com 192.168.40.128 Using domain server: Name: 192.168.40.128 Address: 192.168.40.128#53 Aliases: magedu.com name server centos.magedu.com. [root@centos named]# host -t A www.magedu.com 192.168.40.128 Using domain server: Name: 192.168.40.128 Address: 192.168.40.128#53 Aliases: www.magedu.com has address 192.168.50.128 [root@centos named]# host -t MX mail.magedu.com 192.168.40.128 Using domain server: Name: 192.168.40.128 Address: 192.168.40.128#53 Aliases: mail.magedu.com mail is handled by 10 192.168.40.128.magedu.com. [root@centos named]# host -t CNAME test.magedu.com 192.168.40.128 Using domain server: Name: 192.168.40.128 Address: 192.168.40.128#53 Aliases: test.magedu.com is an alias for www.magedu.com. [root@centos named]# host -t PTR 192.168.50.128 192.168.40.128 Using domain server: Name: 192.168.40.128 Address: 192.168.40.128#53 Aliases: 128.50.168.192.in-addr.arpa domain name pointer test.magedu.com. [root@centos named]# cat /etc/named.conf options { listen-on port 53 { 192.168.40.128; }; directory "/var/named"; dump-file "/var/named/data/cache_dump.db"; statistics-file "/var/named/data/named_stats.txt"; memstatistics-file "/var/named/data/named_mem_stats.txt"; recursion yes; /* Path to ISC DLV key */ bindkeys-file "/etc/named.iscdlv.key"; managed-keys-directory "/var/named/dynamic"; }; logging { channel default_debug { file "data/named.run"; severity dynamic; }; }; zone "." IN { type hint; file "named.ca"; }; zone "magedu.com" IN { type master; file "magedu.com.file"; }; include "/etc/named.rfc1912.zones"; include "/etc/named.root.key"; [root@centos named]# cat /var/named/magedu.com.file $TTL 1D $ORIGIN magedu.com. @IN SOA centos.magedu.com. admin.magedu.com. ( 20168102053; serial 1D; refresh 1H; retry 1W; expire 3H ); minimum IN NS centos mail IN MX 10 192.168.40.128 centosIN A192.168.40.128 mail IN A 192.168.40.128 www IN A 192.168.50.128 test1 IN A 192.168.60.128 test IN CNAME www [root@centos named]# cat /var/named/50.168.192.arpa.file $TTL 1D @IN SOA centos.magedu.com admin.magedu.com. ( 201608102205; serial 1D; refresh 1H; retry 1W; expire 3H ); minimum IN NScentos.magedu.com. 128 IN PTR test.magedu.com.
(2)、對子域cdn.magedu.com進行子域授權,子域負責解析對應子域中的主機名;
-
主域需要在(1)的基礎上添加子域的NS記錄并注釋掉主域的 /etc/named.conf 的
//include "/etc/named.root.key"; IN NS centos cdn.magedu.com. IN NS centos.cdn.magedu.com. 子域名稱服務器 centos.cdn.magedu.com. IN A 192.168.40.130 子域名稱服務器主機記錄 mail IN MX 10 192.168.40.128 centos IN A 192.168.40.128 mail IN A 192.168.40.128 www IN A 192.168.50.128 test1 IN A 192.168.60.128 test IN CNAME www
-
子域注釋掉主配置文件的include "/etc/named.root.key";,添加 轉發主域區域,正常配置自己的區域解析數據庫文件即可
zone "magedu.com" IN { type forward; forwarders{192.168.40.128;}; };
-
測試
[root@centos ~]# host -t A www.magedu.com 192.168.40.130 使用子域DNS解析父域域名 Using domain server: Name: 192.168.40.130 Address: 192.168.40.130#53 Aliases: www.magedu.com has address 192.168.50.128 [root@centos ~]# host -t A www.cdn.magedu.com 192.168.40.130 使用子域解析自己區域的主機記錄 Using domain server: Name: 192.168.40.130 Address: 192.168.40.130#53 Aliases: www.cdn.magedu.com has address 119.20.20.20 [root@centos ~]# host -t A www.cdn.magedu.com 192.168.40.128 使用父域DNS解析子域域名 Using domain server: Name: 192.168.40.128 Address: 192.168.40.128#53 Aliases: www.cdn.magedu.com has address 119.20.20.20
(3)、為了保證DNS服務系統的高可用性,請設計一套方案,并寫出詳細的實施過程
為了實現DNS服務系統的高可用性建議搭建一主多從,一主一從,下面是一主一從實施過程:
-
假設192.168.30.128為主DNS為magedu.com提供域名解析服務,構建主DNS服務器
zone "magedu.com" IN { type master; file "magedu.com.file"; }; [root@centos ~]# cat /var/named/magedu.com.file $TTL 1D $ORIGIN magedu.com. @IN SOA centos.magedu.com. admin.magedu.com. ( 20168102053; serial 1D; refresh 1H; retry 1W; expire 3H ); minimum IN NS centos cdn.magedu.com. IN NS centos.cdn.magedu.com. centos.cdn.magedu.com. IN A 192.168.40.130 mail IN MX 10 192.168.40.128 centosIN A192.168.40.128 mail IN A 192.168.40.128 www IN A 192.168.50.128 test1 IN A 192.168.60.128 test IN CNAME www
-
假設192.168.30.130為主DNS為magedu.com提供域名解析服務,構建從DNS服務器
zone "magedu.com" IN { type slave; masters {192.168.40.128;}; file "slaves/slave.magedu.com.file"; 自動在主DNS服務器下載解析庫文件 }; [root@centos slaves]# ls slave.magedu.com.file [root@centos slaves]# cat slave.magedu.com.file $ORIGIN . $TTL 86400; 1 day magedu.comIN SOAcentos.magedu.com. admin.magedu.com. ( 2988232869 ; serial 86400 ; refresh (1 day) 3600 ; retry (1 hour) 604800 ; expire (1 week) 10800 ; minimum (3 hours) ) NScentos.magedu.com. $ORIGIN magedu.com. cdnNScentos.cdn $ORIGIN cdn.magedu.com. centosA192.168.40.130 $ORIGIN magedu.com. centosA192.168.40.128 mailA192.168.40.128 MX10 192.168.40.128 testCNAMEwww test1A192.168.60.128 wwwA192.168.50.128
-
測試使用192.168.40.130
[root@centos slaves]# vim /etc/resolv.conf [root@centos slaves]# cat /etc/resolv.conf # Generated by NetworkManager nameserver 192.168.40.128 主DNS nameserver 192.168.40.130 從DNS [root@centos slaves]# host -t A www.magedu.com www.magedu.com has address 192.168.50.128 [root@centos ~]# service named stop Stopping named: [ OK ] 關閉主DNS服務 [root@centos slaves]# host -t A www.magedu.com www.magedu.com has address 192.168.50.128 [root@centos slaves]# host -t A www.magedu.com www.magedu.com has address 192.168.50.128
原創文章,作者:Snoo,如若轉載,請注明出處:http://www.www58058.com/31955
寫的很好,排版也很棒,加油