Skip to content

Commit

Permalink
Update Amazon Linux 2 platform to use namespaced stunnel5
Browse files Browse the repository at this point in the history
  • Loading branch information
tmunipre committed Oct 14, 2022
1 parent 71058a0 commit dd8dc31
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 13 deletions.
11 changes: 8 additions & 3 deletions amazon-efs-utils.spec
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,23 @@
%endif

Name : amazon-efs-utils
Version : 1.33.4
Version : 1.34.1
Release : 1%{platform}
Summary : This package provides utilities for simplifying the use of EFS file systems

Group : Amazon/Tools
License : MIT
URL : https://aws.amazon.com/efs

Packager : Amazon.com, Inc. <http://aws.amazon.com>
Vendor : Amazon.com

BuildArch : noarch

Requires : nfs-utils
%if 0%{?amzn2}
Requires : stunnel5
%else
Requires : stunnel >= 4.56
%endif
Requires : %{python_requires}
Requires : openssl >= 1.0.2
Requires : util-linux
Expand Down Expand Up @@ -135,6 +137,9 @@ fi
%clean

%changelog
* Thu Sep 29 2022 Preetham Puneeth Munipalli <tmunipre@amazon.com> - 1.34.1
- Update Amazon Linux 2 platform to use namespaced stunnel5

* Thu Sep 1 2022 Yuan Gao <ygaochn@amazon.com> - 1.33.4
- Fix potential issue where watchdog sending signal to incorrect processes.
- Add support for enabling FIPS mode for both stunnel and AWS API calls.
Expand Down
2 changes: 1 addition & 1 deletion build-deb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ set -ex

BASE_DIR=$(pwd)
BUILD_ROOT=${BASE_DIR}/build/debbuild
VERSION=1.33.4
VERSION=1.34.1
RELEASE=1
DEB_SYSTEM_RELEASE_PATH=/etc/os-release

Expand Down
2 changes: 1 addition & 1 deletion config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
#

[global]
version=1.33.4
version=1.34.1
release=1
2 changes: 1 addition & 1 deletion dist/amazon-efs-utils.control
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: amazon-efs-utils
Architecture: all
Version: 1.33.4
Version: 1.34.1
Section: utils
Depends: python3, nfs-common, stunnel4 (>= 4.56), openssl (>= 1.0.2), util-linux
Priority: optional
Expand Down
13 changes: 7 additions & 6 deletions src/mount_efs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,10 @@
BOTOCORE_PRESENT = False


VERSION = "1.33.4"
VERSION = "1.34.1"
SERVICE = "elasticfilesystem"

AMAZON_LINUX_2_RELEASE_ID = "Amazon Linux release 2 (Karoo)"
CLONE_NEWNET = 0x40000000
CONFIG_FILE = "/etc/amazon/efs/efs-utils.conf"
CONFIG_SECTION = "mount"
Expand Down Expand Up @@ -1095,11 +1096,11 @@ def get_stunnel_options():


def _stunnel_bin():
return find_command_path(
"stunnel",
"Please install it following the instructions at "
"https://docs.aws.amazon.com/efs/latest/ug/using-amazon-efs-utils.html#upgrading-stunnel",
)
installation_message = "Please install it following the instructions at: https://docs.aws.amazon.com/efs/latest/ug/using-amazon-efs-utils.html#upgrading-stunnel"
if get_system_release_version() == AMAZON_LINUX_2_RELEASE_ID:
return find_command_path("stunnel5", installation_message)
else:
return find_command_path("stunnel", installation_message)


def find_command_path(command, install_method):
Expand Down
2 changes: 1 addition & 1 deletion src/watchdog/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
from urllib2 import HTTPError, HTTPHandler, Request, URLError, build_opener, urlopen


VERSION = "1.33.4"
VERSION = "1.34.1"
SERVICE = "elasticfilesystem"

CONFIG_FILE = "/etc/amazon/efs/efs-utils.conf"
Expand Down
31 changes: 31 additions & 0 deletions test/mount_efs_test/test_bootstrap_tls.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
MOUNT_POINT = "/mnt"
REGION = "us-east-1"

NON_AL2_RELEASE_ID_VAL = "FAKE_NON_AL2_RELEASE_ID_VAL"

DEFAULT_TLS_PORT = 20049

EXPECTED_STUNNEL_CONFIG_FILE_BASE = "stunnel-config.fs-deadbeef.mnt."
Expand Down Expand Up @@ -95,6 +97,35 @@ def test_bootstrap_tls_state_file_dir_exists(mocker, tmpdir):
assert EXPECTED_STUNNEL_CONFIG_FILE in args


def test_stunnel5_al2(mocker):
process_mock = MagicMock()
check_output_mock = mocker.patch(
"subprocess.check_output", return_value=process_mock
)
mocker.patch(
"mount_efs.get_system_release_version",
return_value=mount_efs.AMAZON_LINUX_2_RELEASE_ID,
)
mount_efs._stunnel_bin()
args, _ = check_output_mock.call_args
args = args[0]
assert "stunnel5" in args[1]


def test_stunnel5_non_al2(mocker):
process_mock = MagicMock()
check_output_mock = mocker.patch(
"subprocess.check_output", return_value=process_mock
)
mocker.patch(
"mount_efs.get_system_release_version", return_value=NON_AL2_RELEASE_ID_VAL
)
mount_efs._stunnel_bin()
args, _ = check_output_mock.call_args
args = args[0]
assert "stunnel" in args[1]


def test_bootstrap_tls_state_file_nonexistent_dir(mocker, tmpdir):
popen_mock, _ = setup_mocks(mocker)
state_file_dir = str(tmpdir.join(tempfile.mkdtemp()[1]))
Expand Down

0 comments on commit dd8dc31

Please sign in to comment.