DevOps > SSL Certificate on Centos 7 Server

Email IconExcel IconBedrock Icon

2025-01-29(수) //SSL/TLS 인증서는 AWS에서 발급한 것도 사용가능해?

네, AWS에서 발급한 SSL/TLS 인증서도 사용 가능합니다. AWS Certificate Manager(ACM)를 통해 무료로 SSL/TLS 인증서를 발급받아 사용할 수 있습니다.

ACM의 주요 특징은 다음과 같습니다:

1. 무료 인증서 발급: 공인된 도메인에 대해 무료로 인증서를 발급받을 수 있습니다.

2. 자동 갱신: 인증서 만료 시 자동으로 갱신되므로 수동 관리가 필요 없습니다.

3. AWS 서비스와의 통합: ELB, CloudFront 등 AWS 서비스와 쉽게 통합할 수 있습니다.

4. 도메인 검증: DNS 또는 이메일을 통해 도메인 소유권을 검증합니다.

5. 와일드카드 인증서 지원: 서브도메인을 포함한 와일드카드 인증서 발급이 가능합니다.

ACM에서 발급받은 인증서는 주로 AWS 내 리소스에서 사용되지만, 인증서를 다운로드하여 온프레미스 환경에서도 사용할 수 있습니다. 다만 이 경우 자동 갱신 기능은 사용할 수 없으므로 수동으로 관리해야 합니다.

따라서 AWS 환경에서 운영되는 서비스라면 ACM을 통해 발급받은 SSL/TLS 인증서를 사용하는 것이 편리하고 비용 효율적입니다.


2025-01-29(수) //Https로 변경할 경우 certificate를 추가해야하지 않아? Certificate 없이도 https 적용이 가능해?

네, 말씀하신 대로 HTTPS를 적용하려면 일반적으로 SSL/TLS 인증서가 필요합니다. 인증서 없이 HTTPS를 완전히 구현하는 것은 불가능합니다.

다만, 몇 가지 예외적인 상황이 있을 수 있습니다:

1. 자체 서명 인증서 사용:
– 개발 환경이나 내부 테스트용으로 자체 서명 인증서를 생성해 사용할 수 있습니다.
– 하지만 이는 브라우저에서 보안 경고를 표시하므로 실제 운영 환경에는 적합하지 않습니다.

2. Let’s Encrypt 같은 무료 인증 기관 활용:
– Let’s Encrypt는 무료로 SSL/TLS 인증서를 발급해주는 서비스입니다.
– 이를 통해 비용 부담 없이 유효한 인증서를 얻을 수 있습니다.

3. 리버스 프록시 사용:
– 프론트엔드 서버에서만 SSL을 처리하고 내부 백엔드 서버는 HTTP로 통신하는 구조를 만들 수 있습니다.
– 이 경우 백엔드 서버 자체는 인증서가 필요 없지만, 프론트엔드에는 여전히 인증서가 필요합니다.

4. 클라우드 서비스의 SSL 기능 활용:
– 일부 클라우드 서비스는 자체적으로 SSL을 제공하므로, 사용자가 직접 인증서를 관리할 필요가 없을 수 있습니다.

결론적으로, 안전하고 신뢰할 수 있는 HTTPS 연결을 위해서는 유효한 SSL/TLS 인증서가 필요합니다.
인증서 없이 HTTPS를 구현하는 방법들은 대부분 제한적이거나 보안상 취약점이 있을 수 있으므로, 실제 운영 환경에서는 권장되지 않습니다.


서버에 강제적으로 HTTPS를 적용하기 위해서는 다음과 같은 방법들을 사용할 수 있습니다:

1. Apache 서버 설정 변경:
– .htaccess 파일에 다음 코드 추가:
“`
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
“`
– 또는 VirtualHost 설정에 Redirect 규칙 추가:
“`

ServerName example.com
Redirect permanent / https://example.com/

“`

2. Nginx 서버 설정 변경:
– server 블록에 다음 설정 추가:
“`
server {
listen 80;
server_name example.com;
return 301 https://$server_name$request_uri;
}
“`

3. 애플리케이션 레벨에서 리다이렉트:
– 웹 애플리케이션 코드에서 HTTP 요청을 감지하여 HTTPS로 리다이렉트

4. HSTS(HTTP Strict Transport Security) 헤더 사용:
– 서버 응답에 다음 헤더 추가:
“`
Strict-Transport-Security: max-age=31536000; includeSubDomains
“`

5. 로드 밸런서 설정:
– 로드 밸런서 레벨에서 HTTP를 HTTPS로 리다이렉트 설정

6. CDN 설정:
– CDN 서비스를 사용 중이라면, CDN 설정에서 HTTPS 강제 적용 옵션 활성화

이러한 방법들 중 서버 환경과 요구사항에 맞는 것을 선택하여 적용하면 됩니다.
대부분의 경우 웹 서버 설정을 변경하는 것이 가장 일반적이고 효과적인 방법입니다.


To obtain a valid SSL certificate for an on-premise CentOS 7 server, you can follow these steps:

  1. Generate a Certificate Signing Request (CSR): Use a tool like OpenSSL to generate a CSR on your CentOS 7 server. This involves providing information about your server, such as the domain name, organization name, and location.
  2. Choose a Certificate Authority (CA): Select a trusted CA that offers SSL certificates. You can explore options like Let’s Encrypt, Comodo, Symantec, or others.
  3. Submit CSR to the CA: Submit the CSR to the chosen CA following their specific instructions. This typically involves filling out an online form or using their provided API.
  4. Verify domain ownership: The CA may require you to verify that you own the domain for which you are requesting the SSL certificate. This can be done through email validation, DNS verification, or other methods specified by the CA.
  5. Receive and download the SSL certificate: Once the CA completes the verification process, they will issue your SSL certificate. Download the certificate files, which usually include the public certificate and any intermediate certificates provided by the CA.
  6. Install the SSL certificate on your CentOS 7 server: Copy the certificate files to your server, typically to a designated directory. Update your web server configuration (e.g., Apache or Nginx) to reference these certificate files and enable HTTPS.
  7. Configure your web server: Modify your web server configuration to enable HTTPS, including specifying the SSL certificate files, configuring the virtual host settings, and restarting the web server.
  8. Test the SSL certificate: After installation, test your SSL certificate by accessing your website via HTTPS. Make sure there are no certificate warnings or errors.

Remember, the exact steps may vary depending on the CA and web server software you’re using. Consult the documentation provided by your selected CA and web server to ensure a successful installation of your SSL certificate on your on-premise CentOS 7 server.



To apply SSL to your Apache web server, you need to make the following changes:

  1. Enable SSL module: Ensure that the SSL module is enabled in Apache. You can do this by running the following command on your CentOS 7 server:sudo a2enmod ssl
  2. Obtain SSL certificate files: Copy the SSL certificate files (certificate, private key, and any intermediate certificates) to a directory on your server. Let’s assume the directory is /etc/ssl/certs/.
  3. Configure virtual host: Edit the Apache virtual host configuration file for your website. Typically, this file is located in /etc/httpd/conf.d/ or /etc/httpd/conf.d/ssl.conf. Add the following lines inside the <VirtualHost> block for your website:SSLEngine on SSLCertificateFile /etc/ssl/certs/your_certificate.crt SSLCertificateKeyFile /etc/ssl/certs/your_private_key.key SSLCertificateChainFile /etc/ssl/certs/intermediate_cert.crt (if applicable)Replace your_certificate.crtyour_private_key.key, and intermediate_cert.crt with the actual file names of your SSL certificate files.
  4. Configure SSL protocols and ciphers (optional): You can further enhance security by configuring the SSL protocols and ciphers used by Apache. Add the following lines inside the <VirtualHost> block:SSLProtocol all -SSLv2 -SSLv3 SSLCipherSuite HIGH:!aNULL:!MD5:!3DESThese settings disable older, less secure SSL protocols and select a strong cipher suite. Feel free to customize these options based on your specific security requirements.
  5. Restart Apache: After making the changes, restart Apache for the configuration to take effect. Use the following command:sudo systemctl restart httpd
  6. Test SSL: Access your website using https:// in the browser to verify that SSL is properly applied. Ensure that the SSL certificate is valid and the connection is secure.

By following these steps, you should be able to configure SSL for your Apache web server running on CentOS 7.

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments

0
Would love your thoughts, please comment.x
()
x