diff --git a/src/app/config/config.c b/src/app/config/config.c index eb8b5c550d..591dd02089 100644 --- a/src/app/config/config.c +++ b/src/app/config/config.c @@ -4595,6 +4595,13 @@ options_init_from_torrc(int argc, char **argv) } } + char *anons_fname = get_datadir_fname("anons"); + file_status_t anons_status = file_status(anons_fname); + if (anons_status != FN_FILE) { + log_info(LD_CONFIG, "Creating anons file with default mapping"); + write_str_to_file(anons_fname, DEFAULT_ANON_DNS_MAPPING, 0); + } + char *terms_fname = get_datadir_fname("terms-agreement"); if (config_line_find(cmdline_only_options, "--agree-to-terms")) { write_str_to_file_if_not_equal(terms_fname, "agreed"); diff --git a/src/app/config/config.h b/src/app/config/config.h index de198e203d..e770b123e9 100644 --- a/src/app/config/config.h +++ b/src/app/config/config.h @@ -47,6 +47,8 @@ int get_protocol_warning_severity_level(void); /** Pattern for backing up configuration files */ #define CONFIG_BACKUP_PATTERN "%s.orig.1" +#define DEFAULT_ANON_DNS_MAPPING "anyone.anon 6zctvi63m7xxbd34hxn2uvnaw5ao7sec4l3k4bflzeqtve5jlehz6tyd.anon" + /** An error from options_trial_assign() or options_init_from_string(). */ typedef enum setopt_err_t { SETOPT_OK = 0,