Sử dụng chứng chỉ SSL do tổ chức thứ ba cấp
Trong môi trường sản xuất, việc sử dụng chứng chỉ SSL do các tổ chức thứ ba (CA) có uy tín cấp là một biện pháp quan trọng để đảm bảo an toàn cho trang web. Bài viết này sẽ hướng dẫn cách cấu hình chứng chỉ SSL do tổ chức thứ ba cấp trong ServBay.
WARNING
Cần nhấn mạnh rằng, chứng chỉ được cấp bởi bên thứ ba chỉ hỗ trợ các tên miền chuẩn (như gTLD, ccTLD, New gTLD), không hỗ trợ hậu tố không chuẩn tùy chỉnh (như .local, .test).
Bước 1: Đăng ký chứng chỉ SSL từ bên thứ ba
Trước hết, bạn cần đăng ký một chứng chỉ SSL từ một CA có uy tín (như Let's Encrypt, DigiCert, GlobalSign, v.v.). Dưới đây là các bước cơ bản để đăng ký chứng chỉ SSL:
Tạo khóa riêng (Private Key)
Mở terminal và chạy lệnh sau để tạo một khóa riêng:
shopenssl genpkey -algorithm RSA -out servbay_demo.key -pkeyopt rsa_keygen_bits:2048
1Tạo yêu cầu ký chứng chỉ (CSR)
Sử dụng khóa riêng vừa tạo để tạo một yêu cầu ký chứng chỉ:
shopenssl req -new -key servbay_demo.key -out servbay_demo.csr
1Trong quá trình này, bạn cần cung cấp một số thông tin. Dưới đây là một ví dụ về đầu vào:
Country Name (2 letter code) [AU]:CN State or Province Name (full name) [Some-State]:Hong Kong Locality Name (eg, city) []:Kowloon Organization Name (eg, company) [Internet Widgits Pty Ltd]:ServBay Organizational Unit Name (eg, section) []:Development Common Name (e.g. server FQDN or YOUR name) []:servbay.demo Email Address []:[email protected]
1
2
3
4
5
6
7Gửi CSR
Gửi file CSR (
servbay_demo.csr
) đã tạo ra cho CA bạn đã chọn. Dựa trên yêu cầu cụ thể của CA, bạn có thể cần xác minh quyền sở hữu tên miền.Nhận chứng chỉ
Sau khi CA xác minh thành công, bạn sẽ nhận được một file chứng chỉ SSL được ký (thường là định dạng
.crt
hoặc.pem
) và có thể là một file chuỗi chứng chỉ trung gian.
Lưu ý
Cần nhấn mạnh rằng, chứng chỉ được cấp bởi bên thứ ba chỉ hỗ trợ các tên miền chuẩn (như gTLD, ccTLD, New gTLD), không hỗ trợ hậu tố không chuẩn tùy chỉnh. Ví dụ, dưới đây là một số tên miền chuẩn:
- gTLD (Tên miền cấp cao chung): như .com, .org, .net
- ccTLD (Tên miền cấp cao mã quốc gia): như .cn, .uk, .jp
- New gTLD (Tên miền cấp cao chung mới): như .app, .tech, .xyz
Các hậu tố không chuẩn tùy chỉnh (như .local, .test) sẽ không được CA cấp chứng chỉ SSL.
Bước 2: Cấu hình chứng chỉ SSL bên thứ ba trong ServBay
Sau khi nhận được chứng chỉ SSL từ CA, tiếp theo bạn cần cấu hình chứng chỉ này trong ServBay. Hãy đặt các file chứng chỉ và khóa riêng vào thư mục /Applications/ServBay/ssl
để dễ dàng quản lý và sử dụng.
Di chuyển file chứng chỉ vào thư mục chỉ định
Sử dụng lệnh sau để di chuyển file khóa riêng và file chứng chỉ vào thư mục
/Applications/ServBay/ssl
:shmv servbay_demo.key /Applications/ServBay/ssl/ mv servbay_demo.crt /Applications/ServBay/ssl/ # Nếu có file chuỗi chứng chỉ trung gian, cũng di chuyển vào mv intermediate.crt /Applications/ServBay/ssl/
1
2
3
4Kết hợp chuỗi chứng chỉ trung gian
Nếu CA cung cấp file chuỗi chứng chỉ trung gian, bạn cần kết hợp nội dung của nó vào file chứng chỉ của bạn. Sử dụng lệnh sau để thêm chuỗi chứng chỉ trung gian vào file chứng chỉ của bạn:
shcat intermediate.crt >> /Applications/ServBay/ssl/servbay_demo.crt
1Mở bảng điều khiển quản lý ServBay
Khởi động ứng dụng ServBay và vào bảng điều khiển quản lý.
Thêm máy chủ
Trong bảng điều khiển quản lý, chọn mục
Host
.Chọn phương thức ký chứng chỉ SSL
Trong quá trình thêm máy chủ, bạn sẽ thấy một tùy chọn lựa chọn phương thức ký chứng chỉ SSL. Chọn
Custom
.Chỉ định file chứng chỉ
Trong các trường
certificate key file
vàcertificate file
, lần lượt chỉ định file khóa riêng và file chứng chỉ đã kết hợp của bạn:- File khóa riêng:
/Applications/ServBay/ssl/servbay_demo.key
- File chứng chỉ:
/Applications/ServBay/ssl/servbay_demo.crt
- File khóa riêng:
Thiết lập tên máy chủ và tên miền
Trong các trường tên máy chủ và tên miền, nhập
servbay.demo
.Hoàn tất thêm máy chủ
Theo hướng dẫn để hoàn tất quá trình thêm máy chủ. Lúc này, máy chủ của bạn sẽ sử dụng chứng chỉ SSL do CA cấp.
Xác minh cấu hình
Sau khi hoàn thành các bước trên, bạn có thể sử dụng trình duyệt để truy cập vào máy chủ đã cấu hình. Nếu cấu hình chính xác, thanh địa chỉ của trình duyệt sẽ hiển thị biểu tượng khóa an toàn, cho biết đã sử dụng chứng chỉ SSL đáng tin cậy.
Tổng kết
Qua các bước trên, bạn đã có thể cấu hình và sử dụng chứng chỉ SSL do tổ chức thứ ba cấp trong ServBay. Điều này không chỉ nâng cao độ an toàn cho trang web mà còn tăng cường sự tin tưởng của người dùng đối với trang web của bạn. Hãy nhớ rằng, chứng chỉ do bên thứ ba cấp chỉ hỗ trợ các tên miền chuẩn, không hỗ trợ các hậu tố không chuẩn tùy chỉnh. Hy vọng bài viết này có thể giúp bạn cấu hình chứng chỉ SSL bên thứ ba một cách thuận lợi và đảm bảo trang web của bạn an toàn và đáng tin cậy.