From: Yu Watanabe Date: Wed, 11 Sep 2019 09:09:55 +0000 (+0900) Subject: network: also check the permission of key file X-Git-Tag: v244-rc1~315^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0bae857564e5189bed600f0a243d96b81b5dcb09;p=thirdparty%2Fsystemd.git network: also check the permission of key file --- diff --git a/src/network/netdev/macsec.c b/src/network/netdev/macsec.c index cf281e75a6d..d1d65a69bfa 100644 --- a/src/network/netdev/macsec.c +++ b/src/network/netdev/macsec.c @@ -981,6 +981,8 @@ static int macsec_read_key_file(NetDev *netdev, SecurityAssociation *sa) { if (!sa->key_file) return 0; + (void) warn_file_is_world_accessible(sa->key_file, NULL, NULL, 0); + r = read_full_file_full(sa->key_file, READ_FULL_FILE_SECURE | READ_FULL_FILE_UNHEX, (char **) &key, &key_len); if (r < 0) return log_netdev_error_errno(netdev, r, diff --git a/src/network/netdev/wireguard.c b/src/network/netdev/wireguard.c index 913ee2a0589..a40b32d148e 100644 --- a/src/network/netdev/wireguard.c +++ b/src/network/netdev/wireguard.c @@ -901,6 +901,8 @@ static int wireguard_read_key_file(const char *filename, uint8_t dest[static WG_ assert(dest); + (void) warn_file_is_world_accessible(filename, NULL, NULL, 0); + r = read_full_file_full(filename, READ_FULL_FILE_SECURE | READ_FULL_FILE_UNBASE64, &key, &key_len); if (r < 0) return r;