Received: from eggs.gnu.org ([208.118.235.92]:54205) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SPbkR-0007iO-Je for qemu-devel@nongnu.org; Wed, 02 May 2012 11:45:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SPbkP-0008Vs-74 for qemu-devel@nongnu.org; Wed, 02 May 2012 11:45:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:23368) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SPbkO-0008Ve-Uu for qemu-devel@nongnu.org; Wed, 02 May 2012 11:45:45 -0400 From: Paul Moore Date: Wed, 02 May 2012 11:45:41 -0400 Message-ID: <1382410.NpI6yQi7Dq@sifl> In-Reply-To: <4FA0699D.6090302@suse.de> References: <20120501212040.27850.27184.stgit@sifl> <4FA0699D.6090302@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" Subject: Re: [Qemu-devel] [PATCH] vnc: disable VNC password authentication (security type 2) when in FIPS mode List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andreas =?ISO-8859-1?Q?F=E4rber?= Cc: Stefan Weil , qemu-devel@nongnu.org On Wednesday, May 02, 2012 12:54:21 AM Andreas F=E4rber wrote: > Am 01.05.2012 23:20, schrieb Paul Moore: > > FIPS 140-2 requires disabling certain ciphers, including DES, which= is > > used > > by VNC to obscure passwords when they are sent over the network. T= he > > solution for FIPS users is to disable the use of VNC password auth = when > > the > > host system is operating in FIPS mode. > >=20 > > This patch causes qemu to emits a syslog entry indicating that VNC > > password >=20 > "to emit" >=20 > > auth is disabled when it detects the host is running in FIPS mode, = and > > unless a VNC password was specified on the command line it continue= s > > normally. However, if a VNC password was given on the command line= , qemu > > fails with an error message to stderr explaining that that VNC pass= word >=20 > "explaining that VNC" Thanks, typos fixed. > > auth is not allowed in FIPS mode. > >=20 > > Signed-off-by: Paul Moore >=20 > Interesting feature. :) It would appear that depends on who you ask :) > > diff --git a/ui/vnc.c b/ui/vnc.c > > index deb9ecd..620791e 100644 > > --- a/ui/vnc.c > > +++ b/ui/vnc.c > > @@ -32,6 +32,7 @@ > >=20 > > #include "acl.h" > > #include "qemu-objects.h" > > #include "qmp-commands.h" > >=20 > > +#include >=20 > syslog.h is POSIX, but it'll need a guard for mingw32. Is "#ifndef _WIN32" the right guard to use? Both here and where we mak= e the=20 actual syslog() call? > > @@ -48,6 +49,24 @@ static DisplayChangeListener *dcl; > >=20 > > static int vnc_cursor_define(VncState *vs); > > static void vnc_release_modifiers(VncState *vs); > >=20 > > +static int fips_enabled(void) > > +{ > > + int enabled =3D 0; > > + char value; > > + FILE *fds; > > + > > + fds =3D fopen("/proc/sys/crypto/fips_enabled", "r"); >=20 > How standardized is this? Should we limit this to __linux__ or someth= ing? It is in the mainline Linux Kernel so fairly standard as far as Linux i= s=20 concerned. However, it is Linux only to the best of my knowledge so I'= ve gone=20 ahead and protected it with __linux__ as you and others have mentioned.= > > + if (fds =3D=3D NULL) { > > + return 0; > > + } > > + if (fread(&value, sizeof(value), 1, fds) =3D=3D 1 && value =3D= =3D '1') { > > + enabled =3D 1; > > + } > > + fclose(fds); > > + > > + return enabled; > > +} >=20 > bool would seem nicer as return type and field type below. Yep, I agree. I'll post a v2 later today; thanks for taking the time to review the pa= tch and=20 send your comments. --=20 paul moore security and virtualization @ redhat