netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Benedict Wong <benedictwong@google.com>
Cc: netdev@vger.kernel.org, nharold@google.com, lorenzo@google.com,
	maze@google.com
Subject: Re: [RFC iproute2] xfrm: add option to hide keys in state output
Date: Fri, 4 Jan 2019 16:20:57 -0800	[thread overview]
Message-ID: <20190104162057.06d3f76b@hermes.lan> (raw)
In-Reply-To: <20190104231910.54517-1-benedictwong@google.com>

On Fri,  4 Jan 2019 15:19:10 -0800
Benedict Wong <benedictwong@google.com> wrote:

> ip xfrm state show currently dumps keys unconditionally. This limits its
> use in logging, as security information can be leaked.
> 
> This patch adds a nokeys option to ip xfrm ( state show | monitor ), which
> prevents the printing of keys. This allows ip xfrm state show to be used
> in logging without exposing keys.
> 
> Signed-off-by: Benedict Wong <benedictwong@google.com>
> ---
>  ip/ipxfrm.c        | 45 +++++++++++++++++++++++++--------------------
>  ip/xfrm.h          |  5 +++--
>  ip/xfrm_monitor.c  |  7 +++++--
>  ip/xfrm_state.c    | 27 ++++++++++++++++++++++-----
>  man/man8/ip-xfrm.8 | 15 ++++++++++++++-
>  5 files changed, 69 insertions(+), 30 deletions(-)
> 
> diff --git a/ip/ipxfrm.c b/ip/ipxfrm.c
> index 2dea4e37..1334ca9f 100644
> --- a/ip/ipxfrm.c
> +++ b/ip/ipxfrm.c
> @@ -497,7 +497,8 @@ void xfrm_selector_print(struct xfrm_selector *sel, __u16 family,
>  }
>  
>  static void __xfrm_algo_print(struct xfrm_algo *algo, int type, int len,
> -			      FILE *fp, const char *prefix, int newline)
> +			      FILE *fp, const char *prefix, int newline,
> +			      bool nokeys)
>  {
>  	int keylen;
>  	int i;
> @@ -521,7 +522,9 @@ static void __xfrm_algo_print(struct xfrm_algo *algo, int type, int len,
>  		goto fin;
>  	}
>  
> -	if (keylen > 0) {
> +	if (nokeys)
> +		fprintf(fp, "<<Keys hidden>>")


This reminds me, xfrm never got converted to use JSON output formatting.

  reply	other threads:[~2019-01-05  0:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-04 23:19 [RFC iproute2] xfrm: add option to hide keys in state output Benedict Wong
2019-01-05  0:20 ` Stephen Hemminger [this message]
2019-01-07 20:37   ` Benedict Wong
2019-01-07 20:50     ` Stephen Hemminger

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=20190104162057.06d3f76b@hermes.lan \
    --to=stephen@networkplumber.org \
    --cc=benedictwong@google.com \
    --cc=lorenzo@google.com \
    --cc=maze@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=nharold@google.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).