# don't want to change this.
#
syslog_facility = daemon
+
+ # Suppress "secret" values when printing them in debug mode.
+ #
+ #
+ # Setting this to "yes" means that the server prints a series
+ # of dots:
+ #
+ # .......
+ #
+ # instead of the value, for attributes which contain secret
+ # information. e.g. User-Name, Tunnel-Password, etc.
+ #
+ # This configuration is disabled by default. It is extremely
+ # important for administrators to be able to debug user logins
+ # by seeing what is actually being sent.
+ #
+# suppress_secrets = no
}
#
default_log.dst = L_DST_NULL;
default_log.fd = -1;
default_log.print_level = true;
+ default_log.suppress_secrets = true;
/*
* Set the panic action and enable other debugging facilities
config->spawn_workers = false;
config->daemonize = false;
fr_debug_lvl += 2;
+ if (fr_debug_lvl > 2) default_log.suppress_secrets = false;
+
do_stdout:
default_log.dst = L_DST_STDOUT;
default_log.fd = STDOUT_FILENO;
case 'x':
fr_debug_lvl++;
+ if (fr_debug_lvl > 2) default_log.suppress_secrets = false;
break;
default:
*/
if (main_config_init(config) < 0) EXIT_WITH_FAILURE;
+ if (!config->suppress_secrets) default_log.suppress_secrets = false;
+
/*
* Check we're the only process using this config.
*/
* running unit tests which generate errors under CI.
*/
va_copy(aq, ap);
- fmt_exp = fr_vasprintf(pool, fmt, aq);
+ if (!log_dst->suppress_secrets) {
+ fmt_exp = fr_vasprintf(pool, fmt, aq);
+ } else {
+ fmt_exp = fr_vasprintf_secure(pool, fmt, aq);
+ }
va_end(aq);
/*
{ FR_CONF_OFFSET("local_state_dir", FR_TYPE_STRING, main_config_t, local_state_dir), .dflt = "${prefix}/var"},
{ FR_CONF_OFFSET("logdir", FR_TYPE_STRING, main_config_t, log_dir), .dflt = "${local_state_dir}/log"},
{ FR_CONF_OFFSET("file", FR_TYPE_STRING, main_config_t, log_file), .dflt = "${logdir}/radius.log" },
+ { FR_CONF_OFFSET("suppress_secrets", FR_TYPE_BOOL, main_config_t, suppress_secrets), .dflt = "no" },
CONF_PARSER_TERMINATOR
};
//!< timing out.
bool drop_requests; //!< Administratively disable request processing.
+ bool suppress_secrets; //!< suppress secrets (or not)
char const *log_dir;
char const *local_state_dir;
bool print_level; //!< sometimes we don't want log levels printed
+ bool suppress_secrets; //!< suppress secrets when printing to this destination
+
fr_log_timestamp_t timestamp; //!< Prefix log messages with timestamps.
int fd; //!< File descriptor to write messages to.
* @param[in] ctx to allocate buffer in.
* @param[in] fmt string.
* @param[in] ap variadic argument list.
- * @param[in] secret_rules rules for escaping value-boxes with a "secret" flag set.
+ * @param[in] suppress_secrets as described
* @return
* - The result of string interpolation.
* - NULL if OOM.
*/
-static char *fr_vasprintf_internal(TALLOC_CTX *ctx, char const *fmt, va_list ap, fr_sbuff_escape_rules_t const *secret_rules)
+static char *fr_vasprintf_internal(TALLOC_CTX *ctx, char const *fmt, va_list ap, bool suppress_secrets)
{
char const *p = fmt, *end = p + strlen(fmt), *fmt_p = p, *fmt_q = p;
char *out = NULL, *out_tmp;
* Value boxes get escaped as double-quoted strings, unless the value-box
* in question is secret, AND we've been asked to hide secrets.
*
- * Note that the secret_rules only hides secrets of data type "string"
- * and "octets", which should be good enough for most purposes.
+ * Note that the secret_rules only hides secrets of data type "string",
+ * which should be good enough for most purposes.
*/
if (*(p + 1) == 'V') {
e_rules = &fr_value_escape_double;
- if (in->secret) e_rules = secret_rules;
}
/*
* string need to occur in the NULL ctx so we don't fragment
* any pool associated with it.
*/
- if (in) {
+ if (in->secret && suppress_secrets) {
+ subst = talloc_typed_strdup(NULL, "<<< secret >>>");
+
+ } else if (in) {
fr_value_box_aprint(NULL, &subst, in, e_rules);
if (!subst) {
talloc_free(out);
char *fr_vasprintf(TALLOC_CTX *ctx, char const *fmt, va_list ap)
{
- return fr_vasprintf_internal(ctx, fmt, ap, &fr_value_escape_double);
+ return fr_vasprintf_internal(ctx, fmt, ap, false);
}
char *fr_vasprintf_secure(TALLOC_CTX *ctx, char const *fmt, va_list ap)
{
- return fr_vasprintf_internal(ctx, fmt, ap, &fr_value_escape_secret);
+ return fr_vasprintf_internal(ctx, fmt, ap, true);
}