提交 6d310c9c 编写于 作者: D Daniel P. Berrange

remote: allow TLS priority to be customized

Support reading the TLS priority from the client configuration
file via the "tls_priority" config option, eg

 $ cat $HOME/.config/libvirt/libvirt.conf
 tls_priority="NORMAL:-VERS-SSL3.0"
Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
上级 5f1837ea
...@@ -638,6 +638,7 @@ static int ...@@ -638,6 +638,7 @@ static int
doRemoteOpen(virConnectPtr conn, doRemoteOpen(virConnectPtr conn,
struct private_data *priv, struct private_data *priv,
virConnectAuthPtr auth ATTRIBUTE_UNUSED, virConnectAuthPtr auth ATTRIBUTE_UNUSED,
virConfPtr conf,
unsigned int flags) unsigned int flags)
{ {
char *transport_str = NULL; char *transport_str = NULL;
...@@ -844,6 +845,19 @@ doRemoteOpen(virConnectPtr conn, ...@@ -844,6 +845,19 @@ doRemoteOpen(virConnectPtr conn,
/* Connect to the remote service. */ /* Connect to the remote service. */
switch (transport) { switch (transport) {
case trans_tls: case trans_tls:
if (conf && !tls_priority) {
virConfValuePtr val = virConfGetValue(conf, "tls_priority");
if (val) {
if (val->type != VIR_CONF_STRING) {
virReportError(VIR_ERR_INVALID_ARG, "%s",
_("Config file 'tls_priority' must be a string"));
goto failed;
}
if (VIR_STRDUP(tls_priority, val->str) < 0)
goto failed;
}
}
#ifdef WITH_GNUTLS #ifdef WITH_GNUTLS
priv->tls = virNetTLSContextNewClientPath(pkipath, priv->tls = virNetTLSContextNewClientPath(pkipath,
geteuid() != 0 ? true : false, geteuid() != 0 ? true : false,
...@@ -1180,7 +1194,7 @@ remoteAllocPrivateData(void) ...@@ -1180,7 +1194,7 @@ remoteAllocPrivateData(void)
static virDrvOpenStatus static virDrvOpenStatus
remoteConnectOpen(virConnectPtr conn, remoteConnectOpen(virConnectPtr conn,
virConnectAuthPtr auth, virConnectAuthPtr auth,
virConfPtr conf ATTRIBUTE_UNUSED, virConfPtr conf,
unsigned int flags) unsigned int flags)
{ {
struct private_data *priv; struct private_data *priv;
...@@ -1239,7 +1253,7 @@ remoteConnectOpen(virConnectPtr conn, ...@@ -1239,7 +1253,7 @@ remoteConnectOpen(virConnectPtr conn,
#endif #endif
} }
ret = doRemoteOpen(conn, priv, auth, rflags); ret = doRemoteOpen(conn, priv, auth, conf, rflags);
if (ret != VIR_DRV_OPEN_SUCCESS) { if (ret != VIR_DRV_OPEN_SUCCESS) {
conn->privateData = NULL; conn->privateData = NULL;
remoteDriverUnlock(priv); remoteDriverUnlock(priv);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册