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: The `pcs host auth` command does not validate network port.
Consequence: Python traceback is propagated to the user in the case when invalid port was given.
Fix: Catch an exeption in case when port is invalid and display proper error message to the user.
Result: The user is informed about invalid port by error message and proper port range is displayed.
Description of problem:
Pcs exits with traceback when port with invalid value was given to the auth command.
Version-Release number of selected component (if applicable):
pcs-0.10.1-4.el8
How reproducible:
always
Steps to Reproduce:
1. run auth command with some invalid port value
[root@virt-157 ~]# pcs host auth node-01 -u hacluster -p password addr=virt-157.cluster-qe.lab.eng.brq.redhat.com:70000
Traceback (most recent call last):
File "/usr/sbin/pcs", line 11, in <module>
load_entry_point('pcs==0.10.1', 'console_scripts', 'pcs')()
File "/usr/lib/python3.6/site-packages/pcs/app.py", line 178, in main
utils.get_input_modifiers(),
File "/usr/lib/python3.6/site-packages/pcs/host.py", line 22, in host_cmd
auth_cmd(lib, argv_next, modifiers)
File "/usr/lib/python3.6/site-packages/pcs/host.py", line 73, in auth_cmd
"host name"
File "/usr/lib/python3.6/site-packages/pcs/host.py", line 71, in <dictcomp>
for host, opts in parse_args.split_list_by_any_keywords(
File "/usr/lib/python3.6/site-packages/pcs/host.py", line 45, in _parse_host_options
addr, port = _parse_addr(parsed_options.get(ADDR_OPT_KEYWORD, host))
File "/usr/lib/python3.6/site-packages/pcs/host.py", line 55, in _parse_addr
return url.hostname, (url.port if url.port else settings.pcsd_default_port)
File "/usr/lib64/python3.6/urllib/parse.py", line 171, in port
raise ValueError("Port out of range 0-65535")
ValueError: Port out of range 0-65535
[root@virt-157 ~]# echo $?
1
[root@virt-157 ~]# pcs host auth node-01 -u hacluster -p password addr=virt-157.cluster-qe.lab.eng.brq.redhat.com:port
Traceback (most recent call last):
File "/usr/sbin/pcs", line 11, in <module>
load_entry_point('pcs==0.10.1', 'console_scripts', 'pcs')()
File "/usr/lib/python3.6/site-packages/pcs/app.py", line 178, in main
utils.get_input_modifiers(),
File "/usr/lib/python3.6/site-packages/pcs/host.py", line 22, in host_cmd
auth_cmd(lib, argv_next, modifiers)
File "/usr/lib/python3.6/site-packages/pcs/host.py", line 73, in auth_cmd
"host name"
File "/usr/lib/python3.6/site-packages/pcs/host.py", line 71, in <dictcomp>
for host, opts in parse_args.split_list_by_any_keywords(
File "/usr/lib/python3.6/site-packages/pcs/host.py", line 45, in _parse_host_options
addr, port = _parse_addr(parsed_options.get(ADDR_OPT_KEYWORD, host))
File "/usr/lib/python3.6/site-packages/pcs/host.py", line 55, in _parse_addr
return url.hostname, (url.port if url.port else settings.pcsd_default_port)
File "/usr/lib64/python3.6/urllib/parse.py", line 169, in port
port = int(port, 10)
ValueError: invalid literal for int() with base 10: 'port'
[root@virt-157 ~]# echo $?
1
Actual results:
pcs exits with a traceback.
Expected results:
pcs exits with some error message.
Additional info:
Created attachment 1626534[details]
proposed fix
Test:
1. Use some port out of range with address specified in `pcs auth host` command.
2. Error message should be displayed instead of python traceback.
[root@r81-node-01 pcs]# lpcs host auth node-001 -u hacluster -p password addr=virt-001.cluster-qe.lab.eng.brq.redhat.com:65536
Error: Invalid port number in address 'virt-001.cluster-qe.lab.eng.brq.redhat.com:65536', use 1..65535
[root@r81-node-01 pcs]# lpcs host auth node-001 -u hacluster -p password addr=virt-001.cluster-qe.lab.eng.brq.redhat.com:notaportnumber
Error: Invalid port number in address 'virt-001.cluster-qe.lab.eng.brq.redhat.com:notaportnumber', use 1..65535
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-2020:1568
Description of problem: Pcs exits with traceback when port with invalid value was given to the auth command. Version-Release number of selected component (if applicable): pcs-0.10.1-4.el8 How reproducible: always Steps to Reproduce: 1. run auth command with some invalid port value [root@virt-157 ~]# pcs host auth node-01 -u hacluster -p password addr=virt-157.cluster-qe.lab.eng.brq.redhat.com:70000 Traceback (most recent call last): File "/usr/sbin/pcs", line 11, in <module> load_entry_point('pcs==0.10.1', 'console_scripts', 'pcs')() File "/usr/lib/python3.6/site-packages/pcs/app.py", line 178, in main utils.get_input_modifiers(), File "/usr/lib/python3.6/site-packages/pcs/host.py", line 22, in host_cmd auth_cmd(lib, argv_next, modifiers) File "/usr/lib/python3.6/site-packages/pcs/host.py", line 73, in auth_cmd "host name" File "/usr/lib/python3.6/site-packages/pcs/host.py", line 71, in <dictcomp> for host, opts in parse_args.split_list_by_any_keywords( File "/usr/lib/python3.6/site-packages/pcs/host.py", line 45, in _parse_host_options addr, port = _parse_addr(parsed_options.get(ADDR_OPT_KEYWORD, host)) File "/usr/lib/python3.6/site-packages/pcs/host.py", line 55, in _parse_addr return url.hostname, (url.port if url.port else settings.pcsd_default_port) File "/usr/lib64/python3.6/urllib/parse.py", line 171, in port raise ValueError("Port out of range 0-65535") ValueError: Port out of range 0-65535 [root@virt-157 ~]# echo $? 1 [root@virt-157 ~]# pcs host auth node-01 -u hacluster -p password addr=virt-157.cluster-qe.lab.eng.brq.redhat.com:port Traceback (most recent call last): File "/usr/sbin/pcs", line 11, in <module> load_entry_point('pcs==0.10.1', 'console_scripts', 'pcs')() File "/usr/lib/python3.6/site-packages/pcs/app.py", line 178, in main utils.get_input_modifiers(), File "/usr/lib/python3.6/site-packages/pcs/host.py", line 22, in host_cmd auth_cmd(lib, argv_next, modifiers) File "/usr/lib/python3.6/site-packages/pcs/host.py", line 73, in auth_cmd "host name" File "/usr/lib/python3.6/site-packages/pcs/host.py", line 71, in <dictcomp> for host, opts in parse_args.split_list_by_any_keywords( File "/usr/lib/python3.6/site-packages/pcs/host.py", line 45, in _parse_host_options addr, port = _parse_addr(parsed_options.get(ADDR_OPT_KEYWORD, host)) File "/usr/lib/python3.6/site-packages/pcs/host.py", line 55, in _parse_addr return url.hostname, (url.port if url.port else settings.pcsd_default_port) File "/usr/lib64/python3.6/urllib/parse.py", line 169, in port port = int(port, 10) ValueError: invalid literal for int() with base 10: 'port' [root@virt-157 ~]# echo $? 1 Actual results: pcs exits with a traceback. Expected results: pcs exits with some error message. Additional info: