Bug 1386615

Summary: rhn-custom-info should not require CA cert for http:// server
Product: Red Hat Satellite 5 Reporter: Radovan Drazny <rdrazny>
Component: OtherAssignee: Jan Dobes <jdobes>
Status: CLOSED CURRENTRELEASE QA Contact: Lukáš Hellebrandt <lhellebr>
Severity: unspecified Docs Contact: Eric Herget <eherget>
Priority: unspecified    
Version: 570CC: eherget, lhellebr, tlestach
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: rhn-custom-info-5.4.28-4-sat Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-06-21 12:08:12 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:
Bug Depends On:    
Bug Blocks: 1358815    

Description Radovan Drazny 2016-10-19 10:00:16 UTC
Description of problem:
When rhn-custom-info is ran with -s http://<fqdn>, it still requires CA cert from the up2date.conf file. 

Version-Release number of selected component (if applicable):
rhn-custom-info-5.4.26-3.el7sat

How reproducible:
always

Steps to Reproduce:
1. Have a Sat 5.7 server with a client registered, and rhn-custom-info installed on the client. 
2. Remove or rename cert file pointed to by the option sslCACert in /etc/sysconfig/rhn/up2date (usually RHN-ORG-TRUSTED-SSL-CERT).
3. Run the following command on the client:
rhn-custom-info -u admin -p nimda -s http://<satellite-server-fqdn>rpc/api

Actual results:
# rhn-custom-info -u admin -p nimda -s http://host-8-178-229.host.centralci.eng.rdu2.redhat.com/rpc/api bla bla1
Traceback (most recent call last):
  File "/usr/bin/rhn-custom-info", line 250, in <module>
    main()
  File "/usr/bin/rhn-custom-info", line 208, in main
    s = create_server_obj(url)
  File "/usr/bin/rhn-custom-info", line 77, in create_server_obj
    raise "could not find cert %s" % ca_cert
TypeError: exceptions must be old-style classes or derived from BaseException, not unicode

Expected results:
Should communicate with server as expected, or notify user he should use https, if we want to force encryption. 

Additional info:
Beside requiring a ca cert for the http communication, there is a problem with the raised exception itself. The exception is not raised correctly, there is simply "raise 'text string'" on line 77 in /usr/bin/rhn-custom-info, which is not valid Python code. Raise must be followed by a class derived from Exception class, not just a text string with an error message.

Comment 3 Eric Herget 2016-12-06 21:01:38 UTC
spacewalk.github:
e4dae1b4169557f5811dc8d2a6dfa7329b8fec57


fixed in rhn-custom-info-5.4.33-1

Comment 4 Eric Herget 2016-12-06 21:05:10 UTC
satellite:
4adbb02e66e71b246bf8abdf822aae605682e4aa

Comment 5 Lukáš Hellebrandt 2016-12-08 11:12:33 UTC
Verified on Sat5.8 compose from 2016-12-06.

Used reproducer from OP.

When using http in rhn-custom-info, info is now correctly set without cert. When using https with incorrect cert, the exception is raised correctly.