From e7563dc98a1001ffffec382bd7b195b7f9ea4148 Mon Sep 17 00:00:00 2001 From: Oguzhan Eris Date: Wed, 28 Sep 2022 21:55:18 -0500 Subject: [PATCH 1/3] Create a new mount option 'forceuseip', that will use the resolved IP address for the EFS fqdn. Useful when Amazon DNS is not used, and when using DNS name for the nfs mount causes issues with kerberos/rpc.gssd --- src/mount_efs/__init__.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/mount_efs/__init__.py b/src/mount_efs/__init__.py index 5c19edca..56fe0bca 100755 --- a/src/mount_efs/__init__.py +++ b/src/mount_efs/__init__.py @@ -220,6 +220,7 @@ "awsprofile", "az", "cafile", + "forceuseip", "iam", "mounttargetip", "netns", @@ -2343,13 +2344,18 @@ def _validate_replacement_field_count(format_str, expected_ct): ip_address=ip_address, fallback_message=fallback_message ) - if dns_name_can_be_resolved(dns_name): - return dns_name, None + if not "forceuseip" in options: + if dns_name_can_be_resolved(dns_name): + return dns_name, None - logging.info( - "Failed to resolve %s, attempting to lookup mount target ip address using botocore.", - dns_name, - ) + logging.info( + "Failed to resolve %s, attempting to lookup mount target ip address using botocore.", + dns_name, + ) + else: + logging.info( + "Forcing the use of IP address in the mount. Attempting to lookup mount target ip address using botocore." + ) try: fallback_mount_target_ip_address = get_fallback_mount_target_ip_address( From 479be4c1dda6b69cabdb2dbd3d52f25d89b12bad Mon Sep 17 00:00:00 2001 From: Oguzhan Eris Date: Thu, 29 Sep 2022 08:40:23 -0500 Subject: [PATCH 2/3] Add forceuseip option to README --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 9335eae4..43bfb698 100644 --- a/README.md +++ b/README.md @@ -209,6 +209,12 @@ The access point must be in the "available" state before it can be used to mount $ sudo mount -t efs -o tls,accesspoint=access-point-id file-system-id efs-mount-point/ ``` +To not use the DNS name in the mount command, and force the use of the resolved IP instead. This option requires that `fall_back_to_mount_target_ip_address_enabled = true` is set in efs-utils.conf under the `[mount]` section. + +```bash +$ sudo mount -t efs -o forceuseip file-system-id efs-mount-point/ +``` + To mount your file system automatically with any of the options above, you can add entries to `/efs/fstab` like: ```bash From 7a1207f7a3a8c1a4eacefcab73a108c3e583f8a9 Mon Sep 17 00:00:00 2001 From: Oguzhan Eris Date: Thu, 29 Sep 2022 14:50:11 -0500 Subject: [PATCH 3/3] Fix indentation and conditional based on linter checks --- src/mount_efs/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mount_efs/__init__.py b/src/mount_efs/__init__.py index 56fe0bca..784cc22c 100755 --- a/src/mount_efs/__init__.py +++ b/src/mount_efs/__init__.py @@ -2344,7 +2344,7 @@ def _validate_replacement_field_count(format_str, expected_ct): ip_address=ip_address, fallback_message=fallback_message ) - if not "forceuseip" in options: + if "forceuseip" not in options: if dns_name_can_be_resolved(dns_name): return dns_name, None @@ -2353,9 +2353,9 @@ def _validate_replacement_field_count(format_str, expected_ct): dns_name, ) else: - logging.info( - "Forcing the use of IP address in the mount. Attempting to lookup mount target ip address using botocore." - ) + logging.info( + "Forcing the use of IP address in the mount. Attempting to lookup mount target ip address using botocore." + ) try: fallback_mount_target_ip_address = get_fallback_mount_target_ip_address(