https://bugzilla.redhat.com/show_bug.cgi?id=1458630
Introduce virQEMUDriverConfigSetCertDir which will handle reading the
qemu.conf config file specific setting for default, vnc, spice, chardev,
and migrate. Then if a setting was provided, validating the existence of
the directory and overwriting the default set by virQEMUDriverConfigNew.
Also update the qemu.conf description for default to indicate the consequences
if the default directory does not exist.
Signed-off-by: John Ferlan <jferlan@redhat.com>
---
src/qemu/qemu.conf | 9 ++++++++-
src/qemu/qemu_conf.c | 42 ++++++++++++++++++++++++++++++++++--------
2 files changed, 42 insertions(+), 9 deletions(-)
diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf
index e6c0832..737fa46 100644
--- a/src/qemu/qemu.conf
+++ b/src/qemu/qemu.conf
@@ -3,7 +3,7 @@
# defaults are used.
# Use of TLS requires that x509 certificates be issued. The default is
-# to keep them in /etc/pki/qemu. This directory must contain
+# to keep them in /etc/pki/qemu. This directory must exist and contain:
#
# ca-cert.pem - the CA master certificate
# server-cert.pem - the server certificate signed with ca-cert.pem
@@ -13,6 +13,13 @@
#
# dh-params.pem - the DH params configuration file
#
+# If the directory does not exist or does not contain the necessary files,
+# QEMU domains will fail to start if they are configured to use TLS.
+#
+# In order to overwrite the default directory alter the following. If the
+# provided directory does not exist, then the setting reverts back to the
+# default /etc/pki/qemu.
+#
#default_tls_x509_cert_dir = "/etc/pki/qemu"
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 94e00b2..a52349f 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -440,6 +440,32 @@ virQEMUDriverConfigHugeTLBFSInit(virHugeTLBFSPtr hugetlbfs,
}
+static int
+virQEMUDriverConfigSetCertDir(virConfPtr conf,
+ const char *setting,
+ char **value)
+{
+ char *tlsCertDir = NULL;
+
+ if (virConfGetValueString(conf, setting, &tlsCertDir) < 0)
+ return -1;
+
+ if (!tlsCertDir)
+ return 0;
+
+ if (!virFileExists(tlsCertDir)) {
+ VIR_INFO("%s, directory '%s' does not exist, retain default",
+ setting, tlsCertDir);
+ VIR_FREE(tlsCertDir);
+ } else {
+ VIR_FREE(*value);
+ VIR_STEAL_PTR(*value, tlsCertDir);
+ }
+
+ return 0;
+}
+
+
int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg,
const char *filename,
bool privileged)
@@ -467,8 +493,8 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg,
if (!(conf = virConfReadFile(filename, 0)))
goto cleanup;
- if (virConfGetValueString(conf, "default_tls_x509_cert_dir",
- &cfg->defaultTLSx509certdir) < 0)
+ if (virQEMUDriverConfigSetCertDir(conf, "default_tls_x509_cert_dir",
+ &cfg->defaultTLSx509certdir) < 0)
goto cleanup;
if (virConfGetValueBool(conf, "default_tls_x509_verify",
&cfg->defaultTLSx509verify) < 0)
@@ -487,8 +513,8 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg,
goto cleanup;
if (rv == 0)
cfg->vncTLSx509verify = cfg->defaultTLSx509verify;
- if (virConfGetValueString(conf, "vnc_tls_x509_cert_dir",
- &cfg->vncTLSx509certdir) < 0)
+ if (virQEMUDriverConfigSetCertDir(conf, "vnc_tls_x509_cert_dir",
+ &cfg->vncTLSx509certdir) < 0)
goto cleanup;
if (virConfGetValueString(conf, "vnc_listen", &cfg->vncListen) < 0)
goto cleanup;
@@ -532,8 +558,8 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg,
if (virConfGetValueBool(conf, "spice_tls", &cfg->spiceTLS) < 0)
goto cleanup;
- if (virConfGetValueString(conf, "spice_tls_x509_cert_dir",
- &cfg->spiceTLSx509certdir) < 0)
+ if (virQEMUDriverConfigSetCertDir(conf, "spice_tls_x509_cert_dir",
+ &cfg->spiceTLSx509certdir) < 0)
goto cleanup;
if (virConfGetValueBool(conf, "spice_sasl", &cfg->spiceSASL) < 0)
goto cleanup;
@@ -554,8 +580,8 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg,
goto cleanup; \
if (rv == 0) \
cfg->val## TLSx509verify = cfg->defaultTLSx509verify; \
- if (virConfGetValueString(conf, #val "_tls_x509_cert_dir", \
- &cfg->val## TLSx509certdir) < 0) \
+ if (virQEMUDriverConfigSetCertDir(conf, #val "_tls_x509_cert_dir", \
+ &cfg->val## TLSx509certdir) < 0) \
goto cleanup; \
if (virConfGetValueString(conf, \
#val "_tls_x509_secret_uuid", \
--
2.9.4
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
On Wed, Jun 28, 2017 at 15:30:28 -0400, John Ferlan wrote: > https://bugzilla.redhat.com/show_bug.cgi?id=1458630 > > Introduce virQEMUDriverConfigSetCertDir which will handle reading the > qemu.conf config file specific setting for default, vnc, spice, chardev, > and migrate. Then if a setting was provided, validating the existence of > the directory and overwriting the default set by virQEMUDriverConfigNew. > > Also update the qemu.conf description for default to indicate the consequences > if the default directory does not exist. > > Signed-off-by: John Ferlan <jferlan@redhat.com> > --- > src/qemu/qemu.conf | 9 ++++++++- > src/qemu/qemu_conf.c | 42 ++++++++++++++++++++++++++++++++++-------- > 2 files changed, 42 insertions(+), 9 deletions(-) > > diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf > index e6c0832..737fa46 100644 > --- a/src/qemu/qemu.conf > +++ b/src/qemu/qemu.conf > @@ -3,7 +3,7 @@ > # defaults are used. > > # Use of TLS requires that x509 certificates be issued. The default is > -# to keep them in /etc/pki/qemu. This directory must contain > +# to keep them in /etc/pki/qemu. This directory must exist and contain: > # > # ca-cert.pem - the CA master certificate > # server-cert.pem - the server certificate signed with ca-cert.pem > @@ -13,6 +13,13 @@ > # > # dh-params.pem - the DH params configuration file > # > +# If the directory does not exist or does not contain the necessary files, > +# QEMU domains will fail to start if they are configured to use TLS. > +# > +# In order to overwrite the default directory alter the following. If the > +# provided directory does not exist, then the setting reverts back to the > +# default /etc/pki/qemu. > +# I don't think this is a good idea. We should use the directory a user specified in qemu.conf. If it doesn't exist, well things won't work. Sure, we can complain about it in the logs, but we should not fallback to any magic default in that case. Anyone setting a custom directory for TLS certificates does this because they want to use it. If the directory does not exist, it's either because they forgot to create it or they made a typo somewhere. It's very unlikely someone actually wants to use a default directory even though they set a custom one. NACK Jirka -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
On 06/29/2017 03:24 AM, Jiri Denemark wrote: > On Wed, Jun 28, 2017 at 15:30:28 -0400, John Ferlan wrote: >> https://bugzilla.redhat.com/show_bug.cgi?id=1458630 >> >> Introduce virQEMUDriverConfigSetCertDir which will handle reading the >> qemu.conf config file specific setting for default, vnc, spice, chardev, >> and migrate. Then if a setting was provided, validating the existence of >> the directory and overwriting the default set by virQEMUDriverConfigNew. >> >> Also update the qemu.conf description for default to indicate the consequences >> if the default directory does not exist. >> >> Signed-off-by: John Ferlan <jferlan@redhat.com> >> --- >> src/qemu/qemu.conf | 9 ++++++++- >> src/qemu/qemu_conf.c | 42 ++++++++++++++++++++++++++++++++++-------- >> 2 files changed, 42 insertions(+), 9 deletions(-) >> >> diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf >> index e6c0832..737fa46 100644 >> --- a/src/qemu/qemu.conf >> +++ b/src/qemu/qemu.conf >> @@ -3,7 +3,7 @@ >> # defaults are used. >> >> # Use of TLS requires that x509 certificates be issued. The default is >> -# to keep them in /etc/pki/qemu. This directory must contain >> +# to keep them in /etc/pki/qemu. This directory must exist and contain: >> # >> # ca-cert.pem - the CA master certificate >> # server-cert.pem - the server certificate signed with ca-cert.pem >> @@ -13,6 +13,13 @@ >> # >> # dh-params.pem - the DH params configuration file >> # >> +# If the directory does not exist or does not contain the necessary files, >> +# QEMU domains will fail to start if they are configured to use TLS. >> +# >> +# In order to overwrite the default directory alter the following. If the >> +# provided directory does not exist, then the setting reverts back to the >> +# default /etc/pki/qemu. >> +# > > I don't think this is a good idea. We should use the directory a user > specified in qemu.conf. If it doesn't exist, well things won't work. > Sure, we can complain about it in the logs, but we should not fallback > to any magic default in that case. Anyone setting a custom directory for > TLS certificates does this because they want to use it. If the directory > does not exist, it's either because they forgot to create it or they > made a typo somewhere. It's very unlikely someone actually wants to use > a default directory even though they set a custom one. > > NACK > > Jirka > It's simple enough to fail, but that's in code which you snipped and not in text description which essentially matched what the code is/was doing. Your feeling is then that : + if (!virFileExists(tlsCertDir)) { + VIR_INFO("%s, directory '%s' does not exist, retain default", + setting, tlsCertDir); + VIR_FREE(tlsCertDir); should fail at libvirtd startup instead of a VIR_INFO, true? Is that true for default, vnc, spice, chardev, and migrate? That's different from the current environment which only would fail for domains that use TLS which is why I was hesitant to make it fail. Also note that if /etc/pki/qemu doesn't exist and someone used a TLS marker, then even without changing any of the *cert_dir values, only the domain will fail to start. That is, /etc/pki/qemu is not checked for existence and startup failure. Altering text in qemu.conf to match what really happens will be simple, but ensuring the approach is agreed upon is what I need to clear up. Tks - John -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
On Thu, Jun 29, 2017 at 09:24:30AM +0200, Jiri Denemark wrote: > On Wed, Jun 28, 2017 at 15:30:28 -0400, John Ferlan wrote: > > https://bugzilla.redhat.com/show_bug.cgi?id=1458630 > > > > Introduce virQEMUDriverConfigSetCertDir which will handle reading the > > qemu.conf config file specific setting for default, vnc, spice, chardev, > > and migrate. Then if a setting was provided, validating the existence of > > the directory and overwriting the default set by virQEMUDriverConfigNew. > > > > Also update the qemu.conf description for default to indicate the consequences > > if the default directory does not exist. > > > > Signed-off-by: John Ferlan <jferlan@redhat.com> > > --- > > src/qemu/qemu.conf | 9 ++++++++- > > src/qemu/qemu_conf.c | 42 ++++++++++++++++++++++++++++++++++-------- > > 2 files changed, 42 insertions(+), 9 deletions(-) > > > > diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf > > index e6c0832..737fa46 100644 > > --- a/src/qemu/qemu.conf > > +++ b/src/qemu/qemu.conf > > @@ -3,7 +3,7 @@ > > # defaults are used. > > > > # Use of TLS requires that x509 certificates be issued. The default is > > -# to keep them in /etc/pki/qemu. This directory must contain > > +# to keep them in /etc/pki/qemu. This directory must exist and contain: > > # > > # ca-cert.pem - the CA master certificate > > # server-cert.pem - the server certificate signed with ca-cert.pem > > @@ -13,6 +13,13 @@ > > # > > # dh-params.pem - the DH params configuration file > > # > > +# If the directory does not exist or does not contain the necessary files, > > +# QEMU domains will fail to start if they are configured to use TLS. > > +# > > +# In order to overwrite the default directory alter the following. If the > > +# provided directory does not exist, then the setting reverts back to the > > +# default /etc/pki/qemu. > > +# > > I don't think this is a good idea. We should use the directory a user > specified in qemu.conf. If it doesn't exist, well things won't work. > Sure, we can complain about it in the logs, but we should not fallback > to any magic default in that case. Anyone setting a custom directory for > TLS certificates does this because they want to use it. If the directory > does not exist, it's either because they forgot to create it or they > made a typo somewhere. It's very unlikely someone actually wants to use > a default directory even though they set a custom one. > > NACK Agreed, I think we need to distinguish between the default dirs for each settings, vs user specified dir for each setting. ie, if the user has *not* set 'chardev_tls_x509_cert_dir' then its default value is '/etc/pki/libvirt-chardev'. If that directory does not exist, then falling back to "default_tls_x509_cert_dir" is good. If the user *has* set 'chardev_tls_x509_cert_dir' and it does nto exist, then we should report an hard error, preferrably at startup so the admin sees their mistake immediately. Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
On 06/29/2017 06:40 AM, Daniel P. Berrange wrote: > On Thu, Jun 29, 2017 at 09:24:30AM +0200, Jiri Denemark wrote: >> On Wed, Jun 28, 2017 at 15:30:28 -0400, John Ferlan wrote: >>> https://bugzilla.redhat.com/show_bug.cgi?id=1458630 >>> >>> Introduce virQEMUDriverConfigSetCertDir which will handle reading the >>> qemu.conf config file specific setting for default, vnc, spice, chardev, >>> and migrate. Then if a setting was provided, validating the existence of >>> the directory and overwriting the default set by virQEMUDriverConfigNew. >>> >>> Also update the qemu.conf description for default to indicate the consequences >>> if the default directory does not exist. >>> >>> Signed-off-by: John Ferlan <jferlan@redhat.com> >>> --- >>> src/qemu/qemu.conf | 9 ++++++++- >>> src/qemu/qemu_conf.c | 42 ++++++++++++++++++++++++++++++++++-------- >>> 2 files changed, 42 insertions(+), 9 deletions(-) >>> >>> diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf >>> index e6c0832..737fa46 100644 >>> --- a/src/qemu/qemu.conf >>> +++ b/src/qemu/qemu.conf >>> @@ -3,7 +3,7 @@ >>> # defaults are used. >>> >>> # Use of TLS requires that x509 certificates be issued. The default is >>> -# to keep them in /etc/pki/qemu. This directory must contain >>> +# to keep them in /etc/pki/qemu. This directory must exist and contain: >>> # >>> # ca-cert.pem - the CA master certificate >>> # server-cert.pem - the server certificate signed with ca-cert.pem >>> @@ -13,6 +13,13 @@ >>> # >>> # dh-params.pem - the DH params configuration file >>> # >>> +# If the directory does not exist or does not contain the necessary files, >>> +# QEMU domains will fail to start if they are configured to use TLS. >>> +# >>> +# In order to overwrite the default directory alter the following. If the >>> +# provided directory does not exist, then the setting reverts back to the >>> +# default /etc/pki/qemu. >>> +# >> >> I don't think this is a good idea. We should use the directory a user >> specified in qemu.conf. If it doesn't exist, well things won't work. >> Sure, we can complain about it in the logs, but we should not fallback >> to any magic default in that case. Anyone setting a custom directory for >> TLS certificates does this because they want to use it. If the directory >> does not exist, it's either because they forgot to create it or they >> made a typo somewhere. It's very unlikely someone actually wants to use >> a default directory even though they set a custom one. >> >> NACK > > Agreed, I think we need to distinguish between the default dirs for each > settings, vs user specified dir for each setting. > > ie, if the user has *not* set 'chardev_tls_x509_cert_dir' then its default > value is '/etc/pki/libvirt-chardev'. If that directory does not exist, > then falling back to "default_tls_x509_cert_dir" is good. This essentially what happens in virQEMUDriverConfigNew. The caveat here is that the default value for default_tls_x509_cert_dir (e.g. /etc/pki/qemu) is not checked for existence, rather it's assumed. > > If the user *has* set 'chardev_tls_x509_cert_dir' and it does nto exist, > then we should report an hard error, preferrably at startup so the admin > sees their mistake immediately. OK and that answers most of the questions I had... If the user changes "default_*" (as processed in virQEMUDriverConfigLoadFile) and it does not exist, then should startup fail? John > > Regards, > Daniel > -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
On Thu, Jun 29, 2017 at 07:45:06AM -0400, John Ferlan wrote: > > > On 06/29/2017 06:40 AM, Daniel P. Berrange wrote: > > On Thu, Jun 29, 2017 at 09:24:30AM +0200, Jiri Denemark wrote: > >> On Wed, Jun 28, 2017 at 15:30:28 -0400, John Ferlan wrote: > >>> https://bugzilla.redhat.com/show_bug.cgi?id=1458630 > >>> > >>> Introduce virQEMUDriverConfigSetCertDir which will handle reading the > >>> qemu.conf config file specific setting for default, vnc, spice, chardev, > >>> and migrate. Then if a setting was provided, validating the existence of > >>> the directory and overwriting the default set by virQEMUDriverConfigNew. > >>> > >>> Also update the qemu.conf description for default to indicate the consequences > >>> if the default directory does not exist. > >>> > >>> Signed-off-by: John Ferlan <jferlan@redhat.com> > >>> --- > >>> src/qemu/qemu.conf | 9 ++++++++- > >>> src/qemu/qemu_conf.c | 42 ++++++++++++++++++++++++++++++++++-------- > >>> 2 files changed, 42 insertions(+), 9 deletions(-) > >>> > >>> diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf > >>> index e6c0832..737fa46 100644 > >>> --- a/src/qemu/qemu.conf > >>> +++ b/src/qemu/qemu.conf > >>> @@ -3,7 +3,7 @@ > >>> # defaults are used. > >>> > >>> # Use of TLS requires that x509 certificates be issued. The default is > >>> -# to keep them in /etc/pki/qemu. This directory must contain > >>> +# to keep them in /etc/pki/qemu. This directory must exist and contain: > >>> # > >>> # ca-cert.pem - the CA master certificate > >>> # server-cert.pem - the server certificate signed with ca-cert.pem > >>> @@ -13,6 +13,13 @@ > >>> # > >>> # dh-params.pem - the DH params configuration file > >>> # > >>> +# If the directory does not exist or does not contain the necessary files, > >>> +# QEMU domains will fail to start if they are configured to use TLS. > >>> +# > >>> +# In order to overwrite the default directory alter the following. If the > >>> +# provided directory does not exist, then the setting reverts back to the > >>> +# default /etc/pki/qemu. > >>> +# > >> > >> I don't think this is a good idea. We should use the directory a user > >> specified in qemu.conf. If it doesn't exist, well things won't work. > >> Sure, we can complain about it in the logs, but we should not fallback > >> to any magic default in that case. Anyone setting a custom directory for > >> TLS certificates does this because they want to use it. If the directory > >> does not exist, it's either because they forgot to create it or they > >> made a typo somewhere. It's very unlikely someone actually wants to use > >> a default directory even though they set a custom one. > >> > >> NACK > > > > Agreed, I think we need to distinguish between the default dirs for each > > settings, vs user specified dir for each setting. > > > > ie, if the user has *not* set 'chardev_tls_x509_cert_dir' then its default > > value is '/etc/pki/libvirt-chardev'. If that directory does not exist, > > then falling back to "default_tls_x509_cert_dir" is good. > > This essentially what happens in virQEMUDriverConfigNew. The caveat here > is that the default value for default_tls_x509_cert_dir (e.g. > /etc/pki/qemu) is not checked for existence, rather it's assumed. As long as we get an error message it is ok, but it might be wise to explicitly check /etc/pki/qemu if it would give a better error message to the user. > > If the user *has* set 'chardev_tls_x509_cert_dir' and it does nto exist, > > then we should report an hard error, preferrably at startup so the admin > > sees their mistake immediately. > > OK and that answers most of the questions I had... If the user changes > "default_*" (as processed in virQEMUDriverConfigLoadFile) and it does > not exist, then should startup fail? Yep Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
On 06/29/2017 07:49 AM, Daniel P. Berrange wrote: > On Thu, Jun 29, 2017 at 07:45:06AM -0400, John Ferlan wrote: >> >> >> On 06/29/2017 06:40 AM, Daniel P. Berrange wrote: >>> On Thu, Jun 29, 2017 at 09:24:30AM +0200, Jiri Denemark wrote: >>>> On Wed, Jun 28, 2017 at 15:30:28 -0400, John Ferlan wrote: >>>>> https://bugzilla.redhat.com/show_bug.cgi?id=1458630 >>>>> >>>>> Introduce virQEMUDriverConfigSetCertDir which will handle reading the >>>>> qemu.conf config file specific setting for default, vnc, spice, chardev, >>>>> and migrate. Then if a setting was provided, validating the existence of >>>>> the directory and overwriting the default set by virQEMUDriverConfigNew. >>>>> >>>>> Also update the qemu.conf description for default to indicate the consequences >>>>> if the default directory does not exist. >>>>> >>>>> Signed-off-by: John Ferlan <jferlan@redhat.com> >>>>> --- >>>>> src/qemu/qemu.conf | 9 ++++++++- >>>>> src/qemu/qemu_conf.c | 42 ++++++++++++++++++++++++++++++++++-------- >>>>> 2 files changed, 42 insertions(+), 9 deletions(-) >>>>> >>>>> diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf >>>>> index e6c0832..737fa46 100644 >>>>> --- a/src/qemu/qemu.conf >>>>> +++ b/src/qemu/qemu.conf >>>>> @@ -3,7 +3,7 @@ >>>>> # defaults are used. >>>>> >>>>> # Use of TLS requires that x509 certificates be issued. The default is >>>>> -# to keep them in /etc/pki/qemu. This directory must contain >>>>> +# to keep them in /etc/pki/qemu. This directory must exist and contain: >>>>> # >>>>> # ca-cert.pem - the CA master certificate >>>>> # server-cert.pem - the server certificate signed with ca-cert.pem >>>>> @@ -13,6 +13,13 @@ >>>>> # >>>>> # dh-params.pem - the DH params configuration file >>>>> # >>>>> +# If the directory does not exist or does not contain the necessary files, >>>>> +# QEMU domains will fail to start if they are configured to use TLS. >>>>> +# >>>>> +# In order to overwrite the default directory alter the following. If the >>>>> +# provided directory does not exist, then the setting reverts back to the >>>>> +# default /etc/pki/qemu. >>>>> +# >>>> >>>> I don't think this is a good idea. We should use the directory a user >>>> specified in qemu.conf. If it doesn't exist, well things won't work. >>>> Sure, we can complain about it in the logs, but we should not fallback >>>> to any magic default in that case. Anyone setting a custom directory for >>>> TLS certificates does this because they want to use it. If the directory >>>> does not exist, it's either because they forgot to create it or they >>>> made a typo somewhere. It's very unlikely someone actually wants to use >>>> a default directory even though they set a custom one. >>>> >>>> NACK >>> >>> Agreed, I think we need to distinguish between the default dirs for each >>> settings, vs user specified dir for each setting. >>> >>> ie, if the user has *not* set 'chardev_tls_x509_cert_dir' then its default >>> value is '/etc/pki/libvirt-chardev'. If that directory does not exist, >>> then falling back to "default_tls_x509_cert_dir" is good. >> >> This essentially what happens in virQEMUDriverConfigNew. The caveat here >> is that the default value for default_tls_x509_cert_dir (e.g. >> /etc/pki/qemu) is not checked for existence, rather it's assumed. > > As long as we get an error message it is ok, but it might be wise to > explicitly check /etc/pki/qemu if it would give a better error > message to the user. > Currently we'd get an error "eventually" when someone tries to start a guest: error: internal error: process exited while connecting to monitor: 2017-06-28T19:24:18.810938Z qemu-system-x86_64: -object tls-creds-x509,id=objcharserial1_tls0,dir=/etc/pki/qemu,endpoint=client,verify-peer=no: Unable to access credentials /etc/pki/qemu/ca-cert.pem: No such file or directory The problem with checking and generating an error at startup is that we don't create the /etc/pki/qemu directory during install (at least as far as I can tell). If we do, then something's broken because I have a couple of environments without it. John >>> If the user *has* set 'chardev_tls_x509_cert_dir' and it does nto exist, >>> then we should report an hard error, preferrably at startup so the admin >>> sees their mistake immediately. >> >> OK and that answers most of the questions I had... If the user changes >> "default_*" (as processed in virQEMUDriverConfigLoadFile) and it does >> not exist, then should startup fail? > > Yep > > Regards, > Daniel > -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
© 2016 - 2025 Red Hat, Inc.