def initial_run(connection, crt="/etc/rhui/pem/ca.crt", key="/etc/rhui/pem/ca.key", cert_pw=None, days="", username="******", password="******"): ''' Do rhui-manager initial run ''' Expect.enter(connection, "rhui-manager") state = Expect.expect_list(connection, [(re.compile(".*Full path to the new signing CA certificate:.*", re.DOTALL), 1), (re.compile(".*RHUI Username:.*", re.DOTALL),2), (re.compile(".*rhui \(home\) =>.*", re.DOTALL), 3)]) if state in [1, 2]: if state == 1: # Need to answer sone first-run questions Expect.enter(connection, crt) Expect.expect(connection, "Full path to the new signing CA certificate private key:") Expect.enter(connection, key) Expect.expect(connection, "regenerated using rhui-manager.*:") Expect.enter(connection, days) Expect.expect(connection, "Enter pass phrase for.*:") if cert_pw: Expect.enter(connection, cert_pw) else: Expect.enter(connection, Util.get_ca_password(connection)) Expect.expect(connection, "RHUI Username:"******"RHUI Password:"******"rhui \(home\) =>") else: # initial step was already performed by someone pass Expect.enter(connection, "q")
def generate_new(connection, days="", cert_pw=None): ''' generate a new identity certificate ''' RHUIManager.screen(connection, "identity") Expect.enter(connection, "g") Expect.expect(connection, "Proceed\? \[y/n\]") Expect.enter(connection, "y") Expect.expect(connection, "regenerated using rhui-manager.*:") Expect.enter(connection, days) Expect.expect(connection, "Enter pass phrase for.*:") if cert_pw: Expect.enter(connection, cert_pw) else: Expect.enter(connection, Util.get_ca_password(connection)) RHUIManager.quit(connection, "Successfully regenerated RHUI Identity certificate", 30)
def initial_run(connection, crt="/etc/rhui/pem/ca.crt", key="/etc/rhui/pem/ca.key", cert_pw=None, days="", username="******", password="******"): ''' Do rhui-manager initial run ''' Expect.enter(connection, "rhui-manager") state = Expect.expect_list( connection, [(re.compile(".*Full path to the new signing CA certificate:.*", re.DOTALL), 1), (re.compile(".*RHUI Username:.*", re.DOTALL), 2), (re.compile(".*rhui \(home\) =>.*", re.DOTALL), 3)]) if state in [1, 2]: if state == 1: # Need to answer sone first-run questions Expect.enter(connection, crt) Expect.expect( connection, "Full path to the new signing CA certificate private key:") Expect.enter(connection, key) Expect.expect(connection, "regenerated using rhui-manager.*:") Expect.enter(connection, days) Expect.expect(connection, "Enter pass phrase for.*:") if cert_pw: Expect.enter(connection, cert_pw) else: Expect.enter(connection, Util.get_ca_password(connection)) Expect.expect(connection, "RHUI Username:"******"RHUI Password:"******"rhui \(home\) =>") else: # initial step was already performed by someone pass Expect.enter(connection, "q")
def generate_ent_cert(connection, clustername, repolist, certname, dirname, validity_days="", cert_pw=None): ''' generate an entitlement certificate ''' RHUIManager.screen(connection, "client") Expect.enter(connection, "e") RHUIManager.select_one(connection, clustername) RHUIManager.select(connection, repolist) Expect.expect(connection, "Name of the certificate.*contained with it:") Expect.enter(connection, certname) Expect.expect(connection, "Local directory in which to save the generated certificate.*:") Expect.enter(connection, dirname) Expect.expect(connection, "Number of days the certificate should be valid.*:") Expect.enter(connection, validity_days) RHUIManager.proceed_with_check(connection, "Repositories to be included in the entitlement certificate:", repolist, ["Custom Entitlements", "Red Hat Repositories"]) Expect.expect(connection, "Enter pass phrase for.*:") if cert_pw: Expect.enter(connection, cert_pw) else: Expect.enter(connection, Util.get_ca_password(connection)) RHUIManager.quit(connection)