The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
main_config.h
Go to the documentation of this file.
1 #pragma once
2 /*
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation; either version 2 of the License, or
6  * (at your option) any later version.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
16  */
17 
18 /**
19  * $Id: be5dd37608b57f159641c00dce570c57dd355f7b $
20  *
21  * @file lib/server/main_config.h
22  * @brief Structures and prototypes for map functions
23  *
24  * @copyright 2018 The FreeRADIUS server project
25  */
26 RCSIDH(main_config_h, "$Id: be5dd37608b57f159641c00dce570c57dd355f7b $")
27 
28 /*
29  * Forward declarations
30  */
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 #define MAX_REQUEST_TIME 30 //!< Default maximum request time
36 
37 typedef struct main_config_s main_config_t;
38 
39 extern main_config_t const *main_config; //!< Global configuration singleton.
40 
41 #include <freeradius-devel/server/cf_util.h>
42 #include <freeradius-devel/server/tmpl.h>
43 
44 #include <freeradius-devel/util/dict.h>
45 
46 
47 /** Main server configuration
48  *
49  * The parsed version of the main server config.
50  */
51 struct main_config_s {
52  char const *name; //!< Name of the daemon, usually 'radiusd'.
53  bool overwrite_config_name; //!< Overwrite the configured name, as this
54  ///< was specified by the user on the command line.
55  CONF_SECTION *root_cs; //!< Root of the server config.
56 
57  bool daemonize; //!< Should the server daemonize on startup.
58  bool spawn_workers; //!< Should the server spawn threads.
59  char const *pid_file; //!< Path to write out PID file.
60 
61  fr_time_delta_t max_request_time; //!< How long a request can be processed for before
62  //!< timing out.
63 
64  bool drop_requests; //!< Administratively disable request processing.
65  bool suppress_secrets; //!< suppress secrets (or not)
66 
67  char const *log_dir;
68  char const *local_state_dir;
69  char const *chroot_dir;
70 
73 
74  char const *radacct_dir;
75  char const *lib_dir;
76  char const *sbin_dir;
77  char const *run_dir;
78  char const *raddb_dir; //!< Path to raddb directory
79 
80  char const *prefix;
81 
82  char const *log_dest;
83 
84  char const *log_file;
86  bool log_line_number; //!< Log src file/line the message was generated on.
87 
91 
92  int32_t syslog_facility;
93 
94  char const *dict_dir; //!< Where to load dictionaries from.
95 
96  size_t talloc_pool_size; //!< Size of pool to allocate to hold each #request_t.
97 
98  uint32_t max_requests; //!< maximum number of requests outstanding
99 
100  bool write_pid; //!< write the PID file
101 
102 #ifdef HAVE_SETUID
103  uid_t server_uid; //!< UID we're running as.
104  gid_t server_gid; //!< GID we're running as.
105  uid_t uid; //!< UID we should run as.
106  bool uid_is_set;
107  gid_t gid; //!< GID we should run as.
108  bool gid_is_set;
109 #endif
110 
111 #ifdef ENABLE_OPENSSL_VERSION_CHECK
112  char const *allow_vulnerable_openssl; //!< The CVE number of the last security issue acknowledged.
113 #endif
114 
115 #ifdef WITH_TLS
116  bool openssl_fips_mode; //!< Whether OpenSSL fips mode is enabled or disabled.
117  bool openssl_fips_mode_is_set; //!< Whether the user specified a value.
118 
119  size_t openssl_async_pool_init; //!< Tuning option to set the minimum number of requests
120  ///< in the async ctx pool.
121 
122  size_t openssl_async_pool_max; //!< Tuning option to set the maximum number of requests
123  ///< in the async ctx pool.
124 #endif
125 
126  fr_dict_t *dict; //!< Main dictionary.
127 
128 
129  /*
130  * Debugging options
131  */
132  bool allow_core_dumps; //!< Whether the server is allowed to drop a core when
133  //!< receiving a fatal signal.
134 
135  char const *panic_action; //!< Command to execute if the server receives a fatal
136  //!< signal.
137 
138  uint32_t debug_level; //!< The base log level for the server.
139 
140  bool talloc_memory_report; //!< Print a memory report on what's left unfreed.
141  //!< Can only be used when the server is running in single
142  //!< threaded mode.
143 
144  bool allow_multiple_procs; //!< Allow multiple instances of radiusd to run with the
145  ///< same config file.
146 
147  int multi_proc_sem_id; //!< Semaphore we use to prevent multiple processes running.
148  char *multi_proc_sem_path; //!< Semaphore path.
149 
150  uint32_t max_networks; //!< for the scheduler
151  uint32_t max_workers; //!< for the scheduler
152  fr_time_delta_t stats_interval; //!< for the scheduler
153 
154 #ifndef NDEBUG
155  uint32_t ins_max; //!< max instruction count
156  bool ins_countup; //!< count up to "max"
157 #endif
158 
159  /*
160  * Migration tools
161  */
162  bool rewrite_update; //!< rewrite "update" to be new edit sections
163  bool forbid_update; //!< forbid "update" sections
164  bool require_enum_prefix; //!< require "::" for enum parsing. They're always printed with this
165 };
166 
167 void main_config_name_set_default(main_config_t *config, char const *name, bool overwrite_config);
168 void main_config_raddb_dir_set(main_config_t *config, char const *path);
169 void main_config_dict_dir_set(main_config_t *config, char const *path);
170 
171 int main_config_parse_option(char const *value); /* flat / nested migration */
172 
173 bool main_config_migrate_option_get(char const *name);
174 
178 
179 main_config_t *main_config_alloc(TALLOC_CTX *ctx);
184 
185 #ifdef __cplusplus
186 }
187 #endif
#define RCSIDH(h, id)
Definition: build.h:482
A section grouping multiple CONF_PAIR.
Definition: cf_priv.h:101
Test enumeration values.
Definition: dict_test.h:92
char const * log_dest
Definition: main_config.h:82
int multi_proc_sem_id
Semaphore we use to prevent multiple processes running.
Definition: main_config.h:147
char const * panic_action
Command to execute if the server receives a fatal signal.
Definition: main_config.h:135
void main_config_exclusive_proc_done(main_config_t const *config)
int32_t syslog_facility
Definition: main_config.h:92
fr_time_delta_t stats_interval
for the scheduler
Definition: main_config.h:152
uint32_t max_networks
for the scheduler
Definition: main_config.h:150
char const * radacct_dir
Definition: main_config.h:74
int main_config_parse_option(char const *value)
Definition: main_config.c:1511
char const * lib_dir
Definition: main_config.h:75
int main_config_free(main_config_t **config)
Definition: main_config.c:1423
void main_config_dict_dir_set(main_config_t *config, char const *path)
Set the global dictionary directory.
Definition: main_config.c:991
char const * name
Name of the daemon, usually 'radiusd'.
Definition: main_config.h:52
bool hostname_lookups
Definition: main_config.h:72
char const * chroot_dir
Definition: main_config.h:69
bool talloc_memory_report
Print a memory report on what's left unfreed.
Definition: main_config.h:140
char const * local_state_dir
Definition: main_config.h:68
void main_config_hup(main_config_t *config)
Definition: main_config.c:1469
bool drop_requests
Administratively disable request processing.
Definition: main_config.h:64
int main_config_exclusive_proc(main_config_t *config)
Check to see if we're the only process using this configuration file (or PID file if specified)
Definition: main_config.c:916
size_t talloc_pool_size
Size of pool to allocate to hold each request_t.
Definition: main_config.h:96
uint32_t max_workers
for the scheduler
Definition: main_config.h:151
void main_config_name_set_default(main_config_t *config, char const *name, bool overwrite_config)
Set the server name.
Definition: main_config.c:843
bool daemonize
Should the server daemonize on startup.
Definition: main_config.h:57
bool log_timestamp_is_set
Definition: main_config.h:90
fr_dict_t * dict
Main dictionary.
Definition: main_config.h:126
char const * pid_file
Path to write out PID file.
Definition: main_config.h:59
void hup_logfile(main_config_t *config)
Definition: main_config.c:1447
bool require_enum_prefix
require "::" for enum parsing. They're always printed with this
Definition: main_config.h:164
bool suppress_secrets
suppress secrets (or not)
Definition: main_config.h:65
bool rewrite_update
rewrite "update" to be new edit sections
Definition: main_config.h:162
int main_config_exclusive_proc_child(main_config_t const *config)
bool do_colourise
Definition: main_config.h:85
char const * sbin_dir
Definition: main_config.h:76
bool write_pid
write the PID file
Definition: main_config.h:100
char const * log_dir
Definition: main_config.h:67
bool allow_multiple_procs
Allow multiple instances of radiusd to run with the same config file.
Definition: main_config.h:144
uint32_t ins_max
max instruction count
Definition: main_config.h:155
bool log_line_number
Log src file/line the message was generated on.
Definition: main_config.h:86
bool forbid_update
forbid "update" sections
Definition: main_config.h:163
char const * dict_dir
Where to load dictionaries from.
Definition: main_config.h:94
uint32_t debug_level
The base log level for the server.
Definition: main_config.h:138
char const * prefix
Definition: main_config.h:80
char const * raddb_dir
Path to raddb directory.
Definition: main_config.h:78
fr_time_delta_t max_request_time
How long a request can be processed for before timing out.
Definition: main_config.h:61
bool overwrite_config_name
Overwrite the configured name, as this was specified by the user on the command line.
Definition: main_config.h:53
bool ins_countup
count up to "max"
Definition: main_config.h:156
bool reverse_lookups
Definition: main_config.h:71
int main_config_init(main_config_t *config)
Definition: main_config.c:1036
bool log_dates_utc
Definition: main_config.h:88
main_config_t const * main_config
Global configuration singleton.
Definition: main_config.c:69
char * multi_proc_sem_path
Semaphore path.
Definition: main_config.h:148
bool allow_core_dumps
Whether the server is allowed to drop a core when receiving a fatal signal.
Definition: main_config.h:132
void main_config_raddb_dir_set(main_config_t *config, char const *path)
Set the global radius config directory.
Definition: main_config.c:862
CONF_SECTION * root_cs
Root of the server config.
Definition: main_config.h:55
uint32_t max_requests
maximum number of requests outstanding
Definition: main_config.h:98
char const * run_dir
Definition: main_config.h:77
main_config_t * main_config_alloc(TALLOC_CTX *ctx)
Allocate a main_config_t struct, setting defaults.
Definition: main_config.c:1003
bool log_timestamp
Definition: main_config.h:89
bool spawn_workers
Should the server spawn threads.
Definition: main_config.h:58
char const * log_file
Definition: main_config.h:84
bool main_config_migrate_option_get(char const *name)
Definition: main_config.c:1546
Main server configuration.
Definition: main_config.h:51
unsigned int uint32_t
Definition: merged_model.c:33
static const conf_parser_t config[]
Definition: base.c:183
static char const * name
A time delta, a difference in time measured in nanoseconds.
Definition: time.h:80