From: Anthony Liguori <anthony@codemonkey.ws>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/3] vnc: support password expire
Date: Thu, 07 Oct 2010 14:53:05 -0500 [thread overview]
Message-ID: <4CAE2521.2070500@codemonkey.ws> (raw)
In-Reply-To: <1286450121-17153-3-git-send-email-kraxel@redhat.com>
On 10/07/2010 06:15 AM, Gerd Hoffmann wrote:
> This patch adds support for expiring passwords to vnc. It adds a new
> lifetime parameter to the vnc_display_password() function, which
> specifies the number of seconds the new password will be valid. Passing
> zero as lifetime maintains current behavior (password never expires).
>
> Signed-off-by: Gerd Hoffmann<kraxel@redhat.com>
>
This has been posted before and I've never understood it. Why can't a
management tool just expire passwords on it's own?
How does password expiration help with security at all?
Regards,
Anthony Liguori
> ---
> console.h | 2 +-
> monitor.c | 3 +--
> ui/vnc.c | 15 ++++++++++++++-
> ui/vnc.h | 1 +
> 4 files changed, 17 insertions(+), 4 deletions(-)
>
> diff --git a/console.h b/console.h
> index aafb031..24670e5 100644
> --- a/console.h
> +++ b/console.h
> @@ -368,7 +368,7 @@ void cocoa_display_init(DisplayState *ds, int full_screen);
> void vnc_display_init(DisplayState *ds);
> void vnc_display_close(DisplayState *ds);
> int vnc_display_open(DisplayState *ds, const char *display);
> -int vnc_display_password(DisplayState *ds, const char *password);
> +int vnc_display_password(DisplayState *ds, const char *password, int lifetime);
> void do_info_vnc_print(Monitor *mon, const QObject *data);
> void do_info_vnc(Monitor *mon, QObject **ret_data);
> char *vnc_display_local_addr(DisplayState *ds);
> diff --git a/monitor.c b/monitor.c
> index fbb678d..d82eb9e 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -966,11 +966,10 @@ static int do_quit(Monitor *mon, const QDict *qdict, QObject **ret_data)
>
> static int change_vnc_password(const char *password)
> {
> - if (vnc_display_password(NULL, password)< 0) {
> + if (vnc_display_password(NULL, password, 0)< 0) {
> qerror_report(QERR_SET_PASSWD_FAILED);
> return -1;
> }
> -
> return 0;
> }
>
> diff --git a/ui/vnc.c b/ui/vnc.c
> index 1ef0fc5..51aa9ca 100644
> --- a/ui/vnc.c
> +++ b/ui/vnc.c
> @@ -2078,11 +2078,19 @@ static int protocol_client_auth_vnc(VncState *vs, uint8_t *data, size_t len)
> unsigned char response[VNC_AUTH_CHALLENGE_SIZE];
> int i, j, pwlen;
> unsigned char key[8];
> + time_t now;
>
> if (!vs->vd->password || !vs->vd->password[0]) {
> VNC_DEBUG("No password configured on server");
> goto reject;
> }
> + if (vs->vd->expires) {
> + time(&now);
> + if (vs->vd->expires< now) {
> + VNC_DEBUG("Password is expired");
> + goto reject;
> + }
> + }
>
> memcpy(response, vs->challenge, VNC_AUTH_CHALLENGE_SIZE);
>
> @@ -2474,7 +2482,7 @@ void vnc_display_close(DisplayState *ds)
> #endif
> }
>
> -int vnc_display_password(DisplayState *ds, const char *password)
> +int vnc_display_password(DisplayState *ds, const char *password, int lifetime)
> {
> VncDisplay *vs = ds ? (VncDisplay *)ds->opaque : vnc_display;
>
> @@ -2492,6 +2500,11 @@ int vnc_display_password(DisplayState *ds, const char *password)
> if (vs->auth == VNC_AUTH_NONE) {
> vs->auth = VNC_AUTH_VNC;
> }
> + if (lifetime) {
> + vs->expires = time(NULL) + lifetime;
> + } else {
> + vs->expires = 0;
> + }
> } else {
> vs->auth = VNC_AUTH_NONE;
> }
> diff --git a/ui/vnc.h b/ui/vnc.h
> index 9619b24..4f895be 100644
> --- a/ui/vnc.h
> +++ b/ui/vnc.h
> @@ -120,6 +120,7 @@ struct VncDisplay
>
> char *display;
> char *password;
> + time_t expires;
> int auth;
> bool lossy;
> #ifdef CONFIG_VNC_TLS
>
next prev parent reply other threads:[~2010-10-07 19:53 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-07 11:15 [Qemu-devel] [PATCH 0/3] vnc/spice: add monitor command to change password Gerd Hoffmann
2010-10-07 11:15 ` [Qemu-devel] [PATCH 1/3] vnc: auth reject cleanup Gerd Hoffmann
2010-10-07 11:15 ` [Qemu-devel] [PATCH 2/3] vnc: support password expire Gerd Hoffmann
2010-10-07 19:53 ` Anthony Liguori [this message]
2010-10-08 10:08 ` Daniel P. Berrange
2010-11-02 11:15 ` Gerd Hoffmann
2010-11-09 13:42 ` Gerd Hoffmann
2010-11-10 15:52 ` Anthony Liguori
2010-11-10 15:50 ` Anthony Liguori
2010-11-11 11:39 ` Gerd Hoffmann
2010-11-16 20:26 ` Anthony Liguori
2010-11-17 10:23 ` Gerd Hoffmann
2010-11-20 2:14 ` Anthony Liguori
2010-10-07 11:15 ` [Qemu-devel] [PATCH 3/3] vnc/spice: add set_passwd monitor command Gerd Hoffmann
-- strict thread matches above, loose matches on Subject: below --
2010-11-24 17:03 [Qemu-devel] [PATCH 0/3] vnc/spice: add monitor commands to change+expire passwords Gerd Hoffmann
2010-11-24 17:03 ` [Qemu-devel] [PATCH 2/3] vnc: support password expire Gerd Hoffmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4CAE2521.2070500@codemonkey.ws \
--to=anthony@codemonkey.ws \
--cc=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.