Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Cause:
User puts special characters into corosync options or values and uses --force to override pcs validation of those.
Consequence:
Pcs prints a warning noting the validation has been overridden and updates corosync.conf. Corosync cannot start / reload its config.
Fix:
Make pcs validate that the entered corosync options and values only contain safe characters and do not break corosync.conf. Inform the user if it's not the case.
Result:
The user cannot make corosync.conf unreadable for corosync by entering special characters in pcs commands.
+++ This bug was initially created as a clone of Bug #1515193 +++
From bz1389209 comment 33:
$ pcs quorum device update model \
"host=$(printf \
"localhost\n}\nheuristics {\nexec_bar: /usr/bin/sh -c 'echo reboot>>/root/.profile||:'\n")"
Need to check with corosync parser which characters should be disallowed.
--- Additional comment from Jan Pokorný [poki] on 2017-11-20 15:55:19 CET ---
This is rather urgent for reasons in [bug 1389209 comment 35].
And rather than being matter of corosync parser, it's a general
deficiency in checking the inputs (possibly from less-privileged
sources, depending on the exact use case) to compose the resulting
corosync.conf from, as currently the precooked configuration
snippets may be injected in "plain unlimited string"-evaluated
instances.
--- Additional comment from Tomas Jelinek on 2017-11-20 16:25:37 CET ---
- { anywhere in a line means start of a section -> disallowed
- } anywhere in a line means end of a section -> disallowed
- \n and \r starts a new line which could be used to set its own key-value or section -> disallowed
- : is allowed, as only the first : in a line matters
- # is allowed, as the # only matters when it is the first character in a line (not considering whitespace)
- there is no escaping available
Created attachment 1579347[details]
proposed fix + tests
With this fix, pcs does not allow characters breaking corosync.conf structure to be put into corosync.conf not even if --force is used.
Forbidden characters in options' values: } { \r \n
Allowed characters in options' names: a-z A-Z 0-9 _ / -
Example:
[root@rh80-node1:~]# pcs quorum device add model net host=rh80-node3 algorithm=lms "port=12345}" "op#tion=value{" --force
Warning: invalid quorum device model option 'op#tion', allowed options are: 'algorithm', 'connect_timeout', 'force_ip_version', 'host', 'port', 'tie_breaker'
Warning: '12345}' is not a valid port value, use a port number (1..65535)
Error: invalid quorum device model option 'op#tion', quorum device model options may contain a-z A-Z 0-9 /_- characters only
Error: port cannot contain {}\n\r characters
Error: op#tion cannot contain {}\n\r characters
Error: Errors have occurred, therefore pcs is unable to continue
[root@rh80-node1:~]# echo $?
1
After Fix:
[ant8 ~] $ rpm -q pcs
pcs-0.10.2-1.el8.x86_64
[ant8 ~] $ pcs quorum device add model net host=rh80-node3 algorithm=lms "port=12345}" "op#tion=value{" --force
Warning: invalid quorum device model option 'op#tion', allowed options are: 'algorithm', 'connect_timeout', 'force_ip_version', 'host', 'port', 'tie_breaker'
Warning: '12345}' is not a valid port value, use a port number (1..65535)
Error: invalid quorum device model option 'op#tion', quorum device model options may contain a-z A-Z 0-9 /_- characters only
Error: port cannot contain {}\n\r characters
Error: op#tion cannot contain {}\n\r characters
Error: Errors have occurred, therefore pcs is unable to continue
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/RHEA-2019:3311