當前位置:九游会j9娱乐平台-九游ag登录中心网址 » 雲伺服器 » linuxca伺服器搭建

linuxca伺服器搭建-九游会j9娱乐平台

發布時間: 2024-07-11 01:15:00

① 如何生成ca證書

如何生成ca證書

一般情況下,如果能找到可用的證書,就可以直接使用,只不過會因證書的某些信息不正確或與部署證書的主機不匹配而導致瀏覽器提示證書無效,但這並不影響使用。

需要手工生成證書的情況有:

找不到可用的證書
需要配置雙向ssl,但缺少客戶端證書
需要對證書作特別的定製
首先,無論是在linux下還是在windows下的cygwin中,進行下面的操作前都須確認已安裝openssl軟體包。

1. 創建根證書密鑰文件(自己做ca)root.key:

openssl genrsa -des3 -out root.key

輸出內容為:

[lenin@archer ~]$ openssl genrsa -des3 -out root.key
generating rsa private key, 512 bit long molus
……………..
..
e is 65537 (0×10001)
enter pass phrase for root.key: ← 輸入一個新密碼
verifying – enter pass phrase for root.key: ← 重新輸入一遍密碼

2. 創建根證書的申請文件root.csr:

openssl req -new -key root.key -out root.csr

輸出內容為:

[lenin@archer ~]$ openssl req -new -key root.key -out root.csr
enter pass phrase for root.key: ← 輸入前面創建的密碼
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) [au]:cn ← 國家代號,中國輸入cn
state or province name (full name) [some-state]:beijing ← 省的全名,拼音
locality name (eg, city) []:beijing ← 市的全名,拼音
organization name (eg, company) [internet widgits pty ltd]:mycompany corp. ← 公司英文名
organizational unit name (eg, section) []: ← 可以不輸入
common name (eg, your name) []: ← 此時不輸入
email address []:[email protected] ← 電子郵箱,可隨意填

please enter the following 『extra』 attributes
to be sent with your certificate request
a challenge password []: ← 可以不輸入
an optional company name []: ← 可以不輸入

3. 創建一個自當前日期起為期十年的根證書root.crt:

openssl x509 -req -days 3650 -sha1 -extensions v3_ca -signkey root.key -in root.req -out root.crt

輸出內容為:

[lenin@archer ~]$ openssl x509 -req -days 3650 -sha1 -extensions v3_ca -signkey root.key -in root.csr -out root.crt
signature ok
subject=/c=cn/st=beijing/l=beijing/o=mycompany corp./[email protected]
getting private key
enter pass phrase for root.key: ← 輸入前面創建的密碼

4. 創建伺服器證書密鑰server.key:

openssl genrsa –des3 -out server.key 2048

輸出內容為:

[lenin@archer ~]$ openssl genrsa -out server.key 2048
generating rsa private key, 2048 bit long molus
….
…………………………………………..
e is 65537 (0×10001)

運行時會提示輸入密碼,此密碼用於加密key文件(參數des3便是指加密演算法,當然也可以選用其他你認為安全的演算法.),以後每當需讀取此文件(通過openssl提供的命令或api)都需輸入口令.如果覺得不方便,也可以去除這個口令,但一定要採取其他的保護措施!
去除key文件口令的命令:
openssl rsa -in server.key -out server.key

5.創建伺服器證書的申請文件server.csr:

openssl req -new -key server.key -out server.csr

輸出內容為:

[lenin@archer ~]$ openssl req -new -key server.key -out server.req
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) [au]:cn ← 國家名稱,中國輸入cn
state or province name (full name) [some-state]:beijing ← 省名,拼音
locality name (eg, city) []:beijing ← 市名,拼音
organization name (eg, company) [internet widgits pty ltd]:mycompany corp. ← 公司英文名
organizational unit name (eg, section) []: ← 可以不輸入
common name (eg, your name) []:www.mycompany.com ← 伺服器主機名,若填寫不正確,瀏覽器會報告證書無效,但並不影響使用
email address []:[email protected] ← 電子郵箱,可隨便填

please enter the following 『extra』 attributes
to be sent with your certificate request
a challenge password []: ← 可以不輸入
an optional company name []: ← 可以不輸入

6. 創建自當前日期起有效期為期兩年的伺服器證書server.crt:

openssl x509 -req -days 730 -sha1 -extensions v3_req -ca root.crt -cakey root.key -caserial root.srl -cacreateserial -in server.csr -out server.crt

輸出內容為:

[lenin@archer ~]$ openssl x509 -req -days 730 -sha1 -extensions v3_req -ca root.crt -cakey root.key -cacreateserial -in server.csr -out server.crt
signature ok
subject=/c=cn/st=beijing/l=beijing/o=mycompany corp./cn=www.mycompany.com/[email protected]
getting ca private key
enter pass phrase for root.key: ← 輸入前面創建的密碼

7. 創建客戶端證書密鑰文件client.key:

openssl genrsa -des3 -out client.key 2048

輸出內容為:

[lenin@archer ~]$ openssl genrsa -des3 -out client.key 2048
generating rsa private key, 2048 bit long molus
……………………………………………………………………………..
……………………………………………………………………………………………………….
e is 65537 (0×10001)
enter pass phrase for client.key: ← 輸入一個新密碼
verifying – enter pass phrase for client.key: ← 重新輸入一遍密碼

8. 創建客戶端證書的申請文件client.csr:

openssl req -new -key client.key -out client.csr

輸出內容為:

[lenin@archer ~]$ openssl req -new -key client.key -out client.csr
enter pass phrase for client.key: ← 輸入上一步中創建的密碼
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) [au]:cn ← 國家名稱,中國輸入cn
state or province name (full name) [some-state]:beijing ← 省名稱,拼音
locality name (eg, city) []:beijing ← 市名稱,拼音
organization name (eg, company) [internet widgits pty ltd]:mycompany corp. ← 公司英文名
organizational unit name (eg, section) []: ← 可以不填
common name (eg, your name) []:lenin ← 自己的英文名,可以隨便填
email address []:[email protected] ← 電子郵箱,可以隨便填

please enter the following 『extra』 attributes
to be sent with your certificate request
a challenge password []: ← 可以不填
an optional company name []: ← 可以不填

9. 創建一個自當前日期起有效期為兩年的客戶端證書client.crt:

openssl x509 -req -days 730 -sha1 -extensions v3_req -ca root.crt -cakey root.key -caserial root.srl -cacreateserial -in client.csr -out client.crt

輸出內容為:

[lenin@archer ~]$ openssl x509 -req -days 730 -sha1 -extensions v3_req -ca root.crt -cakey root.key -cacreateserial -in client.csr -out client.crt
signature ok
subject=/c=cn/st=beijing/l=beijing/o=mycompany corp./cn=www.mycompany.com/[email protected]
getting ca private key
enter pass phrase for root.key: ← 輸入上面創建的密碼

10. 將客戶端證書文件client.crt和客戶端證書密鑰文件client.key合並成客戶端證書安裝包client.pfx:

openssl pkcs12 -export -in client.crt -inkey client.key -out client.pfx

輸出內容為:

[lenin@archer ~]$ openssl pkcs12 -export -in client.crt -inkey client.key -out client.pfx
enter pass phrase for client.key: ← 輸入上面創建的密碼
enter export password: ← 輸入一個新的密碼,用作客戶端證書的保護密碼,在客戶端安裝證書時需要輸入此密碼
verifying – enter export password: ← 確認密碼

11. 保存生成的文件備用,其中server.crt和server.key是配置單向ssl時需要使用的證書文件,client.crt是配置雙向ssl時需要使用的證書文件,client.pfx是配置雙向ssl時需要客戶端安裝的證書文件

.crt文件和.key可以合到一個文件裡面,把2個文件合成了一個.pem文件(直接拷貝過去就行了)

參考:http://sinolog.it/?p=1460

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

http://blog.sina.com.cn/s/blog_4fd50c390101891c.html

x509證書一般會用到三類文,key,csr,crt。

key是私用密鑰openssl格,通常是rsa演算法。

csr是證書請求文件,用於申請證書。在製作csr文件的時,必須使用自己的私鑰來簽署申,還可以設定一個密鑰。

crt是ca認證後的證書文,(windows下面的,其實是crt),簽署人用自己的key給你簽署的憑證。

1.key的生成

opensslgenrsa -des3 -out server.key 2048

這樣是生成rsa私鑰,des3演算法,openssl格式,2048位強度。server.key是密鑰文件名。為了生成這樣的密鑰,需要一個至少四位的密碼。可以通過以下方法生成沒有密碼的key:

opensslrsa -in server.key -out server.key

server.key就是沒有密碼的版本了。

2.生成ca的crt

opensslreq -new -x509 -key server.key -out ca.crt -days3650

生成的ca.crt文件是用來簽署下面的server.csr文件。

3.csr的生成方法

opensslreq -new -key server.key -outserver.csr

需要依次輸入國家,地區,組織,email。最重要的是有一個common name,可以寫你的名字或者域名。如果為了https申請,這個必須和域名吻合,否則會引發瀏覽器警報。生成的csr文件交給ca簽名後形成服務端自己的證書。

4.crt生成方法

csr文件必須有ca的簽名才可形成證書,可將此文件發送到verisign等地方由它驗證,要交一大筆錢,何不自己做ca呢。

opensslx509 -req -days 3650 -in server.csr -ca ca.crt -cakey server.key-cacreateserial -out server.crt

輸入key的密鑰後,完成證書生成。-ca選項指明用於被簽名的csr證書,-cakey選項指明用於簽名的密鑰,-caserial指明序列號文件,而-cacreateserial指明文件不存在時自動生成。

最後生成了私用密鑰:server.key和自己認證的ssl證書:server.crt

證書合並:

catserver.key server.crt > server.pem

② linux伺服器ssl怎麼配置證書

一、安裝ssl准備

1.安裝openssl

要使apache支持ssl,需要首先安裝openssl支持。openssl下載地址http://www.openssl.org/source/

2.安裝apache

二、申請ssl證書

去沃通ca的官網www.wosign.com去申請一張ev ssl證書。

三、安裝ssl證書

四、測試安裝結果

訪問https:// 證書綁定的域名,測試效果如下


更多關於apache部署ssl證書相關問題請查看ssl證書部署指南網頁鏈接或者在線咨詢沃通ca ssl證書部署技術支持,也可移步沃通ssl證書論壇提交問題。

③ mysql linux安裝教程

在 linux 上安裝 mysql 的步驟如下。這里我們以 ubuntu 為例,但是這些步驟應該適用於大多數 linux 發行版。

1. 添加 mysql 倉庫

在大多數 linux 發行版上,你可以使用包管理器(如 apt、yum 或 dnf)來安裝 mysql。首先,你需要添加 mysql 的官簡早方 gpg 密鑰和 apt 倉庫。打開終端並輸入以下命令:

```
sudo apt update
sudo apt install \
apt-transport-https \
ca-certificates \培州
curl \
gnupg \
lsb-release
```

2. 添加 mysql 存儲

在添加 mysql 官方 gpg 密鑰後,你需要添加 mysql apt 倉庫。輸入以下命令:

```
curl -fssl ***
```

3. 安裝 mysql

安裝完成後,更新並安裝 mysql 伺服器:

```
sudo apt update
sudo apt install mysql-server
```

這將下載並安裝 mysql 伺服器。在安裝過程中,你需要提供一個強密碼,並確認攔中雀是否啟用安全套接字層(ssl)連接。

4. 驗證安裝

安裝完成後,檢查 mysql 伺服器是否正在運行:

```
sudo systemctl status mysql
```

如果伺服器正在運行,輸出應類似於:

```
● mysql.service - mysql server
loaded: loaded (/lib/systemd/system/mysql.serv

④ ca證書與dhcp服務

1、創建私有ca並進行證書申請。

1 :創建 ca 私鑰

$ openssl genrsa -des3 -out ca.key 4096

2 :生成 ca 的自簽名證書,其實 ca 證書就是一個自簽名證書

$ openssl req -new -x509 -days 365 -key ca.key -outca.crt

3 :生成需要頒發證書的私鑰

$ openssl genrsa -des3 -out server.key 4096

4 :生成要頒發證書的證書簽名請求

ps:證書簽名請求當中的 common name 必須區別於 ca 的證書裡面的 common

name

$ openssl req -new -key server.key -out server.csr

5 :創建一個ext文件,內容如下

keyusage = nonrepudiation, digitalsignature,keyencipherment

extendedkeyusage = serverauth, clientauth

subjectaltname=@subjectalternativename

[ subjectalternativename ]

dns.1=abc.com

dns.2=*.abc.com

6 :用 2 創建的 ca 證書給 4 生成的 簽名請求 進行簽名

$ openssl x509 -req -days 365 -extfile http.ext -inserver.csr -ca ca.crt -cakey ca.key -set_serial 01 -out server.crt

7 :最終會得到一下幾個文件

ca.crt: 這個是ca證書,客戶端信任該證書意味著會信任該證書頒發出去的所有證書

ca.key: ca證書的密鑰

server.key: 伺服器密鑰,需要配置的

server.csr: 證書簽名請求,通常是交給ca機構,這里我們就自己解決了

server.crt: 伺服器證書,需要配置的

2、總結ssh常用參數、用法

ssh命令是ssh客戶端,允許實現對遠程系統經驗證地加密安全訪問。ssh客戶端配置文件是:/etc/ssh/ssh_config

ssh

命令配合的常見選項:

-p port

:遠程伺服器監聽的埠

ssh 192.168.1.8 -p 2222

-b

指定連接的源ip

ssh 192.168.1.8 -p 2222 -b 192.168.1.88

-v

調試模式

ssh 192.168.1.8 -p 2222 -v

-c

壓縮方式

-x

支持x11轉發支持將遠程linux主機上的圖形工具在當前設備使用

-t

強制偽tty分配,如:ssh -t remoteserver1 ssh -t remoteserver2 ssh

remoteserver3

-o option

如:-ostricthostkeychecking=no

-i

指定私鑰文件路徑,實現基於key驗證,默認使用文件:~/.ssh/id_dsa,

~/.ssh/id_ecdsa,/.ssh/id_ed25519

,/.ssh/id_rsa等

3、總結sshd服務常用參數。伺服器端的配置文件: /etc/ssh/sshd_config

常用參數:

port #

埠號

listenaddress iplogingracetime 2m #

寬限期

permitrootlogin yes #

默認ubuntu不允許root遠程ssh登錄

strictmodes yes #

檢查.ssh/文件的所有者,許可權等

maxauthtries 6

maxsessions 10 #

同一個連接最大會話

pubkeyauthentication yes #

基於key驗證

permitemptypasswords no #

空密碼連接

passwordauthentication yes #

基於用戶名和密碼連接

gatewayports no

clientaliveinterval 10 #

單位:秒

clientalivecountmax 3 #

默認3

usedns yes #

提高速度可改為no

gssapiauthentication yes #

提高速度可改為no

maxstartups #

未認證連接最大值,默認值10

banner /path/file

以下可以限制可登錄用戶的辦法:

allowusers user1 user2 user3

denyusers

allowgroups

ssh

服務的最佳實踐建議使用非默認埠禁止使用protocol version 1

限制可登錄用戶設定空閑會話超時時長利用防火牆設置ssh訪問策略僅監聽特定的ip地址基於口令認證時,使用強密碼策略,比如:tr -dc a-za-z0-9_ < /dev/urandom| head -c 12|

xargs

使用基於密鑰的認證禁止使用空密碼禁止root用戶直接登錄限制ssh的訪問頻度和並發在線數經常分析日誌

4、搭建dhcp服務,實現ip地址申請分發

一、配置dhcp伺服器

1、安裝dhcp伺服器軟體

[root@centos01 ~]# mount /dev/cdrom /mnt/

mount: /dev/sr0 防寫,將以只讀方式掛載

[root@centos01 ~]# rm -rf /etc/yum.repos.d/centos-*

[root@centos01 ~]# yum -y install dhcp

2、建立主配置文件dhcpd.conf

[root@centos01 ~]# vim /etc/dhcp/dhcpd.conf

:r /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example

ddns-update-style none;

option domain-name "benet.com";

option domain-name-servers 202.106.0.10, 202.106.0.20; 



default-lease-time 600;

max-lease-time 7200;

1)/etc/dhcp/dhcpd.conf文件的配置構成

在主配置文件dhcpd.conf中,可以使用聲明、參數、選項這三種類型的配置,各自的作用和表現形式如下所述:

聲明:用來描述dhcpd伺服器中對網路布局的劃分,是網路設置的邏輯范圍。常見的聲明是subnet、host,其中subnet聲明用來約束一個網段。host聲明用來約束一台特定主機。

參數:由配置關鍵字和對應的值組成,總是以「;」(分號)結束,一般位於指定的聲明範圍之內,用來設置所在范圍的運行特性(如默認租約時間、最大租約時間等)。

選項:由「option」引導,後面跟具體的配置關鍵字和對應的值,也是以「;」結束,用於指定分配給客戶機的各種地址參數(如默認網關地址、子網掩碼、dns伺服器地址等)。

2)確定dhcpd服務的全局配置

為了使配置文件的結構更加清晰、全局配置通常會放在配置文件dhcod.conf的開頭部分,可以是配置參數,也可以是配置選項。常用的全局配置參數和選項如下所述:

ddns-update-style:動態dns更新模式。用來設置與dhcp服務相關聯的dns數據動態更新模式。在實際的dhcp應用中很少用到該參數。將值設為「none」即可。

default-lease-time:默認租約時間。單位為秒,表示客戶端可以從dhcp伺服器租用某個ip地址的默認時間。

max-lease-time:最大租約時間。單位為秒,表示允許dhcp客戶端請求的最大租約時間,當客戶端未請求明確的租約時間時,伺服器將採用默認租約時間。

option domain-name:默認搜索區域。未客戶機指定解析主機名時的默認搜索域,該配置選項將體現在客戶機的/etc/resolv.conf配置文件中,如「search benet.com」。

option domain-name-servers:dns伺服器地址。為客戶端指定解析域名時使用的dns伺服器地址,該配置選項同樣將體現在客戶機的/etc/resolv.conf配置文件中,如「nameserver 202.106.0.20」。需要設置多個dns伺服器地址時,以逗號進行分隔。

3)確定subnet網段聲明

一台dhcp伺服器可以為多個網段提供服務,因此subnet網段聲明必須有而且可以有多個。例如,若要dhcp伺服器為192.168.100.0/24網段提供服務,用於自動分配的ip地址范圍為192.168.100。100~192.168.100.200,為客戶機指定默認網關地址為192.168.100.254,則ke可以修改dhcpd.conf配置文件,參考以下內容調整subnet網段聲明:

[root@centos01 ~]# vim /etc/dhcp/dhcpd.conf

subnet 192.168.100.0 netmask 255.255.255.0 {

range 192.168.100.100 192.168.100.200;

option routers 192.168.100.254;

}

4)確定host主機聲明

host聲明用於設置單個主機的網路屬性,通常用於為網路列印機或個別伺服器分配固定的ip地址(保留地址),這些主機的共同特點是要求每次獲取的ip地址相同,以確保服務的穩定性。

host聲明通過host關鍵字指定需要使用保留地址的客戶機名稱,並使用「hardware ethernet」參數指定該主機的mac地址,使用「fixed-address」參數指定保留給該主機的ip地址。例如,若要為列印機prtsvr(mac地址為00:0c:29:0d:ba:6b)分配固定的ip地址192.168.100.101,可以修改dhcpd.conf配置文件,參考以下內容在網段聲明內添加host主機聲明。

c:\users\administrator>getmac

物理地址            傳輸名稱

=================== =======================================================

00-0c-29-0d-ba-6b  \device\tcpip_{92e3f48b-40f0-4a0d-9604-6386aaae3233}

[root@centos01 ~]# vim /etc/dhcp/dhcpd.conf

host win7 {

hardware ethernet 00:0c:29:0d:ba:6b;

fixed-address 192.168.100.101;

}

3、啟動dhcpd服務

在啟動dhcpd服務之前,應確認提供dhcp伺服器的網路介面具有靜態指定的固定ip地址,並且至少有一個網路介面的ip地址與dhcp伺服器中的一個subnet網段相對應,否則將無法正常啟動dhcpd服務。例如,dhcp伺服器的ip地址為192.168.100.10,用於為網段192。168.100.0/24內的其他客戶機提供自動分配地址服務。

安裝dhcp軟體包以後,對應的系統服務腳本位於/usr/lib/systemd/system/dhcpd.service,可以使用systemd服務進行控制。例如,執行以下操作可以啟動dhcpd服務,並檢查udp的67埠是否在監聽,以確認dhcp伺服器是否正常。

[root@centos01 ~]# systemctl start dhcpd

[root@centos01 ~]# systemctl enable dhcpd

[root@centos01 ~]# netstat -anptu | grep 67

udp        0      0 0.0.0.0:67              0.0.0.0:*                          2102/dhcpd         

udp        0      0 0.0.0.0:67              0.0.0.0:*                          1064/dnsmasq       

注意:需要關閉、重啟dhcpd服務時,只要將上述操作命令中的「start」改為「stop」或「restart」即可。

二、使用dhcp客戶端

1、windows客戶端

ipconfig /renew

ipconfig /release

tracert ip地址

route print

2、linux客戶端

在linux客戶機中可以設置使用dhcp的方式獲取地址。只需要編輯對應網卡的配置文件,修改或添加「bootproto=dhcp」配置行,並重新載入配置文件或者重新啟動network服務即可。例如,執行以下操作可修改網卡配置文件,並重新載入配置以通過dhcp方式自動獲取地址:

[root@centos02 ~]# vim /etc/sysconfig/network-scripts/ifcfg-ens32

type=ethernet

proxy_method=none

browser_only=no

bootproto=dhcp

defroute=yes

name=ens32

device=ens32

onboot=yes

[root@centos02 ~]# ifdown ens32 ; ifup ens32

[root@centos02 ~]# systemctl restart network

在linux客戶機中,還可以使用dhclient工具來測試dhcp伺服器。若直接執行「dhclient」命令,則dhclient將嘗試為除回環介面lo以外的所有網路介面通過dhcp方式申請新的地址,然後自動轉入後台繼續運行。當然,測試時可以指定一個具體的網路介面,並結合「-d」選項使其在前台運行,測試完畢後按ctrl c組合鍵終止。例如,執行「dhclient -d ens32」命令後,可以為網卡ens32自動獲取新的ip地址,並顯示獲取過程。

[root@centos02 ~]# dhclient -d ens32

internet systems consortium dhcp client 4.2.5

九游会j9娱乐平台 copyright 2004-2013 internet systems consortium.

all rights reserved.

for info, please visit https://www.isc.org/software/dhcp/

listening on lpf/ens32/00:0c:29:97:5c:9f

sending on  lpf/ens32/00:0c:29:97:5c:9f

sending on  socket/fallback

dhcpdiscover on ens32 to 255.255.255.255 port 67 interval 4 (xid=0x5364e17f)

dhcpdiscover on ens32 to 255.255.255.255 port 67 interval 6 (xid=0x5364e17f)

dhcpdiscover on ens32 to 255.255.255.255 port 67 interval 14 (xid=0x5364e17f)

dhcprequest on ens32 to 255.255.255.255 port 67 (xid=0x5364e17f)

dhcpoffer from 192.168.100.10

dhcpack from 192.168.100.10 (xid=0x5364e17f)

bound to 192.168.100.102 -- renewal in 229 seconds.

............

客戶端需要通過dhclient命令釋放獲取的ip租約時,可以結合「-r」選項。例如,執行以下的「dhclient -r ens32」將會釋放之前為網卡ens32獲取的ip租約。此時再通過執行「ifconfig ens32」命令就看不到分配的ip地址了。

[root@centos02 ~]# dhclient -r ens32

⑤ linux的ssl證書安裝步驟

互聯網的發展對網路的安全性提出了更高的要求,所以現在很多網站都配置了ssl證書。但是伺服器的種類有很多,不同的伺服器在配置ssl安全證書時,具體操作和流程也有很大的區別。除了常用的windows系統之外, linux ssl證書安裝也是很多人關注的事情。

一、創建azure key vault

創建key vault和linux安裝ssl之前,大家需要先使用az group create來創建資源。比如創建名為「myresourcegroupsecureweb」的資源組,需要先復制azure cli到對應文件夾中,然後再使用az keyvault create創建key vault,並在部署vm時啟用該key vault。

每一個key vault都需要具備唯一的名稱,而且全部都是小寫字母,然後將名稱替換為自己唯一的key vault名稱,生成證書並存儲在key vault中。為了讓網站ssl安全使用使用,大家需要在linux安裝ssl導入時由受信任的程序提供簽名才算是有效證書。

二、准備用於vm的證書

若要在vm創建過程中使用上述證書,大家需要使用az keyvault secret list-versions獲取證書的唯一id,然後再通過az vm format-secret轉換該證書。具體操作為創建cloud-init配置以保護nginx,在首次啟動vm時對其進行自定義,再通過cloud-init來安裝程序包和寫入文件,或者配置用戶和安全性。

除了在linux安裝證書初始啟動期間要運行cloud-init外,無需在進行其他的步驟和代理。創建vm、安裝程序包和啟動應用需耗時幾分鍾。創建後測試一下web應用是否安全,linux的ssl證書安裝如果使用的是自簽名的安全證書,網頁會有安全警告,提示用戶存在不安全因素。

linux的ssl證書安裝相對於其他系統來講,比較簡單。不過需要注意的是,linux安裝證書對國內和國外的網路環境有一定的設置要求,如果沒有及時更改,會造成ssl證書配置失敗。關於這方面的內容,大家可以向ca網站的專家進行進一步的咨詢了解。

本文由ssl盾我整理發布【www.ssln.com】網站安全之盾證書便宜簽發快

⑥ linux下如何配置dns伺服器,

在linux下配置dns伺服器,下面是配置過程中設置過的一些文件,

/etc/hosts 文件的具體內容如下:

# do not remove the following line, or various programs

# that require network functionality will fail.

127.0.0.1 localhost.localdomain localhost fc4

192.168.1.3 a.test.com a

192.168.1.1 b.test.cn b

/etc/host.conf 文件:

order hosts,bind

表示先用hosts文件做解析,在用dns解析

/etc/resolv.conf 文件:

; generated by networkmanager, do not edit!

search test.com

nameserver 127.0.0.1

search test.cn

nameserver 192.168.1.1

nameserver 61.144.56.100

/etc/named.conf 文件:

//

// named.conf for red hat caching-nameserver

//

options {

directory "/var/named";

mp-file "/var/named/data/cache_mp.db";

statistics-file "/var/named/data/named_stats.txt";

/*

* if there is a firewall between you and nameservers you want

* to talk to, you might need to uncomment the query-source

* directive below. previous versions of bind always asked

* questions using port 53, but bind 8.1 uses an unprivileged

* port by default.

*/

// query-source address * port 53;

};

//

// a caching only nameserver config

//

controls {

inet 127.0.0.1 allow { localhost; } keys { rndckey; };

};

zone "." in {

type hint;

file "named.ca";

};

zone "test.com"in {

type master;

file "test.com";

allow-update { none; };

};

zone "1.168.192.in-addr.arpa"in {

type master;

file "192.168.1.rev";

allow-update { none; };

};

zone "test.cn"in {

type master;

file "test.cn";

allow-update { none; };

};

zone "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" in {

type master;

file "named.ip6.local";

allow-update { none; };

};

zone "255.in-addr.arpa" in {

type master;

file "named.broadcast";

allow-update { none; };

};

zone "0.in-addr.arpa" in {

type master;

file "named.zero";

allow-update { none; };

};

include "/etc/rndc.key";

在/var/name/test.com 文件下:

$ttl 86400

@ in soa a.test.com. root.a.test.com (

42 ; serial (d. adams)

3h ; refresh

15m ; retry

1w ; expiry

1d ) ; minimum

in ns a.test.com.

in mx 10 mail.test.com.

a in a 192.168.1.3

mail in a 192.168.1.3

//其中root.a.test.com的含義是管理員的郵箱

/var/name/test.cn 文件下:

$ttl 86400

@ in soa b.test.cn. root.a.test.com (

42 ; serial (d. adams)

3h ; refresh

15m ; retry

1w ; expiry

1d ) ; minimum

in ns b.test.cn.

in mx 10 mail.test.cn.

b in a 192.168.1.1

mail in a 192.168.1.1

/var/name/192.168.1.rev 文件下:

$ttl 86400

@ in soa 1.168.192.in-addr.arpa. root.test.com. (

1997022700 ; serial

28800 ; refresh

14400 ; retry

3600000 ; expire

86400 ) ; minimum

in ns a.test.com.

in ns b.test.cn.

in mx 10 mail.test.com.

in mx 10 mail.test.cn.

3 in ptr a.test.com.

3 in ptr mail.test.com.

1 in ptr b.test.cn.

1 in ptr mail.test.cn.

然後用/etc/init.d/named restart重啟dns服務,在重啟過程中,我曾經出現過好幾次的錯誤,按照出錯的提示,會提示是named.conf文件第幾行出錯的。或者提示在那些包含文件例如test.cn這些文件裡面的問題,然後一個一個排除。

最後還有一些nslookup的命令比較有用:

set all用於顯示使用nslookup工具這台機器上的dns伺服器的一些信息

set type=any會顯示完整信息包括域中郵件伺服器和主從dns伺服器的名字和ip地址

server 192.168.0.1更換查詢的dns伺服器地址

熱點內容
仙境傳說手游腳本 發布:2024-07-17 16:09:24 瀏覽:690
matlab命令窗口和新建腳本 發布:2024-07-17 15:51:26 瀏覽:374
建ftp文件夾 發布:2024-07-17 15:51:26 瀏覽:954
魔獸撿物腳本 發布:2024-07-17 15:27:56 瀏覽:129
開發ip伺服器 發布:2024-07-17 15:24:42 瀏覽:387
安卓系統視頻製作哪個好用 發布:2024-07-17 15:10:47 瀏覽:210
androidapk結構 發布:2024-07-17 15:10:43 瀏覽:945
c語言指針的例子 發布:2024-07-17 15:08:01 瀏覽:768
linuxzcat 發布:2024-07-17 15:02:09 瀏覽:901
賓士編程嗎 發布:2024-07-17 14:57:08 瀏覽:853
网站地图