Bug 1555464
Summary: | ocf:heartbeat:exportfs: Character class in square brackets causes monitor operation to fail | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Product: | Red Hat Enterprise Linux 7 | Reporter: | Reid Wahl <nwahl> | ||||||||||
Component: | resource-agents | Assignee: | Oyvind Albrigtsen <oalbrigt> | ||||||||||
Status: | CLOSED ERRATA | QA Contact: | cluster-qe <cluster-qe> | ||||||||||
Severity: | unspecified | Docs Contact: | |||||||||||
Priority: | unspecified | ||||||||||||
Version: | 7.4 | CC: | agk, cluster-maint, fdinitto, mlisik, ngore, nwahl | ||||||||||
Target Milestone: | rc | ||||||||||||
Target Release: | --- | ||||||||||||
Hardware: | Unspecified | ||||||||||||
OS: | Unspecified | ||||||||||||
Whiteboard: | |||||||||||||
Fixed In Version: | resource-agents-3.9.5-125.el7 | Doc Type: | If docs needed, set a value | ||||||||||
Doc Text: | Story Points: | --- | |||||||||||
Clone Of: | Environment: | ||||||||||||
Last Closed: | 2018-10-30 11:39:23 UTC | Type: | Bug | ||||||||||
Regression: | --- | Mount Type: | --- | ||||||||||
Documentation: | --- | CRM: | |||||||||||
Verified Versions: | Category: | --- | |||||||||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||||||||
Cloudforms Team: | --- | Target Upstream Version: | |||||||||||
Embargoed: | |||||||||||||
Attachments: |
|
Description
Reid Wahl
2018-03-14 18:43:19 UTC
Created attachment 1408127 [details]
exportfs_test resource with new sed string for testing
Created attachment 1408129 [details]
proposed patch
Changed line 209 from:
spec=$(echo $spec | sed 's/\[//;s/\]//')
to:
spec=$(echo $spec | sed -r 's/^\[(.*:.*)\]/\1/')
We could alternatively remove the opening carat can change it to:
spec=$(echo $spec | sed -r 's/\[(.*:.*)\]/\1/')
I appreciate any feedback.
Upon further testing, I see that my use case is flawed -- "Wildcard characters generally do not work on IP addresses, though they may work by accident when reverse DNS lookups fail." However, the issue would still be present if a user includes square brackets in a hostname wildcard clientspec. Upstream, the bracket stripping has been confined to the start and end of the string. spec="$(echo "$OCF_RESKEY_clientspec" | sed -e 's/^\[*//' -e 's/\]*$//')" I see two issues with this. 1. There's no reason a user should be restricted from opening or closing the clientspec string with a character class wildcard (even though this would likely be rare in practice). 2. This sed operation does not strip the closing bracket if an IPv6 network is specified with a CIDR netmask. # exportfs [fe80::]/64:/var/tmp So my current thought is either: spec=$(echo $spec | sed -r 's/^\[(.*:.*)\]/\1/') or spec=$(echo $spec | sed -r 's%^\[(.*:.*)\](/[0-9]+)?%\1\2%') I've submitted https://github.com/ClusterLabs/resource-agents/pull/1124 as a proposed upstream patch. Created attachment 1411802 [details] proposed patch Using case statement as we have now done in upstream commit https://github.com/ClusterLabs/resource-agents/commit/64d392d412ce9e14d4b33a70cb2180890db15a36. Moved clientspec processing from is_exported() into exportfs_monitor(), as in upstream. Created attachment 1411807 [details] proposed patch Using case statement as we have now done in upstream commit https://github.com/ClusterLabs/resource-agents/commit/64d392d412ce9e14d4b33a70cb2180890db15a36. Moved clientspec processing from is_exported() into exportfs_monitor(), as in upstream. Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2018:3278 |