From 97c25654ed4778c76a89682b0b20e4ccf95b5a88 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Mon, 18 Sep 2023 22:21:56 +0100 Subject: [PATCH] Add helper messages for lax permissions --- lib/misc_mosq.c | 10 ++++++---- plugins/dynamic-security/plugin.c | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/lib/misc_mosq.c b/lib/misc_mosq.c index 3ee6fc79..844c9b6d 100644 --- a/lib/misc_mosq.c +++ b/lib/misc_mosq.c @@ -158,8 +158,9 @@ FILE *mosquitto__fopen(const char *path, const char *mode, bool restrict_read) #else fprintf(stderr, #endif - "Warning: File %s has world readable permissions. Future versions will refuse to load this file.", - path); + "Warning: File %s has world readable permissions. Future versions will refuse to load this file.\n" + "To fix this, use `chmod 0700 %s`.", + path, path); #if 0 return NULL; #endif @@ -175,8 +176,9 @@ FILE *mosquitto__fopen(const char *path, const char *mode, bool restrict_read) #else fprintf(stderr, #endif - "Warning: File %s owner is not %s. Future versions will refuse to load this file.", - path, result->pw_name); + "Warning: File %s owner is not %s. Future versions will refuse to load this file." + "To fix this, use `chown %s %s`.", + path, result->pw_name, result->pw_name, path); } #if 0 // Future version diff --git a/plugins/dynamic-security/plugin.c b/plugins/dynamic-security/plugin.c index b5b81fc1..125052e6 100644 --- a/plugins/dynamic-security/plugin.c +++ b/plugins/dynamic-security/plugin.c @@ -166,8 +166,9 @@ FILE *mosquitto__fopen(const char *path, const char *mode, bool restrict_read) #else fprintf(stderr, #endif - "Warning: File %s has world readable permissions. Future versions will refuse to load this file.", - path); + "Warning: File %s has world readable permissions. Future versions will refuse to load this file." + "To fix this, use `chmod 0700 %s`.", + path, path); #if 0 return NULL; #endif @@ -183,8 +184,9 @@ FILE *mosquitto__fopen(const char *path, const char *mode, bool restrict_read) #else fprintf(stderr, #endif - "Warning: File %s owner is not %s. Future versions will refuse to load this file.", - path, result->pw_name); + "Warning: File %s owner is not %s. Future versions will refuse to load this file." + "To fix this, use `chown %s %s`.", + path, result->pw_name, result->pw_name, path); } #if 0 // Future version