[Web] “이 사이트의 보안 연결(HTTPS)은 완벽하지 않습니다.” 발생 시

https 적용 후 인증서 적용은 잘 되었지만, “이 사이트의 보안 연결(HTTPS)은 완벽하지 않습니다.”가 발생하는 경우가 있다. 이 경우는 사용하는 리소스 중 일부가 여전히 http를 사용하는 경우 나타난다.

브라우저의 개발자 도구를 이용해서 http를 사용하는 리소스를 찾아 모두 https를 사용하도록 하여 제거해주도록 한다.

Transmission SSL 설정하기

토렌트 머신으로 사용할 때 Transmission을 설치해서 사용한다. 우분투에서도 https://blog.dasomoli.org/raspberrypi-torrent-%eb%a8%b8%ec%8b%a0-%eb%a7%8c%eb%93%a4%ea%b8%b0/ 의 내용을 그대로 설정하면 된다. 이대로 설정하면 http 프로토콜을 이용하게 되는데, 여기서 한 단계 더 나아가서 SSL 설정을 통해 https를 쓰도록 설정하자. letsencrypt 인증서를 사용하는 certbot을 사용하면, 설정은 매우 간단하다.

# certbot --apache

실행 예제 화면은 다음과 같다.

root@bamtol:/etc/letsencrypt# certbot --apache
Saving debug log to /var/log/letsencrypt/letsencrypt.log

Which names would you like to activate HTTPS for?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: blog.dasomoli.org
2: torrent.dasomoli.org
3: www.dasomoli.org
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel): 2

Requesting a certificate for torrent.dasomoli.org

Successfully received certificate.
Certificate is saved at: /etc/letsencrypt/live/torrent.dasomoli.org/fullchain.pem
Key is saved at:         /etc/letsencrypt/live/torrent.dasomoli.org/privkey.pem
This certificate expires on 2023-06-07.
These files will be updated when the certificate renews.

Deploying certificate
Successfully deployed certificate for torrent.dasomoli.org to /etc/apache2/sites-available/torrent.dasomoli.org-le-ssl.conf
Congratulations! You have successfully enabled HTTPS on https://torrent.dasomoli.org

NEXT STEPS:
- The certificate will need to be renewed before it expires. Certbot can automatically renew the certificate in the background, but you may need to take steps to enable that functionality. See https://certbot.org/renewal-setup for instructions.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
If you like Certbot, please consider supporting our work by:
 * Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
 * Donating to EFF:                    https://eff.org/donate-le
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

그럼 /etc/apache2/sites-enabled/torrent.dasomoli.org-le-ssl.conf 파일이 생성되는데 여기에 SSLProxyEngine on 옵션을 추가해준다. 그럼 이렇게 된다.

<IfModule mod_ssl.c>
<VirtualHost *:443>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        ServerName torrent.dasomoli.org
        ServerAdmin dasomoli@gmail.com

        ProxyPass / http://localhost:9000/
        ProxyPassReverse / http://localhost:9000/

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/torrent.log
        CustomLog ${APACHE_LOG_DIR}/torrent.access.log combined

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf


SSLCertificateFile /etc/letsencrypt/live/torrent.dasomoli.org/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/torrent.dasomoli.org/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
SSLProxyEngine on
</VirtualHost>
</IfModule>

이게 끝. apache2 서비스를 재시작한 후 https로 접근한다.

curl 사용법

curl 잘쓰면 엄청 편하다.
* HTTP 전송 과정에 대한 상세 정보. curl이 하는 모든 일을 debugdump.txt에 저장한다.
curl –trace-ascii debugdump.txt http://blog.dasomoli.org/
* 일반적인 http 요청(GET method)
curl http://blog.dasomoli.org/
* HTTP authentication
curl -u <id>:<password> http://blog.dasomoli.org/
* POST method 요청
curl -X POST -d”<data>” http://blog.dasomoli.org:80/post/
다음과 같은 form이 있다면,
<form method=”POST” action=”dasomoli.cgi”>
<input type=text name=”id”>
<input type=submit name=press value=” OK “>
</form>
다음과 같이 전송 가능((hidden type도 그냥 쓰면 됨)
curl –data “id=dasomoli&press=%20OK%20”  http://blog.dasomoli.org/dasomoli.cgi
–data-urlencode를 쓰면 %20같이 쓰지 않고, 아래처럼도 가능하다고 한다.
curl –data-urlencode “name=JeongSeok Yang” http://blog.dasomoli.org/dasomoli.cgi
* POST로 파일 보내기
curl -X POST -d@<filename> http://blog.dasomoli.org/post/
* PUT method
curl –upload-file uploadfile http://blog.dasomoli.org/receiveput.cgi
* JSON 전송
curl -X POST http://blog.dasomoli.org/json/ -d@dasomoli.json -H “Content-Type: application/json”
* 쿠키 쓰기
curl -b cookie.txt -c cookie.txt http://blog.dasomoli.org/

 

 

[Linux] git 사용 시 Proxy 환경 아래서 https 인증이 제대로 안될 때

git 사용 시 Proxy 환경 아래서 https 인증이 제대로 안될 때 다음과 같은 에러 발생 시..

error: SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed while accessing https://주소.com/프로젝트.git/info/refs
fatal: HTTP request failed


아래처럼 하고 해보자.
 

$ export GIT_SSL_NO_VERIFY=true

우아한 방법은 아니지만 동작은 한다.
다음처럼 설정도 가능.

$ git config –global http.sslVerify false

참고 :  http://stackoverflow.com/questions/3777075/https-github-access