Repository navigation
Expand file tree
/
Copy pathletsencrypt-install.sh
More file actions
executable file
·61 lines (53 loc) · 2.65 KB
/
Copy pathletsencrypt-install.sh
File metadata and controls
executable file
·61 lines (53 loc) · 2.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env bash
# Copyright:: Copyright (c) 2016 Been Kyung-yoon (http://www.php79.com/)
# License:: The MIT License (MIT)
STACK_ROOT=$( dirname $( cd "$( dirname "$0" )" && pwd ) )
source "${STACK_ROOT}/includes/function.inc.sh"
title "Let's Encrypt 자동화툴을 설치합니다."
notice "[1/5] 인증툴인 certbot-auto 를 설치합니다. - https://certbot.eff.org/"
if [ ! -f "/usr/bin/certbot-auto" ]; then
if [ "$OS" = "rocky8" ]; then
echo " Rocky Linux 8 에서는 EPEL 저장소의 certbot 패키지를 설치하고, certbot-auto 호환용 링크를 생성합니다."
yum_install certbot
ln -s /usr/bin/certbot-3 /usr/bin/certbot-auto
else
notice " certbot 최신 버전의 CentOS 지원 중단에 따라, 지원가능한 1.10.1 버전을 설치합니다. - https://github.com/php79/stack/issues/83"
cd /usr/bin \
&& wget https://raw.githubusercontent.com/certbot/certbot/1.10.x/certbot-auto \
&& chmod ug+x certbot-auto \
&& certbot-auto --install-only --no-self-upgrade -n
fi
else
outputComment " (생략) /usr/bin/certbot-auto 파일이 이미 존재합니다.\n"
fi
notice "[2/5] nginx 에서 사용할 설정 파일들을 /etc/letsencrypt/php79 에 복사합니다."
if [ ! -f "/etc/letsencrypt/php79/ssl-stable.conf" ]; then
if [ ! -d /etc/letsencrypt ]; then
mkdir /etc/letsencrypt
fi
if [ ! -d /etc/letsencrypt/php79 ]; then
cp -av "${STACK_ROOT}/letsencrypt/php79" /etc/letsencrypt/
fi
else
outputComment " (생략) /etc/letsencrypt/php79/ssl-stable.conf 파일이 이미 존재합니다.\n"
fi
notice "[3/5] 인증용 웹문서 디렉토리를 생성합니다."
if [ ! -d /var/www/letsencrypt/.well-known ]; then
mkdir -p /var/www/letsencrypt/.well-known
else
outputComment " (생략) /var/www/letsencrypt/.well-known 디렉토리가 이미 존재합니다.\n"
fi
notice "[4/5] 암호화 강화를 위한 Diffie-Hellman parameters 를 생성합니다. (약 20초 ~ 3분 이상 소요)"
if [ ! -f "/etc/letsencrypt/php79/ssl-dhparams.pem" ]; then
openssl dhparam -out /etc/letsencrypt/php79/ssl-dhparams.pem 2048 2>/dev/null
ls -l /etc/letsencrypt/php79/ssl-dhparams.pem
else
outputComment " (생략) /etc/letsencrypt/php79/ssl-dhparams.pem 파일이 이미 존재합니다.\n"
fi
notice "[5/5] 인증서 갱신 스크립트를 매일 새벽 자동 실행되도록 크론에 추가합니다."
if [ ! -f "/etc/cron.daily/php79-certbot-auto-renew" ]; then
cp -av "${STACK_ROOT}/letsencrypt/php79-certbot-auto-renew" /etc/cron.daily/
chmod 700 /etc/cron.daily/php79-certbot-auto-renew
else
outputComment " (생략) /etc/cron.daily/php79-certbot-auto-renew 파일이 이미 존재합니다.\n"
fi