Compare commits
28 Commits
test-apach
...
killpy26
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1d3141ee71 | ||
|
|
007383d8f2 | ||
|
|
835e4c051c | ||
|
|
7344bb3d55 | ||
|
|
21a56b3910 | ||
|
|
6c18b5b03d | ||
|
|
0e2b86d828 | ||
|
|
b11dec0fd0 | ||
|
|
5a58af7e2e | ||
|
|
80ef7c6ad9 | ||
|
|
173c8199c7 | ||
|
|
48f0cf131e | ||
|
|
c5102f10c7 | ||
|
|
07975a5553 | ||
|
|
eed279c8f2 | ||
|
|
f23dc97f41 | ||
|
|
48cbaf29c2 | ||
|
|
6b5100d3db | ||
|
|
dd52dfaa98 | ||
|
|
4076ae75fb | ||
|
|
85025026ff | ||
|
|
2b2b93feac | ||
|
|
a2c1e4b2fc | ||
|
|
694d7b1522 | ||
|
|
533b45c66b | ||
|
|
defd06b4b2 | ||
|
|
f60ff9691b | ||
|
|
dee46d8d71 |
@@ -33,4 +33,5 @@ COPY . /home/lea/certbot/letsencrypt-auto-source
|
|||||||
USER lea
|
USER lea
|
||||||
WORKDIR /home/lea
|
WORKDIR /home/lea
|
||||||
|
|
||||||
CMD ["pytest", "-v", "-s", "certbot/letsencrypt-auto-source/tests"]
|
RUN sudo chmod +x certbot/letsencrypt-auto-source/tests/centos6_tests.sh
|
||||||
|
CMD sudo certbot/letsencrypt-auto-source/tests/centos6_tests.sh
|
||||||
|
|||||||
@@ -244,15 +244,29 @@ DeprecationBootstrap() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Sets LE_PYTHON to Python version string and PYVER to the first two
|
||||||
|
# digits of the python version
|
||||||
DeterminePythonVersion() {
|
DeterminePythonVersion() {
|
||||||
for LE_PYTHON in "$LE_PYTHON" python2.7 python27 python2 python; do
|
# Arguments: "NOCRASH" if we shouldn't crash if we don't find a good python
|
||||||
# Break (while keeping the LE_PYTHON value) if found.
|
if [ -n "$USE_PYTHON_3" ]; then
|
||||||
$EXISTS "$LE_PYTHON" > /dev/null && break
|
for LE_PYTHON in "$LE_PYTHON" python3; do
|
||||||
done
|
# Break (while keeping the LE_PYTHON value) if found.
|
||||||
|
$EXISTS "$LE_PYTHON" > /dev/null && break
|
||||||
|
done
|
||||||
|
else
|
||||||
|
for LE_PYTHON in "$LE_PYTHON" python2.7 python27 python2 python; do
|
||||||
|
# Break (while keeping the LE_PYTHON value) if found.
|
||||||
|
$EXISTS "$LE_PYTHON" > /dev/null && break
|
||||||
|
done
|
||||||
|
fi
|
||||||
if [ "$?" != "0" ]; then
|
if [ "$?" != "0" ]; then
|
||||||
error "Cannot find any Pythons; please install one!"
|
if [ "$1" != "NOCRASH" ]; then
|
||||||
exit 1
|
error "Cannot find any Pythons; please install one!"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
PYVER=0
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
export LE_PYTHON
|
export LE_PYTHON
|
||||||
|
|
||||||
@@ -384,23 +398,19 @@ BootstrapDebCommon() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# If new packages are installed by BootstrapRpmCommon below, this version
|
# If new packages are installed by BootstrapRpmCommonBase below, version
|
||||||
# number must be increased.
|
# numbers in rpm_common.sh and rpm_python3.sh must be increased.
|
||||||
BOOTSTRAP_RPM_COMMON_VERSION=1
|
|
||||||
|
|
||||||
BootstrapRpmCommon() {
|
|
||||||
# Tested with:
|
|
||||||
# - Fedora 20, 21, 22, 23 (x64)
|
|
||||||
# - Centos 7 (x64: on DigitalOcean droplet)
|
|
||||||
# - CentOS 7 Minimal install in a Hyper-V VM
|
|
||||||
# - CentOS 6 (EPEL must be installed manually)
|
|
||||||
|
|
||||||
|
# Sets TOOL to the name of the package manager
|
||||||
|
# Sets appropriate values for YES_FLAG and QUIET_FLAG based on $ASSUME_YES and $QUIET_FLAG.
|
||||||
|
# Enables EPEL if applicable and possible.
|
||||||
|
InitializeRPMCommonBase() {
|
||||||
if type dnf 2>/dev/null
|
if type dnf 2>/dev/null
|
||||||
then
|
then
|
||||||
tool=dnf
|
TOOL=dnf
|
||||||
elif type yum 2>/dev/null
|
elif type yum 2>/dev/null
|
||||||
then
|
then
|
||||||
tool=yum
|
TOOL=yum
|
||||||
|
|
||||||
else
|
else
|
||||||
error "Neither yum nor dnf found. Aborting bootstrap!"
|
error "Neither yum nor dnf found. Aborting bootstrap!"
|
||||||
@@ -408,15 +418,15 @@ BootstrapRpmCommon() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$ASSUME_YES" = 1 ]; then
|
if [ "$ASSUME_YES" = 1 ]; then
|
||||||
yes_flag="-y"
|
YES_FLAG="-y"
|
||||||
fi
|
fi
|
||||||
if [ "$QUIET" = 1 ]; then
|
if [ "$QUIET" = 1 ]; then
|
||||||
QUIET_FLAG='--quiet'
|
QUIET_FLAG='--quiet'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! $tool list *virtualenv >/dev/null 2>&1; then
|
if ! $TOOL list *virtualenv >/dev/null 2>&1; then
|
||||||
echo "To use Certbot, packages from the EPEL repository need to be installed."
|
echo "To use Certbot, packages from the EPEL repository need to be installed."
|
||||||
if ! $tool list epel-release >/dev/null 2>&1; then
|
if ! $TOOL list epel-release >/dev/null 2>&1; then
|
||||||
error "Enable the EPEL repository and try running Certbot again."
|
error "Enable the EPEL repository and try running Certbot again."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@@ -428,11 +438,17 @@ BootstrapRpmCommon() {
|
|||||||
/bin/echo -e "\e[0K\rEnabling the EPEL repository in 1 seconds..."
|
/bin/echo -e "\e[0K\rEnabling the EPEL repository in 1 seconds..."
|
||||||
sleep 1s
|
sleep 1s
|
||||||
fi
|
fi
|
||||||
if ! $tool install $yes_flag $QUIET_FLAG epel-release; then
|
if ! $TOOL install $YES_FLAG $QUIET_FLAG epel-release; then
|
||||||
error "Could not enable EPEL. Aborting bootstrap!"
|
error "Could not enable EPEL. Aborting bootstrap!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
BootstrapRpmCommonBase() {
|
||||||
|
# Arguments: whitespace-delimited python packages to install
|
||||||
|
|
||||||
|
InitializeRPMCommonBase # This call is superfluous in practice
|
||||||
|
|
||||||
pkgs="
|
pkgs="
|
||||||
gcc
|
gcc
|
||||||
@@ -444,10 +460,39 @@ BootstrapRpmCommon() {
|
|||||||
ca-certificates
|
ca-certificates
|
||||||
"
|
"
|
||||||
|
|
||||||
# Most RPM distros use the "python" or "python-" naming convention. Let's try that first.
|
# Add the python packages
|
||||||
if $tool list python >/dev/null 2>&1; then
|
pkgs="$pkgs
|
||||||
|
$1
|
||||||
|
"
|
||||||
|
|
||||||
|
if $TOOL list installed "httpd" >/dev/null 2>&1; then
|
||||||
pkgs="$pkgs
|
pkgs="$pkgs
|
||||||
python
|
mod_ssl
|
||||||
|
"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! $TOOL install $YES_FLAG $QUIET_FLAG $pkgs; then
|
||||||
|
error "Could not install OS dependencies. Aborting bootstrap!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# If new packages are installed by BootstrapRpmCommon below, this version
|
||||||
|
# number must be increased.
|
||||||
|
BOOTSTRAP_RPM_COMMON_VERSION=1
|
||||||
|
|
||||||
|
BootstrapRpmCommon() {
|
||||||
|
# Tested with:
|
||||||
|
# - Fedora 20, 21, 22, 23 (x64)
|
||||||
|
# - Centos 7 (x64: on DigitalOcean droplet)
|
||||||
|
# - CentOS 7 Minimal install in a Hyper-V VM
|
||||||
|
# - CentOS 6
|
||||||
|
|
||||||
|
InitializeRPMCommonBase
|
||||||
|
|
||||||
|
# Most RPM distros use the "python" or "python-" naming convention. Let's try that first.
|
||||||
|
if $TOOL list python >/dev/null 2>&1; then
|
||||||
|
python_pkgs="$python
|
||||||
python-devel
|
python-devel
|
||||||
python-virtualenv
|
python-virtualenv
|
||||||
python-tools
|
python-tools
|
||||||
@@ -455,9 +500,8 @@ BootstrapRpmCommon() {
|
|||||||
"
|
"
|
||||||
# Fedora 26 starts to use the prefix python2 for python2 based packages.
|
# Fedora 26 starts to use the prefix python2 for python2 based packages.
|
||||||
# this elseif is theoretically for any Fedora over version 26:
|
# this elseif is theoretically for any Fedora over version 26:
|
||||||
elif $tool list python2 >/dev/null 2>&1; then
|
elif $TOOL list python2 >/dev/null 2>&1; then
|
||||||
pkgs="$pkgs
|
python_pkgs="$python2
|
||||||
python2
|
|
||||||
python2-libs
|
python2-libs
|
||||||
python2-setuptools
|
python2-setuptools
|
||||||
python2-devel
|
python2-devel
|
||||||
@@ -468,8 +512,7 @@ BootstrapRpmCommon() {
|
|||||||
# Some distros and older versions of current distros use a "python27"
|
# Some distros and older versions of current distros use a "python27"
|
||||||
# instead of the "python" or "python-" naming convention.
|
# instead of the "python" or "python-" naming convention.
|
||||||
else
|
else
|
||||||
pkgs="$pkgs
|
python_pkgs="$python27
|
||||||
python27
|
|
||||||
python27-devel
|
python27-devel
|
||||||
python27-virtualenv
|
python27-virtualenv
|
||||||
python27-tools
|
python27-tools
|
||||||
@@ -477,16 +520,31 @@ BootstrapRpmCommon() {
|
|||||||
"
|
"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if $tool list installed "httpd" >/dev/null 2>&1; then
|
BootstrapRpmCommonBase "$python_pkgs"
|
||||||
pkgs="$pkgs
|
}
|
||||||
mod_ssl
|
|
||||||
"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! $tool install $yes_flag $QUIET_FLAG $pkgs; then
|
# If new packages are installed by BootstrapRpmPython3 below, this version
|
||||||
error "Could not install OS dependencies. Aborting bootstrap!"
|
# number must be increased.
|
||||||
|
BOOTSTRAP_RPM_PYTHON3_VERSION=1
|
||||||
|
|
||||||
|
BootstrapRpmPython3() {
|
||||||
|
# Tested with:
|
||||||
|
# - CentOS 6
|
||||||
|
|
||||||
|
InitializeRPMCommonBase
|
||||||
|
|
||||||
|
# EPEL uses python34
|
||||||
|
if $TOOL list python34 >/dev/null 2>&1; then
|
||||||
|
python_pkgs="python34
|
||||||
|
python34-devel
|
||||||
|
python34-tools
|
||||||
|
"
|
||||||
|
else
|
||||||
|
error "No supported Python package available to install. Aborting bootstrap!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
BootstrapRpmCommonBase "$python_pkgs"
|
||||||
}
|
}
|
||||||
|
|
||||||
# If new packages are installed by BootstrapSuseCommon below, this version
|
# If new packages are installed by BootstrapSuseCommon below, this version
|
||||||
@@ -715,11 +773,24 @@ elif [ -f /etc/mageia-release ]; then
|
|||||||
}
|
}
|
||||||
BOOTSTRAP_VERSION="BootstrapMageiaCommon $BOOTSTRAP_MAGEIA_COMMON_VERSION"
|
BOOTSTRAP_VERSION="BootstrapMageiaCommon $BOOTSTRAP_MAGEIA_COMMON_VERSION"
|
||||||
elif [ -f /etc/redhat-release ]; then
|
elif [ -f /etc/redhat-release ]; then
|
||||||
Bootstrap() {
|
prev_le_python="$LE_PYTHON"
|
||||||
BootstrapMessage "RedHat-based OSes"
|
unset LE_PYTHON
|
||||||
BootstrapRpmCommon
|
DeterminePythonVersion "NOCRASH"
|
||||||
}
|
if [ "$PYVER" -eq 26 ]; then
|
||||||
BOOTSTRAP_VERSION="BootstrapRpmCommon $BOOTSTRAP_RPM_COMMON_VERSION"
|
Bootstrap() {
|
||||||
|
BootstrapMessage "RedHat-based OSes that will use Python3"
|
||||||
|
BootstrapRpmPython3
|
||||||
|
}
|
||||||
|
USE_PYTHON_3=1
|
||||||
|
BOOTSTRAP_VERSION="BootstrapRpmPython3 $BOOTSTRAP_RPM_PYTHON3_VERSION"
|
||||||
|
else
|
||||||
|
Bootstrap() {
|
||||||
|
BootstrapMessage "RedHat-based OSes"
|
||||||
|
BootstrapRpmCommon
|
||||||
|
}
|
||||||
|
BOOTSTRAP_VERSION="BootstrapRpmCommon $BOOTSTRAP_RPM_COMMON_VERSION"
|
||||||
|
fi
|
||||||
|
export LE_PYTHON="$prev_le_python"
|
||||||
elif [ -f /etc/os-release ] && `grep -q openSUSE /etc/os-release` ; then
|
elif [ -f /etc/os-release ] && `grep -q openSUSE /etc/os-release` ; then
|
||||||
Bootstrap() {
|
Bootstrap() {
|
||||||
BootstrapMessage "openSUSE-based OSes"
|
BootstrapMessage "openSUSE-based OSes"
|
||||||
@@ -858,10 +929,18 @@ if [ "$1" = "--le-auto-phase2" ]; then
|
|||||||
say "Creating virtual environment..."
|
say "Creating virtual environment..."
|
||||||
DeterminePythonVersion
|
DeterminePythonVersion
|
||||||
rm -rf "$VENV_PATH"
|
rm -rf "$VENV_PATH"
|
||||||
if [ "$VERBOSE" = 1 ]; then
|
if [ "$PYVER" -le 27 ]; then
|
||||||
virtualenv --no-site-packages --python "$LE_PYTHON" "$VENV_PATH"
|
if [ "$VERBOSE" = 1 ]; then
|
||||||
|
virtualenv --no-site-packages --python "$LE_PYTHON" "$VENV_PATH"
|
||||||
|
else
|
||||||
|
virtualenv --no-site-packages --python "$LE_PYTHON" "$VENV_PATH" > /dev/null
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
virtualenv --no-site-packages --python "$LE_PYTHON" "$VENV_PATH" > /dev/null
|
if [ "$VERBOSE" = 1 ]; then
|
||||||
|
"$LE_PYTHON" -m venv "$VENV_PATH"
|
||||||
|
else
|
||||||
|
"$LE_PYTHON" -m venv "$VENV_PATH" > /dev/null
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$BOOTSTRAP_VERSION" ]; then
|
if [ -n "$BOOTSTRAP_VERSION" ]; then
|
||||||
@@ -1356,17 +1435,22 @@ On failure, return non-zero.
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function, unicode_literals
|
||||||
|
|
||||||
from distutils.version import LooseVersion
|
from distutils.version import LooseVersion
|
||||||
from json import loads
|
from json import loads
|
||||||
from os import devnull, environ
|
from os import devnull, environ
|
||||||
from os.path import dirname, join
|
from os.path import dirname, join
|
||||||
import re
|
import re
|
||||||
|
import ssl
|
||||||
from subprocess import check_call, CalledProcessError
|
from subprocess import check_call, CalledProcessError
|
||||||
from sys import argv, exit
|
from sys import argv, exit
|
||||||
from urllib2 import build_opener, HTTPHandler, HTTPSHandler
|
try:
|
||||||
from urllib2 import HTTPError, URLError
|
from urllib2 import build_opener, HTTPHandler, HTTPSHandler
|
||||||
|
from urllib2 import HTTPError, URLError
|
||||||
|
except ImportError:
|
||||||
|
from urllib.request import build_opener, HTTPHandler, HTTPSHandler
|
||||||
|
from urllib.error import HTTPError, URLError
|
||||||
|
|
||||||
PUBLIC_KEY = environ.get('LE_AUTO_PUBLIC_KEY', """-----BEGIN PUBLIC KEY-----
|
PUBLIC_KEY = environ.get('LE_AUTO_PUBLIC_KEY', """-----BEGIN PUBLIC KEY-----
|
||||||
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA6MR8W/galdxnpGqBsYbq
|
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA6MR8W/galdxnpGqBsYbq
|
||||||
@@ -1388,8 +1472,11 @@ class HttpsGetter(object):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
"""Build an HTTPS opener."""
|
"""Build an HTTPS opener."""
|
||||||
# Based on pip 1.4.1's URLOpener
|
# Based on pip 1.4.1's URLOpener
|
||||||
# This verifies certs on only Python >=2.7.9.
|
# This verifies certs on only Python >=2.7.9, and when NO_CERT_VERIFY isn't set.
|
||||||
self._opener = build_opener(HTTPSHandler())
|
if environ.get('NO_CERT_VERIFY') == '1' and hasattr(ssl, 'SSLContext'):
|
||||||
|
self._opener = build_opener(HTTPSHandler(context=create_CERT_NONE_context()))
|
||||||
|
else:
|
||||||
|
self._opener = build_opener(HTTPSHandler())
|
||||||
# Strip out HTTPHandler to prevent MITM spoof:
|
# Strip out HTTPHandler to prevent MITM spoof:
|
||||||
for handler in self._opener.handlers:
|
for handler in self._opener.handlers:
|
||||||
if isinstance(handler, HTTPHandler):
|
if isinstance(handler, HTTPHandler):
|
||||||
@@ -1411,7 +1498,7 @@ class HttpsGetter(object):
|
|||||||
|
|
||||||
def write(contents, dir, filename):
|
def write(contents, dir, filename):
|
||||||
"""Write something to a file in a certain directory."""
|
"""Write something to a file in a certain directory."""
|
||||||
with open(join(dir, filename), 'w') as file:
|
with open(join(dir, filename), 'wb') as file:
|
||||||
file.write(contents)
|
file.write(contents)
|
||||||
|
|
||||||
|
|
||||||
@@ -1419,13 +1506,13 @@ def latest_stable_version(get):
|
|||||||
"""Return the latest stable release of letsencrypt."""
|
"""Return the latest stable release of letsencrypt."""
|
||||||
metadata = loads(get(
|
metadata = loads(get(
|
||||||
environ.get('LE_AUTO_JSON_URL',
|
environ.get('LE_AUTO_JSON_URL',
|
||||||
'https://pypi.python.org/pypi/certbot/json')))
|
'https://pypi.python.org/pypi/certbot/json')).decode('UTF-8'))
|
||||||
# metadata['info']['version'] actually returns the latest of any kind of
|
# metadata['info']['version'] actually returns the latest of any kind of
|
||||||
# release release, contrary to https://wiki.python.org/moin/PyPIJSON.
|
# release release, contrary to https://wiki.python.org/moin/PyPIJSON.
|
||||||
# The regex is a sufficient regex for picking out prereleases for most
|
# The regex is a sufficient regex for picking out prereleases for most
|
||||||
# packages, LE included.
|
# packages, LE included.
|
||||||
return str(max(LooseVersion(r) for r
|
return str(max(LooseVersion(r) for r
|
||||||
in metadata['releases'].iterkeys()
|
in iter(metadata['releases'].keys())
|
||||||
if re.match('^[0-9.]+$', r)))
|
if re.match('^[0-9.]+$', r)))
|
||||||
|
|
||||||
|
|
||||||
@@ -1442,7 +1529,7 @@ def verified_new_le_auto(get, tag, temp_dir):
|
|||||||
'letsencrypt-auto-source/') % tag
|
'letsencrypt-auto-source/') % tag
|
||||||
write(get(le_auto_dir + 'letsencrypt-auto'), temp_dir, 'letsencrypt-auto')
|
write(get(le_auto_dir + 'letsencrypt-auto'), temp_dir, 'letsencrypt-auto')
|
||||||
write(get(le_auto_dir + 'letsencrypt-auto.sig'), temp_dir, 'letsencrypt-auto.sig')
|
write(get(le_auto_dir + 'letsencrypt-auto.sig'), temp_dir, 'letsencrypt-auto.sig')
|
||||||
write(PUBLIC_KEY, temp_dir, 'public_key.pem')
|
write(PUBLIC_KEY.encode('UTF-8'), temp_dir, 'public_key.pem')
|
||||||
try:
|
try:
|
||||||
with open(devnull, 'w') as dev_null:
|
with open(devnull, 'w') as dev_null:
|
||||||
check_call(['openssl', 'dgst', '-sha256', '-verify',
|
check_call(['openssl', 'dgst', '-sha256', '-verify',
|
||||||
@@ -1457,6 +1544,14 @@ def verified_new_le_auto(get, tag, temp_dir):
|
|||||||
"certbot-auto.", exc)
|
"certbot-auto.", exc)
|
||||||
|
|
||||||
|
|
||||||
|
def create_CERT_NONE_context():
|
||||||
|
"""Create a SSLContext object to not check hostname."""
|
||||||
|
# PROTOCOL_TLS isn't available before 2.7.13 but this code is for 2.7.9+, so use this.
|
||||||
|
context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
|
||||||
|
context.verify_mode = ssl.CERT_NONE
|
||||||
|
return context
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
get = HttpsGetter().get
|
get = HttpsGetter().get
|
||||||
flag = argv[1]
|
flag = argv[1]
|
||||||
|
|||||||
@@ -244,15 +244,29 @@ DeprecationBootstrap() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Sets LE_PYTHON to Python version string and PYVER to the first two
|
||||||
|
# digits of the python version
|
||||||
DeterminePythonVersion() {
|
DeterminePythonVersion() {
|
||||||
for LE_PYTHON in "$LE_PYTHON" python2.7 python27 python2 python; do
|
# Arguments: "NOCRASH" if we shouldn't crash if we don't find a good python
|
||||||
# Break (while keeping the LE_PYTHON value) if found.
|
if [ -n "$USE_PYTHON_3" ]; then
|
||||||
$EXISTS "$LE_PYTHON" > /dev/null && break
|
for LE_PYTHON in "$LE_PYTHON" python3; do
|
||||||
done
|
# Break (while keeping the LE_PYTHON value) if found.
|
||||||
|
$EXISTS "$LE_PYTHON" > /dev/null && break
|
||||||
|
done
|
||||||
|
else
|
||||||
|
for LE_PYTHON in "$LE_PYTHON" python2.7 python27 python2 python; do
|
||||||
|
# Break (while keeping the LE_PYTHON value) if found.
|
||||||
|
$EXISTS "$LE_PYTHON" > /dev/null && break
|
||||||
|
done
|
||||||
|
fi
|
||||||
if [ "$?" != "0" ]; then
|
if [ "$?" != "0" ]; then
|
||||||
error "Cannot find any Pythons; please install one!"
|
if [ "$1" != "NOCRASH" ]; then
|
||||||
exit 1
|
error "Cannot find any Pythons; please install one!"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
PYVER=0
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
export LE_PYTHON
|
export LE_PYTHON
|
||||||
|
|
||||||
@@ -265,7 +279,9 @@ DeterminePythonVersion() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
{{ bootstrappers/deb_common.sh }}
|
{{ bootstrappers/deb_common.sh }}
|
||||||
|
{{ bootstrappers/rpm_common_base.sh }}
|
||||||
{{ bootstrappers/rpm_common.sh }}
|
{{ bootstrappers/rpm_common.sh }}
|
||||||
|
{{ bootstrappers/rpm_python3.sh }}
|
||||||
{{ bootstrappers/suse_common.sh }}
|
{{ bootstrappers/suse_common.sh }}
|
||||||
{{ bootstrappers/arch_common.sh }}
|
{{ bootstrappers/arch_common.sh }}
|
||||||
{{ bootstrappers/gentoo_common.sh }}
|
{{ bootstrappers/gentoo_common.sh }}
|
||||||
@@ -296,11 +312,24 @@ elif [ -f /etc/mageia-release ]; then
|
|||||||
}
|
}
|
||||||
BOOTSTRAP_VERSION="BootstrapMageiaCommon $BOOTSTRAP_MAGEIA_COMMON_VERSION"
|
BOOTSTRAP_VERSION="BootstrapMageiaCommon $BOOTSTRAP_MAGEIA_COMMON_VERSION"
|
||||||
elif [ -f /etc/redhat-release ]; then
|
elif [ -f /etc/redhat-release ]; then
|
||||||
Bootstrap() {
|
prev_le_python="$LE_PYTHON"
|
||||||
BootstrapMessage "RedHat-based OSes"
|
unset LE_PYTHON
|
||||||
BootstrapRpmCommon
|
DeterminePythonVersion "NOCRASH"
|
||||||
}
|
if [ "$PYVER" -eq 26 ]; then
|
||||||
BOOTSTRAP_VERSION="BootstrapRpmCommon $BOOTSTRAP_RPM_COMMON_VERSION"
|
Bootstrap() {
|
||||||
|
BootstrapMessage "RedHat-based OSes that will use Python3"
|
||||||
|
BootstrapRpmPython3
|
||||||
|
}
|
||||||
|
USE_PYTHON_3=1
|
||||||
|
BOOTSTRAP_VERSION="BootstrapRpmPython3 $BOOTSTRAP_RPM_PYTHON3_VERSION"
|
||||||
|
else
|
||||||
|
Bootstrap() {
|
||||||
|
BootstrapMessage "RedHat-based OSes"
|
||||||
|
BootstrapRpmCommon
|
||||||
|
}
|
||||||
|
BOOTSTRAP_VERSION="BootstrapRpmCommon $BOOTSTRAP_RPM_COMMON_VERSION"
|
||||||
|
fi
|
||||||
|
export LE_PYTHON="$prev_le_python"
|
||||||
elif [ -f /etc/os-release ] && `grep -q openSUSE /etc/os-release` ; then
|
elif [ -f /etc/os-release ] && `grep -q openSUSE /etc/os-release` ; then
|
||||||
Bootstrap() {
|
Bootstrap() {
|
||||||
BootstrapMessage "openSUSE-based OSes"
|
BootstrapMessage "openSUSE-based OSes"
|
||||||
@@ -439,10 +468,18 @@ if [ "$1" = "--le-auto-phase2" ]; then
|
|||||||
say "Creating virtual environment..."
|
say "Creating virtual environment..."
|
||||||
DeterminePythonVersion
|
DeterminePythonVersion
|
||||||
rm -rf "$VENV_PATH"
|
rm -rf "$VENV_PATH"
|
||||||
if [ "$VERBOSE" = 1 ]; then
|
if [ "$PYVER" -le 27 ]; then
|
||||||
virtualenv --no-site-packages --python "$LE_PYTHON" "$VENV_PATH"
|
if [ "$VERBOSE" = 1 ]; then
|
||||||
|
virtualenv --no-site-packages --python "$LE_PYTHON" "$VENV_PATH"
|
||||||
|
else
|
||||||
|
virtualenv --no-site-packages --python "$LE_PYTHON" "$VENV_PATH" > /dev/null
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
virtualenv --no-site-packages --python "$LE_PYTHON" "$VENV_PATH" > /dev/null
|
if [ "$VERBOSE" = 1 ]; then
|
||||||
|
"$LE_PYTHON" -m venv "$VENV_PATH"
|
||||||
|
else
|
||||||
|
"$LE_PYTHON" -m venv "$VENV_PATH" > /dev/null
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$BOOTSTRAP_VERSION" ]; then
|
if [ -n "$BOOTSTRAP_VERSION" ]; then
|
||||||
|
|||||||
@@ -7,61 +7,13 @@ BootstrapRpmCommon() {
|
|||||||
# - Fedora 20, 21, 22, 23 (x64)
|
# - Fedora 20, 21, 22, 23 (x64)
|
||||||
# - Centos 7 (x64: on DigitalOcean droplet)
|
# - Centos 7 (x64: on DigitalOcean droplet)
|
||||||
# - CentOS 7 Minimal install in a Hyper-V VM
|
# - CentOS 7 Minimal install in a Hyper-V VM
|
||||||
# - CentOS 6 (EPEL must be installed manually)
|
# - CentOS 6
|
||||||
|
|
||||||
if type dnf 2>/dev/null
|
InitializeRPMCommonBase
|
||||||
then
|
|
||||||
tool=dnf
|
|
||||||
elif type yum 2>/dev/null
|
|
||||||
then
|
|
||||||
tool=yum
|
|
||||||
|
|
||||||
else
|
|
||||||
error "Neither yum nor dnf found. Aborting bootstrap!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$ASSUME_YES" = 1 ]; then
|
|
||||||
yes_flag="-y"
|
|
||||||
fi
|
|
||||||
if [ "$QUIET" = 1 ]; then
|
|
||||||
QUIET_FLAG='--quiet'
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! $tool list *virtualenv >/dev/null 2>&1; then
|
|
||||||
echo "To use Certbot, packages from the EPEL repository need to be installed."
|
|
||||||
if ! $tool list epel-release >/dev/null 2>&1; then
|
|
||||||
error "Enable the EPEL repository and try running Certbot again."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if [ "$ASSUME_YES" = 1 ]; then
|
|
||||||
/bin/echo -n "Enabling the EPEL repository in 3 seconds..."
|
|
||||||
sleep 1s
|
|
||||||
/bin/echo -ne "\e[0K\rEnabling the EPEL repository in 2 seconds..."
|
|
||||||
sleep 1s
|
|
||||||
/bin/echo -e "\e[0K\rEnabling the EPEL repository in 1 seconds..."
|
|
||||||
sleep 1s
|
|
||||||
fi
|
|
||||||
if ! $tool install $yes_flag $QUIET_FLAG epel-release; then
|
|
||||||
error "Could not enable EPEL. Aborting bootstrap!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
pkgs="
|
|
||||||
gcc
|
|
||||||
augeas-libs
|
|
||||||
openssl
|
|
||||||
openssl-devel
|
|
||||||
libffi-devel
|
|
||||||
redhat-rpm-config
|
|
||||||
ca-certificates
|
|
||||||
"
|
|
||||||
|
|
||||||
# Most RPM distros use the "python" or "python-" naming convention. Let's try that first.
|
# Most RPM distros use the "python" or "python-" naming convention. Let's try that first.
|
||||||
if $tool list python >/dev/null 2>&1; then
|
if $TOOL list python >/dev/null 2>&1; then
|
||||||
pkgs="$pkgs
|
python_pkgs="$python
|
||||||
python
|
|
||||||
python-devel
|
python-devel
|
||||||
python-virtualenv
|
python-virtualenv
|
||||||
python-tools
|
python-tools
|
||||||
@@ -69,9 +21,8 @@ BootstrapRpmCommon() {
|
|||||||
"
|
"
|
||||||
# Fedora 26 starts to use the prefix python2 for python2 based packages.
|
# Fedora 26 starts to use the prefix python2 for python2 based packages.
|
||||||
# this elseif is theoretically for any Fedora over version 26:
|
# this elseif is theoretically for any Fedora over version 26:
|
||||||
elif $tool list python2 >/dev/null 2>&1; then
|
elif $TOOL list python2 >/dev/null 2>&1; then
|
||||||
pkgs="$pkgs
|
python_pkgs="$python2
|
||||||
python2
|
|
||||||
python2-libs
|
python2-libs
|
||||||
python2-setuptools
|
python2-setuptools
|
||||||
python2-devel
|
python2-devel
|
||||||
@@ -82,8 +33,7 @@ BootstrapRpmCommon() {
|
|||||||
# Some distros and older versions of current distros use a "python27"
|
# Some distros and older versions of current distros use a "python27"
|
||||||
# instead of the "python" or "python-" naming convention.
|
# instead of the "python" or "python-" naming convention.
|
||||||
else
|
else
|
||||||
pkgs="$pkgs
|
python_pkgs="$python27
|
||||||
python27
|
|
||||||
python27-devel
|
python27-devel
|
||||||
python27-virtualenv
|
python27-virtualenv
|
||||||
python27-tools
|
python27-tools
|
||||||
@@ -91,14 +41,5 @@ BootstrapRpmCommon() {
|
|||||||
"
|
"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if $tool list installed "httpd" >/dev/null 2>&1; then
|
BootstrapRpmCommonBase "$python_pkgs"
|
||||||
pkgs="$pkgs
|
|
||||||
mod_ssl
|
|
||||||
"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! $tool install $yes_flag $QUIET_FLAG $pkgs; then
|
|
||||||
error "Could not install OS dependencies. Aborting bootstrap!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,78 @@
|
|||||||
|
# If new packages are installed by BootstrapRpmCommonBase below, version
|
||||||
|
# numbers in rpm_common.sh and rpm_python3.sh must be increased.
|
||||||
|
|
||||||
|
# Sets TOOL to the name of the package manager
|
||||||
|
# Sets appropriate values for YES_FLAG and QUIET_FLAG based on $ASSUME_YES and $QUIET_FLAG.
|
||||||
|
# Enables EPEL if applicable and possible.
|
||||||
|
InitializeRPMCommonBase() {
|
||||||
|
if type dnf 2>/dev/null
|
||||||
|
then
|
||||||
|
TOOL=dnf
|
||||||
|
elif type yum 2>/dev/null
|
||||||
|
then
|
||||||
|
TOOL=yum
|
||||||
|
|
||||||
|
else
|
||||||
|
error "Neither yum nor dnf found. Aborting bootstrap!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$ASSUME_YES" = 1 ]; then
|
||||||
|
YES_FLAG="-y"
|
||||||
|
fi
|
||||||
|
if [ "$QUIET" = 1 ]; then
|
||||||
|
QUIET_FLAG='--quiet'
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! $TOOL list *virtualenv >/dev/null 2>&1; then
|
||||||
|
echo "To use Certbot, packages from the EPEL repository need to be installed."
|
||||||
|
if ! $TOOL list epel-release >/dev/null 2>&1; then
|
||||||
|
error "Enable the EPEL repository and try running Certbot again."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ "$ASSUME_YES" = 1 ]; then
|
||||||
|
/bin/echo -n "Enabling the EPEL repository in 3 seconds..."
|
||||||
|
sleep 1s
|
||||||
|
/bin/echo -ne "\e[0K\rEnabling the EPEL repository in 2 seconds..."
|
||||||
|
sleep 1s
|
||||||
|
/bin/echo -e "\e[0K\rEnabling the EPEL repository in 1 seconds..."
|
||||||
|
sleep 1s
|
||||||
|
fi
|
||||||
|
if ! $TOOL install $YES_FLAG $QUIET_FLAG epel-release; then
|
||||||
|
error "Could not enable EPEL. Aborting bootstrap!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
BootstrapRpmCommonBase() {
|
||||||
|
# Arguments: whitespace-delimited python packages to install
|
||||||
|
|
||||||
|
InitializeRPMCommonBase # This call is superfluous in practice
|
||||||
|
|
||||||
|
pkgs="
|
||||||
|
gcc
|
||||||
|
augeas-libs
|
||||||
|
openssl
|
||||||
|
openssl-devel
|
||||||
|
libffi-devel
|
||||||
|
redhat-rpm-config
|
||||||
|
ca-certificates
|
||||||
|
"
|
||||||
|
|
||||||
|
# Add the python packages
|
||||||
|
pkgs="$pkgs
|
||||||
|
$1
|
||||||
|
"
|
||||||
|
|
||||||
|
if $TOOL list installed "httpd" >/dev/null 2>&1; then
|
||||||
|
pkgs="$pkgs
|
||||||
|
mod_ssl
|
||||||
|
"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! $TOOL install $YES_FLAG $QUIET_FLAG $pkgs; then
|
||||||
|
error "Could not install OS dependencies. Aborting bootstrap!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
23
letsencrypt-auto-source/pieces/bootstrappers/rpm_python3.sh
Normal file
23
letsencrypt-auto-source/pieces/bootstrappers/rpm_python3.sh
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
# If new packages are installed by BootstrapRpmPython3 below, this version
|
||||||
|
# number must be increased.
|
||||||
|
BOOTSTRAP_RPM_PYTHON3_VERSION=1
|
||||||
|
|
||||||
|
BootstrapRpmPython3() {
|
||||||
|
# Tested with:
|
||||||
|
# - CentOS 6
|
||||||
|
|
||||||
|
InitializeRPMCommonBase
|
||||||
|
|
||||||
|
# EPEL uses python34
|
||||||
|
if $TOOL list python34 >/dev/null 2>&1; then
|
||||||
|
python_pkgs="python34
|
||||||
|
python34-devel
|
||||||
|
python34-tools
|
||||||
|
"
|
||||||
|
else
|
||||||
|
error "No supported Python package available to install. Aborting bootstrap!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
BootstrapRpmCommonBase "$python_pkgs"
|
||||||
|
}
|
||||||
@@ -11,17 +11,22 @@ On failure, return non-zero.
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function, unicode_literals
|
||||||
|
|
||||||
from distutils.version import LooseVersion
|
from distutils.version import LooseVersion
|
||||||
from json import loads
|
from json import loads
|
||||||
from os import devnull, environ
|
from os import devnull, environ
|
||||||
from os.path import dirname, join
|
from os.path import dirname, join
|
||||||
import re
|
import re
|
||||||
|
import ssl
|
||||||
from subprocess import check_call, CalledProcessError
|
from subprocess import check_call, CalledProcessError
|
||||||
from sys import argv, exit
|
from sys import argv, exit
|
||||||
from urllib2 import build_opener, HTTPHandler, HTTPSHandler
|
try:
|
||||||
from urllib2 import HTTPError, URLError
|
from urllib2 import build_opener, HTTPHandler, HTTPSHandler
|
||||||
|
from urllib2 import HTTPError, URLError
|
||||||
|
except ImportError:
|
||||||
|
from urllib.request import build_opener, HTTPHandler, HTTPSHandler
|
||||||
|
from urllib.error import HTTPError, URLError
|
||||||
|
|
||||||
PUBLIC_KEY = environ.get('LE_AUTO_PUBLIC_KEY', """-----BEGIN PUBLIC KEY-----
|
PUBLIC_KEY = environ.get('LE_AUTO_PUBLIC_KEY', """-----BEGIN PUBLIC KEY-----
|
||||||
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA6MR8W/galdxnpGqBsYbq
|
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA6MR8W/galdxnpGqBsYbq
|
||||||
@@ -43,8 +48,11 @@ class HttpsGetter(object):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
"""Build an HTTPS opener."""
|
"""Build an HTTPS opener."""
|
||||||
# Based on pip 1.4.1's URLOpener
|
# Based on pip 1.4.1's URLOpener
|
||||||
# This verifies certs on only Python >=2.7.9.
|
# This verifies certs on only Python >=2.7.9, and when NO_CERT_VERIFY isn't set.
|
||||||
self._opener = build_opener(HTTPSHandler())
|
if environ.get('NO_CERT_VERIFY') == '1' and hasattr(ssl, 'SSLContext'):
|
||||||
|
self._opener = build_opener(HTTPSHandler(context=create_CERT_NONE_context()))
|
||||||
|
else:
|
||||||
|
self._opener = build_opener(HTTPSHandler())
|
||||||
# Strip out HTTPHandler to prevent MITM spoof:
|
# Strip out HTTPHandler to prevent MITM spoof:
|
||||||
for handler in self._opener.handlers:
|
for handler in self._opener.handlers:
|
||||||
if isinstance(handler, HTTPHandler):
|
if isinstance(handler, HTTPHandler):
|
||||||
@@ -66,7 +74,7 @@ class HttpsGetter(object):
|
|||||||
|
|
||||||
def write(contents, dir, filename):
|
def write(contents, dir, filename):
|
||||||
"""Write something to a file in a certain directory."""
|
"""Write something to a file in a certain directory."""
|
||||||
with open(join(dir, filename), 'w') as file:
|
with open(join(dir, filename), 'wb') as file:
|
||||||
file.write(contents)
|
file.write(contents)
|
||||||
|
|
||||||
|
|
||||||
@@ -74,13 +82,13 @@ def latest_stable_version(get):
|
|||||||
"""Return the latest stable release of letsencrypt."""
|
"""Return the latest stable release of letsencrypt."""
|
||||||
metadata = loads(get(
|
metadata = loads(get(
|
||||||
environ.get('LE_AUTO_JSON_URL',
|
environ.get('LE_AUTO_JSON_URL',
|
||||||
'https://pypi.python.org/pypi/certbot/json')))
|
'https://pypi.python.org/pypi/certbot/json')).decode('UTF-8'))
|
||||||
# metadata['info']['version'] actually returns the latest of any kind of
|
# metadata['info']['version'] actually returns the latest of any kind of
|
||||||
# release release, contrary to https://wiki.python.org/moin/PyPIJSON.
|
# release release, contrary to https://wiki.python.org/moin/PyPIJSON.
|
||||||
# The regex is a sufficient regex for picking out prereleases for most
|
# The regex is a sufficient regex for picking out prereleases for most
|
||||||
# packages, LE included.
|
# packages, LE included.
|
||||||
return str(max(LooseVersion(r) for r
|
return str(max(LooseVersion(r) for r
|
||||||
in metadata['releases'].iterkeys()
|
in iter(metadata['releases'].keys())
|
||||||
if re.match('^[0-9.]+$', r)))
|
if re.match('^[0-9.]+$', r)))
|
||||||
|
|
||||||
|
|
||||||
@@ -97,7 +105,7 @@ def verified_new_le_auto(get, tag, temp_dir):
|
|||||||
'letsencrypt-auto-source/') % tag
|
'letsencrypt-auto-source/') % tag
|
||||||
write(get(le_auto_dir + 'letsencrypt-auto'), temp_dir, 'letsencrypt-auto')
|
write(get(le_auto_dir + 'letsencrypt-auto'), temp_dir, 'letsencrypt-auto')
|
||||||
write(get(le_auto_dir + 'letsencrypt-auto.sig'), temp_dir, 'letsencrypt-auto.sig')
|
write(get(le_auto_dir + 'letsencrypt-auto.sig'), temp_dir, 'letsencrypt-auto.sig')
|
||||||
write(PUBLIC_KEY, temp_dir, 'public_key.pem')
|
write(PUBLIC_KEY.encode('UTF-8'), temp_dir, 'public_key.pem')
|
||||||
try:
|
try:
|
||||||
with open(devnull, 'w') as dev_null:
|
with open(devnull, 'w') as dev_null:
|
||||||
check_call(['openssl', 'dgst', '-sha256', '-verify',
|
check_call(['openssl', 'dgst', '-sha256', '-verify',
|
||||||
@@ -112,6 +120,14 @@ def verified_new_le_auto(get, tag, temp_dir):
|
|||||||
"certbot-auto.", exc)
|
"certbot-auto.", exc)
|
||||||
|
|
||||||
|
|
||||||
|
def create_CERT_NONE_context():
|
||||||
|
"""Create a SSLContext object to not check hostname."""
|
||||||
|
# PROTOCOL_TLS isn't available before 2.7.13 but this code is for 2.7.9+, so use this.
|
||||||
|
context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
|
||||||
|
context.verify_mode = ssl.CERT_NONE
|
||||||
|
return context
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
get = HttpsGetter().get
|
get = HttpsGetter().get
|
||||||
flag = argv[1]
|
flag = argv[1]
|
||||||
|
|||||||
@@ -202,6 +202,7 @@ LsIVPBuy9IcgHidUQ96hJnoPsDCWsHwX62495QKEarauyKQrJzFes0EY95orDM47
|
|||||||
Z5o/NDiQB11m91yNB0MmPYY9QSbnOA9j7IaaC97AwRLuwXY+/R2ablTcxurWou68
|
Z5o/NDiQB11m91yNB0MmPYY9QSbnOA9j7IaaC97AwRLuwXY+/R2ablTcxurWou68
|
||||||
iQIDAQAB
|
iQIDAQAB
|
||||||
-----END PUBLIC KEY-----""",
|
-----END PUBLIC KEY-----""",
|
||||||
|
NO_CERT_VERIFY='1',
|
||||||
**kwargs)
|
**kwargs)
|
||||||
env.update(d)
|
env.update(d)
|
||||||
return out_and_err(
|
return out_and_err(
|
||||||
@@ -349,6 +350,7 @@ class AutoTests(TestCase):
|
|||||||
self.assertTrue("Couldn't verify signature of downloaded "
|
self.assertTrue("Couldn't verify signature of downloaded "
|
||||||
"certbot-auto." in exc.output)
|
"certbot-auto." in exc.output)
|
||||||
else:
|
else:
|
||||||
|
print(out)
|
||||||
self.fail('Signature check on certbot-auto erroneously passed.')
|
self.fail('Signature check on certbot-auto erroneously passed.')
|
||||||
|
|
||||||
def test_pip_failure(self):
|
def test_pip_failure(self):
|
||||||
|
|||||||
65
letsencrypt-auto-source/tests/centos6_tests.sh
Normal file
65
letsencrypt-auto-source/tests/centos6_tests.sh
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Start by making sure your system is up-to-date:
|
||||||
|
yum update > /dev/null
|
||||||
|
yum install -y centos-release-scl > /dev/null
|
||||||
|
yum install -y python27 > /dev/null 2> /dev/null
|
||||||
|
|
||||||
|
# we're going to modify env variables, so do this in a subshell
|
||||||
|
(
|
||||||
|
source /opt/rh/python27/enable
|
||||||
|
|
||||||
|
# ensure python 3 isn't installed
|
||||||
|
python3 --version 2> /dev/null
|
||||||
|
RESULT=$?
|
||||||
|
if [ $RESULT -eq 0 ]; then
|
||||||
|
error "Python3 is already installed."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# ensure python2.7 is available
|
||||||
|
python2.7 --version 2> /dev/null
|
||||||
|
RESULT=$?
|
||||||
|
if [ $RESULT -ne 0 ]; then
|
||||||
|
error "Python3 is not available."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# bootstrap, but don't install python 3.
|
||||||
|
certbot/letsencrypt-auto-source/letsencrypt-auto --no-self-upgrade -n > /dev/null 2> /dev/null
|
||||||
|
|
||||||
|
# ensure python 3 isn't installed
|
||||||
|
python3 --version 2> /dev/null
|
||||||
|
RESULT=$?
|
||||||
|
if [ $RESULT -eq 0 ]; then
|
||||||
|
error "letsencrypt-auto installed Python3 even though Python2.7 is present."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "PASSED: Did not upgrade to Python3 when Python2.7 is present."
|
||||||
|
)
|
||||||
|
|
||||||
|
# ensure python2.7 isn't available
|
||||||
|
python2.7 --version 2> /dev/null
|
||||||
|
RESULT=$?
|
||||||
|
if [ $RESULT -eq 0 ]; then
|
||||||
|
error "Python2.7 is still available."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# bootstrap, this time installing python3
|
||||||
|
certbot/letsencrypt-auto-source/letsencrypt-auto --no-self-upgrade -n > /dev/null 2> /dev/null
|
||||||
|
|
||||||
|
# ensure python 3 is installed
|
||||||
|
python3 --version > /dev/null
|
||||||
|
RESULT=$?
|
||||||
|
if [ $RESULT -ne 0 ]; then
|
||||||
|
error "letsencrypt-auto failed to install Python3 when only Python2.6 is present."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "PASSED: Successfully upgraded to Python3 when only Python2.6 is present."
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# test using python3
|
||||||
|
pytest -v -s certbot/letsencrypt-auto-source/tests
|
||||||
Reference in New Issue
Block a user