Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 696160 Details for
Bug 710429
qpid-cluster, qpid-tool and qmf-tool do not allow SASL mechanism to be chosen
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Adds --sasl-mechanism --ssl-certificate and --ssl-key to qpid-tool and changes qpid-config usage text
qpid-tool-bz710429.patch (text/plain), 4.84 KB, created by
Ernie
on 2013-02-11 15:58:41 UTC
(
hide
)
Description:
Adds --sasl-mechanism --ssl-certificate and --ssl-key to qpid-tool and changes qpid-config usage text
Filename:
MIME Type:
Creator:
Ernie
Created:
2013-02-11 15:58:41 UTC
Size:
4.84 KB
patch
obsolete
>diff --git a/qpid/tools/src/py/qpid-tool b/qpid/tools/src/py/qpid-tool >index 4afa18d..9dc38a9 100755 >--- a/qpid/tools/src/py/qpid-tool >+++ b/qpid/tools/src/py/qpid-tool >@@ -20,7 +20,7 @@ > # > > import os >-import optparse >+from optparse import OptionParser > import sys > import socket > from types import * >@@ -32,6 +32,11 @@ from qpid.disp import Display > from qpid.peer import Closed > from qmf.console import Session, Console, SchemaClass, ObjectId > >+class Config: >+ def __init__(self): >+ self._host = "localhost" >+ self._conn_options = {} >+ > class Mcli(Cmd): > """ Management Command Interpreter """ > >@@ -173,11 +178,11 @@ class Mcli(Cmd): > class QmfData(Console): > """ > """ >- def __init__(self, disp, url, cert): >+ def __init__(self, disp, url, conn_options={}): > self.disp = disp > self.url = url > self.session = Session(self, manageConnections=True) >- self.broker = self.session.addBroker(self.url, ssl_certfile=cert) >+ self.broker = self.session.addBroker(self.url, **conn_options) > self.lock = Lock() > self.connected = None > self.closing = None >@@ -701,53 +706,68 @@ class IdRegistry(object): > agent = 'Broker' > return (displayId, bootSeq, agent, oid.getObject()) > >- > def Usage(): >- print "Usage: qpid-tool [[<username>/<password>@]<target-host>[:<tcp-port>]]" >+ print "Usage: qpid-tool [options] [[<username>/<password>@]<target-host>[:<tcp-port>]] [cert]" > print > > #========================================================= > # Main Program > #========================================================= >- >-# Get host name and port if specified on the command line >-cargs = sys.argv[1:] >-_host = "localhost" >- >-if len(cargs) > 0: >- _host = cargs[0] >- >-if _host[0] == '-': >- Usage() >- if _host != '-h' and _host != "--help": >- print "qpid-tool: error: no such option:", _host >- sys.exit(1) >- >-disp = Display() >-cert = None >-if len(cargs) > 1: >- cert = cargs[1] >- >-# Attempt to make a connection to the target broker >-try: >- data = QmfData(disp, _host, cert) >-except Exception, e: >- if str(e).find("Exchange not found") != -1: >- print "Management not enabled on broker: Use '-m yes' option on broker startup." >- else: >+def main(argv=None): >+ >+ config = Config() >+ >+ parser = OptionParser(usage="Usage: %prog [options] [[<username>/<password>@]<target-host>[:<tcp-port>]]", >+ description="Example: $ qpid-tool -sasl-mechanism ANONYMOUS guest/guest@localhost:10000") >+ >+ parser.add_option("--sasl-mechanism", action="store", type="string", metavar="<mech>", help="SASL mechanism for authentication (e.g. EXTERNAL, ANONYMOUS, PLAIN, CRAM-MD, DIGEST-MD5, GSSAPI). SASL automatically picks the most secure available mechanism - use this option to override.") >+ parser.add_option("--ssl-certificate", action="store", type="string", metavar="<cert>", help="Client SSL certificate (PEM Format)") >+ parser.add_option("--ssl-key", action="store", type="string", metavar="<key>", help="Client SSL private key (PEM Format)") >+ >+ opts, args = parser.parse_args(args=argv) >+ >+ disp = Display() >+ # Get host name and port if specified on the command line >+ if len(args) > 0: >+ config._host = args[0] >+ >+ # For backward compatibility, allow the cert to be passed after the broker >+ if len(args) > 1: >+ config._conn_options['ssl_certfile'] = args[1] >+ >+ if opts.sasl_mechanism: >+ config._conn_options['mechanisms'] = opts.sasl_mechanism >+ if opts.ssl_certificate: >+ # this overrides any cert passed after the broker on the command line >+ config._conn_options['ssl_certfile'] = opts.ssl_certificate >+ if opts.ssl_key: >+ if not opts.ssl_certificate: >+ parser.error("missing '--ssl-certificate' (required by '--ssl-key')") >+ config._conn_options['ssl_keyfile'] = opts.ssl_key >+ >+ # Attempt to make a connection to the target broker >+ try: >+ data = QmfData(disp, config._host, conn_options=config._conn_options) >+ except Exception, e: >+ if str(e).find("Exchange not found") != -1: >+ print "Management not enabled on broker: Use '-m yes' option on broker startup." >+ else: >+ print "Failed: %s - %s" % (e.__class__.__name__, e) >+ return 1 >+ >+ # Instantiate the CLI interpreter and launch it. >+ cli = Mcli(data, disp) >+ print("Management Tool for QPID") >+ try: >+ cli.cmdloop() >+ except KeyboardInterrupt: >+ print >+ print "Exiting..." >+ except Exception, e: > print "Failed: %s - %s" % (e.__class__.__name__, e) >- sys.exit(1) >- >-# Instantiate the CLI interpreter and launch it. >-cli = Mcli(data, disp) >-print("Management Tool for QPID") >-try: >- cli.cmdloop() >-except KeyboardInterrupt: >- print >- print "Exiting..." >-except Exception, e: >- print "Failed: %s - %s" % (e.__class__.__name__, e) > >-# alway attempt to cleanup broker resources >-data.close() >+ # alway attempt to cleanup broker resources >+ data.close() >+ >+if __name__ == "__main__": >+ sys.exit(main())
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 710429
:
691644
|
696160
|
738574