The FreeRADIUS server $Id: f3670dba8951ca10eb4948feb3dc3db9423a334f $
Loading...
Searching...
No Matches
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: 48956c3f9af0328076a3223f3645fb95f3ccd5ad $
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 */
26RCSIDH(main_config_h, "$Id: 48956c3f9af0328076a3223f3645fb95f3ccd5ad $")
27
28/*
29 * Forward declarations
30 */
31#ifdef __cplusplus
32extern "C" {
33#endif
34
35#define MAX_REQUEST_TIME 30 //!< Default maximum request time
36
38
39extern 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#include <freeradius-devel/io/worker.h>
46
47typedef struct {
48 bool files_is_set; //!< if we have a limit { files { ... } } section.
49 bool exec_is_set; //!< if we have a limit { exec { ... } } section.
50 char const **allowed_files; //!< where %file....() is limited to for read / write
51 char const **readonly_files; //!< where %file....() is limited to for read
52 char const **exec; //!< where %exec() is limited to
54
55/** Main server configuration
56 *
57 * The parsed version of the main server config.
58 */
60 char const *name; //!< Name of the daemon, usually 'radiusd'.
61 bool overwrite_config_name; //!< Overwrite the configured name, as this
62 ///< was specified by the user on the command line.
63 CONF_SECTION *root_cs; //!< Root of the server config.
64
65 bool daemonize; //!< Should the server daemonize on startup.
66 bool spawn_workers; //!< Should the server spawn threads.
67 char const *pid_file; //!< Path to write out PID file.
68
69 bool write_pid; //!< write the PID file
70
71 char const *log_dir;
72 char const *local_state_dir;
73
74 bool reverse_lookups; //!< do IP -> host lookups. Don't set this!
75 bool hostname_lookups; //!< do hostname -> IP lookups
76 bool drop_requests; //!< Administratively disable request processing.
77 bool suppress_secrets; //!< suppress secrets (or not)
78
79 char const *radacct_dir;
80 char const *lib_dir;
81 char const *sbin_dir;
82 char const *run_dir;
83 char const *confdir; //!< Path to configuration directory
84
85 char const *prefix;
86
87 char const *log_dest;
88 char const *log_file;
90 bool log_line_number; //!< Log src file/line the message was generated on.
91
95
97
98 char const *dict_dir; //!< Where to load dictionaries from.
99 fr_dict_t *dict; //!< Main dictionary.
100
101#ifdef HAVE_SETUID
102 uid_t server_uid; //!< UID we're running as.
103 gid_t server_gid; //!< GID we're running as.
104 uid_t uid; //!< UID we should run as.
105 bool uid_is_set;
106 gid_t gid; //!< GID we should run as.
107 bool gid_is_set;
108#endif
109
110 char const *chdir; //!< where to chdir() to when we start.
112
113 main_config_limit_t limit; //!< limit files, exec, etc.
114
115 /*
116 * OpenSSL configuration
117 */
118#ifdef ENABLE_OPENSSL_VERSION_CHECK
119 char const *allow_vulnerable_openssl; //!< The CVE number of the last security issue acknowledged.
120#endif
121
122#ifdef WITH_TLS
123 bool openssl_fips_mode; //!< Whether OpenSSL fips mode is enabled or disabled.
124 bool openssl_fips_mode_is_set; //!< Whether the user specified a value.
125
126 size_t openssl_async_pool_init; //!< Tuning option to set the minimum number of requests
127 ///< in the async ctx pool.
128
129 size_t openssl_async_pool_max; //!< Tuning option to set the maximum number of requests
130 ///< in the async ctx pool.
131#endif
132
133 /*
134 * Debugging options
135 */
136 uint32_t debug_level; //!< The base log level for the server.
137
138 bool talloc_memory_report; //!< Print a memory report on what's left unfreed.
139 //!< Can only be used when the server is running in single
140 //!< threaded mode.
141
142 bool talloc_skip_cleanup; //!< skip talloc cleanups at exit
143
144 bool allow_core_dumps; //!< Whether the server is allowed to drop a core when
145 //!< receiving a fatal signal.
146
147 char const *panic_action; //!< Command to execute if the server receives a fatal
148 //!< signal.
149
150
151 /*
152 * Multiple processing sharing configs
153 */
154 bool allow_multiple_procs; //!< Allow multiple instances of radiusd to run with the
155 ///< same config file.
156
157 int multi_proc_sem_id; //!< Semaphore we use to prevent multiple processes running.
158 char *multi_proc_sem_path; //!< Semaphore path.
159
160 /*
161 * Internal scheduler configuration
162 */
163 uint32_t max_networks; //!< for the scheduler
164 uint32_t max_workers; //!< for the scheduler
165 fr_time_delta_t stats_interval; //!< for the scheduler
166
167 fr_worker_config_t worker; //!< Worker thread configuration.
168
169#ifndef NDEBUG
170 uint32_t ins_max; //!< max instruction count
171 bool ins_countup; //!< count up to "max"
172#endif
173};
174
175void main_config_name_set_default(main_config_t *config, char const *name, bool overwrite_config);
176void main_config_confdir_set(main_config_t *config, char const *path);
177void main_config_dict_dir_set(main_config_t *config, char const *path);
178
179int main_config_save_override(char const *value);
180
184
185main_config_t *main_config_alloc(TALLOC_CTX *ctx);
190
191#ifdef __cplusplus
192}
193#endif
#define RCSIDH(h, id)
Definition build.h:561
A section grouping multiple CONF_PAIR.
Definition cf_priv.h:106
Test enumeration values.
Definition dict_test.h:92
char const * log_dest
Definition main_config.h:87
int multi_proc_sem_id
Semaphore we use to prevent multiple processes running.
char const * panic_action
Command to execute if the server receives a fatal signal.
void main_config_exclusive_proc_done(main_config_t const *config)
int32_t syslog_facility
Definition main_config.h:96
fr_time_delta_t stats_interval
for the scheduler
uint32_t max_networks
for the scheduler
char const * radacct_dir
Definition main_config.h:79
char const * lib_dir
Definition main_config.h:80
int main_config_free(main_config_t **config)
main_config_t * main_config_alloc(TALLOC_CTX *ctx)
Allocate a main_config_t struct, setting defaults.
void main_config_dict_dir_set(main_config_t *config, char const *path)
Set the global dictionary directory.
char const * name
Name of the daemon, usually 'radiusd'.
Definition main_config.h:60
bool hostname_lookups
do hostname -> IP lookups
Definition main_config.h:75
bool talloc_memory_report
Print a memory report on what's left unfreed.
char const * local_state_dir
Definition main_config.h:72
void main_config_hup(main_config_t *config)
bool drop_requests
Administratively disable request processing.
Definition main_config.h:76
char const * chdir
where to chdir() to when we start.
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)
uint32_t max_workers
for the scheduler
void main_config_name_set_default(main_config_t *config, char const *name, bool overwrite_config)
Set the server name.
bool daemonize
Should the server daemonize on startup.
Definition main_config.h:65
bool log_timestamp_is_set
Definition main_config.h:94
fr_dict_t * dict
Main dictionary.
Definition main_config.h:99
fr_worker_config_t worker
Worker thread configuration.
char const * pid_file
Path to write out PID file.
Definition main_config.h:67
void hup_logfile(main_config_t *config)
main_config_limit_t limit
limit files, exec, etc.
bool suppress_secrets
suppress secrets (or not)
Definition main_config.h:77
int main_config_exclusive_proc_child(main_config_t const *config)
char const * sbin_dir
Definition main_config.h:81
bool write_pid
write the PID file
Definition main_config.h:69
char const * log_dir
Definition main_config.h:71
bool allow_multiple_procs
Allow multiple instances of radiusd to run with the same config file.
uint32_t ins_max
max instruction count
bool log_line_number
Log src file/line the message was generated on.
Definition main_config.h:90
char const * dict_dir
Where to load dictionaries from.
Definition main_config.h:98
bool exec_is_set
if we have a limit { exec { ... } } section.
Definition main_config.h:49
uint32_t debug_level
The base log level for the server.
char const * prefix
Definition main_config.h:85
bool talloc_skip_cleanup
skip talloc cleanups at exit
bool overwrite_config_name
Overwrite the configured name, as this was specified by the user on the command line.
Definition main_config.h:61
bool ins_countup
count up to "max"
char const * confdir
Path to configuration directory.
Definition main_config.h:83
bool reverse_lookups
do IP -> host lookups. Don't set this!
Definition main_config.h:74
int main_config_init(main_config_t *config)
void main_config_confdir_set(main_config_t *config, char const *path)
Set the global radius config directory.
bool files_is_set
if we have a limit { files { ... } } section.
Definition main_config.h:48
main_config_t const * main_config
Global configuration singleton.
Definition main_config.c:56
char * multi_proc_sem_path
Semaphore path.
char const ** exec
where exec() is limited to
Definition main_config.h:52
bool allow_core_dumps
Whether the server is allowed to drop a core when receiving a fatal signal.
CONF_SECTION * root_cs
Root of the server config.
Definition main_config.h:63
int main_config_save_override(char const *value)
char const * run_dir
Definition main_config.h:82
char const ** readonly_files
where file....() is limited to for read
Definition main_config.h:51
bool spawn_workers
Should the server spawn threads.
Definition main_config.h:66
char const ** allowed_files
where file....() is limited to for read / write
Definition main_config.h:50
char const * log_file
Definition main_config.h:88
Main server configuration.
Definition main_config.h:59
unsigned int uint32_t
static const conf_parser_t config[]
Definition base.c:162
static char const * name
A time delta, a difference in time measured in nanoseconds.
Definition time.h:80