1
0
forked from pool/aws-efs-utils
aws-efs-utils/0005-watchdog-be-robust-against-unrelated-localhost-based.patch
Robert Schweikert 37b1e47732 Accepting request 690895 from home:glaubitz:branches:Cloud:Tools
- Include hardening and robustness fixes from security audit (bsc#1125133)
  + 0001-subprocess-usage-explicitly-pass-close_fds-True.patch
  + 0002-state_file_dir-choose-safe-default-mode-make-mode-co.patch
  + 0003-pytest-adjust-tests-to-new-state_file_dir_mode-confi.patch
  + 0004-choose_tls_port-reuse-socket-and-explicitly-close-it.patch
  + 0005-watchdog-be-robust-against-unrelated-localhost-based.patch

OBS-URL: https://build.opensuse.org/request/show/690895
OBS-URL: https://build.opensuse.org/package/show/Cloud:Tools/aws-efs-utils?expand=0&rev=5
2019-04-03 15:51:34 +00:00

46 lines
1.4 KiB
Diff

From abe6750a7ee39852b011faa0791963d854788984 Mon Sep 17 00:00:00 2001
From: Matthias Gerstner <matthias.gerstner@suse.de>
Date: Wed, 20 Feb 2019 11:19:28 +0100
Subject: [PATCH 5/6] watchdog: be robust against unrelated localhost based nfs
mounts
While a bit exotic there can exist mounts of locally exported nfs
shares that aren't related to EFS. In this case the watchdog fails,
because it tries to access the port option that is not present in these
unrelated mount entries.
To fix this discard entries from /proc/mounts that don't carry a port
option.
---
src/watchdog/__init__.py | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/watchdog/__init__.py b/src/watchdog/__init__.py
index caca0d9..d002cf9 100755
--- a/src/watchdog/__init__.py
+++ b/src/watchdog/__init__.py
@@ -95,6 +95,9 @@ def get_file_safe_mountpoint(mount):
mountpoint = mountpoint[1:]
opts = parse_options(mount.options)
+ if 'port' not in opts:
+ # some other localhost nfs mount not running over stunnel
+ return None
return mountpoint + '.' + opts['port']
@@ -113,7 +116,9 @@ def get_current_local_nfs_mounts(mount_file='/proc/mounts'):
mount_dict = {}
for m in mounts:
- mount_dict[get_file_safe_mountpoint(m)] = m
+ safe_mnt = get_file_safe_mountpoint(m)
+ if safe_mnt:
+ mount_dict[safe_mnt] = m
return mount_dict
--
2.21.0