One more comment ... do you want to support these options on Windows?
I think there is some registry entry handling code that will need to
be modified.
--
Russell Bryant
On Wed, Apr 27, 2011 at 1:10 PM, <astokes(a)fedoraproject.org> wrote:
From: Adam Stokes <astokes(a)fedoraproject.org>
- Provide matahari agents ability to enable SSL communication with their brokers.
- Allow agents to define the the certificate name defined during the signing process from
certificate authority
- Keep in mind that ssl-cert-name is the only available option connection level and that
a certificate database and password file need to be defined with
QPID_SSL_CERT_DB
QPID_SSL_CERT_PASSWORD_FILE
Also note that in order to glue all this together the agents will need to make sure that
the sslconnector module is loaded
export QPID_LOAD_MODULE=/path/to/sslconnector.so
(/usr/lib{64}/qpid/client/sslconnector.so)
---
src/lib/mh_agent.cpp | 42 ++++++++++++++++++++++++++++++++----------
1 files changed, 32 insertions(+), 10 deletions(-)
diff --git a/src/lib/mh_agent.cpp b/src/lib/mh_agent.cpp
index d8f8417..67fd53f 100644
--- a/src/lib/mh_agent.cpp
+++ b/src/lib/mh_agent.cpp
@@ -91,6 +91,8 @@ struct option opt[] = {
{"password", required_argument, NULL, 'P'},
{"service", required_argument, NULL, 's'},
{"port", required_argument, NULL, 'p'},
+ {"ssl", no_argument, NULL, 'S'},
+ {"ssl-cert-name", required_argument, NULL, 'N'},
{0, 0, 0, 0}
};
@@ -98,14 +100,16 @@ static void
print_usage(const char *proc_name)
{
printf("Usage:\tmatahari-%sd <options>\n", proc_name);
- printf("\t-d | --daemon run as a daemon.\n");
- printf("\t-h | --help print this help message.\n");
- printf("\t-b | --broker specify broker host name..\n");
- printf("\t-g | --gssapi force GSSAPI authentication.\n");
- printf("\t-u | --username username to use for authentication
purproses.\n");
- printf("\t-P | --password password to use for authentication
purproses.\n");
- printf("\t-s | --service service name to use for authentication
purproses.\n");
- printf("\t-p | --port specify broker port.\n");
+ printf("\t-d | --daemon run as a daemon.\n");
+ printf("\t-h | --help print this help message.\n");
+ printf("\t-b | --broker specify broker host name..\n");
+ printf("\t-g | --gssapi force GSSAPI authentication.\n");
+ printf("\t-u | --username username to use for authentication
purproses.\n");
+ printf("\t-P | --password password to use for authentication
purproses.\n");
+ printf("\t-s | --service service name to use for authentication
purproses.\n");
+ printf("\t-p | --port specify broker port.\n");
+ printf("\t-S | --ssl enable ssl\n");
+ printf("\t-N | --ssl-cert-name specify certificate name.\n");
}
#endif
@@ -140,10 +144,12 @@ MatahariAgent::init(int argc, char **argv, const char* proc_name)
#endif
bool gssapi = false;
+ char *protocol = strdup("tcp");
char *servername = NULL;
char *username = NULL;
char *password = NULL;
char *service = NULL;
+ char *ssl_cert_name = NULL;
int serverport = MATAHARI_PORT;
int res = 0;
@@ -201,7 +207,7 @@ MatahariAgent::init(int argc, char **argv, const char* proc_name)
#else
// Get args
- while ((arg = getopt_long(argc, argv, "hdb:gu:P:s:p:v", opt, &idx)) !=
-1) {
+ while ((arg = getopt_long(argc, argv, "hdb:gu:P:s:p:vSN:", opt, &idx))
!= -1) {
switch (arg) {
case 'h':
case '?':
@@ -258,6 +264,17 @@ MatahariAgent::init(int argc, char **argv, const char* proc_name)
exit(1);
}
break;
+ case 'S':
+ protocol = strdup("ssl");
+ break;
+ case 'N':
+ if (optarg) {
+ ssl_cert_name = strdup(optarg);
+ } else {
+ print_usage(proc_name);
+ exit(1);
+ }
+ break;
default:
fprintf(stderr, "unsupported option '-%c'. See --help.\n",
arg);
print_usage(proc_name);
@@ -301,9 +318,12 @@ MatahariAgent::init(int argc, char **argv, const char* proc_name)
if (gssapi) {
options["sasl-mechanism"] = "GSSAPI";
}
+ if (ssl_cert_name) {
+ options["ssl-cert-name"] = ssl_cert_name;
+ }
std::stringstream url;
- url << servername << ":" << serverport ;
+ url << "amqp:" << protocol << ":" <<
servername << ":" << serverport ;
_amqp_connection = qpid::messaging::Connection(url.str(), options);
_amqp_connection.open();
@@ -332,6 +352,8 @@ return_cleanup:
free(username);
free(password);
free(service);
+ free(ssl_cert_name);
+ free(protocol);
return res;
}
--
1.7.4.4
_______________________________________________
Matahari mailing list
Matahari(a)lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/matahari