Merge pull request #215 from haiwen/fix_7.1_letsencrypt

fix letsencrypt
This commit is contained in:
Daniel Pan 2020-04-27 15:22:43 +08:00 committed by GitHub
commit 35fd6ca988
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 7 deletions

View file

@ -5,7 +5,7 @@ FROM phusion/baseimage:0.11
RUN apt-get update --fix-missing RUN apt-get update --fix-missing
# Utility tools # Utility tools
RUN apt-get install -y vim htop net-tools psmisc wget curl RUN apt-get install -y vim htop net-tools psmisc wget curl git
# For suport set local time zone. # For suport set local time zone.
RUN export DEBIAN_FRONTEND=noninteractive && apt-get install tzdata -y RUN export DEBIAN_FRONTEND=noninteractive && apt-get install tzdata -y

View file

@ -5,7 +5,7 @@ FROM phusion/baseimage:0.11
RUN apt-get update --fix-missing RUN apt-get update --fix-missing
# Utility tools # Utility tools
RUN apt-get install -y vim htop net-tools psmisc wget curl RUN apt-get install -y vim htop net-tools psmisc wget curl git
# For suport set local time zone. # For suport set local time zone.
RUN export DEBIAN_FRONTEND=noninteractive && apt-get install tzdata -y RUN export DEBIAN_FRONTEND=noninteractive && apt-get install tzdata -y

View file

@ -16,7 +16,7 @@ renew_cert_script=/scripts/renew_cert.sh
if [[ ! -x ${renew_cert_script} ]]; then if [[ ! -x ${renew_cert_script} ]]; then
cat > ${renew_cert_script} << EOF cat > ${renew_cert_script} << EOF
#!/bin/bash #!/bin/bash
python ${letsencrypt_script} --account-key ${ssldir}/${ssl_account_key} --csr ${ssldir}/${ssl_csr} --acme-dir /var/www/challenges/ > ${ssldir}/${ssl_crt} || exit python3 ${letsencrypt_script} --account-key ${ssldir}/${ssl_account_key} --csr ${ssldir}/${ssl_csr} --acme-dir /var/www/challenges/ > ${ssldir}/${ssl_crt} || exit
$(which nginx) -s reload $(which nginx) -s reload
EOF EOF

View file

@ -37,7 +37,7 @@ if [[ ! -e ${ssl_csr} ]]; then
openssl req -new -sha256 -key ${ssl_key} -subj "/CN=$domain" > $ssl_csr openssl req -new -sha256 -key ${ssl_key} -subj "/CN=$domain" > $ssl_csr
fi fi
python $letsencrypt_script --account-key ${ssl_account_key} --csr $ssl_csr --acme-dir /var/www/challenges/ > ./signed.crt python3 $letsencrypt_script --account-key ${ssl_account_key} --csr $ssl_csr --acme-dir /var/www/challenges/ > ./signed.crt
curl -sSL -o intermediate.pem https://letsencrypt.org/certs/lets-encrypt-x3-cross-signed.pem curl -sSL -o intermediate.pem https://letsencrypt.org/certs/lets-encrypt-x3-cross-signed.pem
cat signed.crt intermediate.pem > ${ssl_crt} cat signed.crt intermediate.pem > ${ssl_crt}

View file

@ -144,7 +144,7 @@ def get_process_cmd(pid, env=False):
env = 'e' if env else '' env = 'e' if env else ''
try: try:
return subprocess.check_output('ps {} -o command {}'.format(env, pid), return subprocess.check_output('ps {} -o command {}'.format(env, pid),
shell=True).strip().splitlines()[1] shell=True).decode('utf8').strip().splitlines()[1]
# except Exception, e: # except Exception, e:
# print(e) # print(e)
except: except:
@ -153,7 +153,7 @@ def get_process_cmd(pid, env=False):
def get_match_pids(pattern): def get_match_pids(pattern):
pgrep_output = subprocess.check_output( pgrep_output = subprocess.check_output(
'pgrep -f "{}" || true'.format(pattern), 'pgrep -f "{}" || true'.format(pattern),
shell=True).strip() shell=True).decode('utf8').strip()
return [int(pid) for pid in pgrep_output.splitlines()] return [int(pid) for pid in pgrep_output.splitlines()]
def ask_for_confirm(msg): def ask_for_confirm(msg):
@ -171,7 +171,7 @@ def git_current_commit():
def get_command_output(cmd): def get_command_output(cmd):
shell = not isinstance(cmd, list) shell = not isinstance(cmd, list)
return subprocess.check_output(cmd, shell=shell) return subprocess.check_output(cmd, shell=shell).decode('utf8')
def ask_yes_or_no(msg, prompt='', default=None): def ask_yes_or_no(msg, prompt='', default=None):
print('\n' + msg + '\n') print('\n' + msg + '\n')