blob: 61478e9f9282ba850ea26542029eef7191474769 [file] [log] [blame]
Nan Zhou307386e2022-10-12 20:29:34 +00001# Gather the Configuration data
2
3conf_data = configuration_data()
Ed Tanous25b54db2024-04-17 15:40:31 -07004
5feature_options = [
6 'basic-auth',
7 'cookie-auth',
Ed Tanousb360d5b2024-07-02 11:49:19 -07008 'experimental-bmcweb-user',
Alexander Hansen6c58a032024-11-21 15:27:04 -08009 'experimental-redfish-dbus-log-subscription',
Ed Tanousf4225d72025-02-20 14:56:15 -080010 'experimental-redfish-multi-computer-system',
Ed Tanous25b54db2024-04-17 15:40:31 -070011 'google-api',
12 'host-serial-socket',
Ed Tanousb2539062024-03-12 16:58:35 -070013 'http-zstd',
Ed Tanous39fe3af2025-02-17 11:34:12 -080014 'http2',
Gunnar Mills68896202024-08-21 11:34:20 -050015 'hypervisor-computer-system',
Ed Tanous25b54db2024-04-17 15:40:31 -070016 'ibm-management-console',
17 'insecure-disable-auth',
18 'insecure-disable-csrf',
19 'insecure-disable-ssl',
20 'insecure-enable-redfish-query',
21 'insecure-ignore-content-type',
22 'insecure-push-style-notification',
Ed Tanous25b54db2024-04-17 15:40:31 -070023 'kvm',
24 'mutual-tls-auth',
Ed Tanousf4225d72025-02-20 14:56:15 -080025 'redfish',
Ed Tanous25b54db2024-04-17 15:40:31 -070026 'redfish-aggregation',
Janet Adkinsf664fd82025-07-23 14:01:43 -050027 'redfish-allow-deprecated-indicatorled',
Ed Tanous25b54db2024-04-17 15:40:31 -070028 'redfish-allow-deprecated-power-thermal',
Ed Tanous6a371402024-12-03 14:01:25 -080029 'redfish-allow-simple-update',
Ed Tanous25b54db2024-04-17 15:40:31 -070030 'redfish-bmc-journal',
31 'redfish-cpu-log',
32 'redfish-dbus-log',
33 'redfish-dump-log',
34 'redfish-host-logger',
35 'redfish-new-powersubsystem-thermalsubsystem',
36 'redfish-oem-manager-fan-data',
37 'redfish-provisioning-feature',
Jagpal Singh Gill57855662024-04-17 10:44:27 -070038 'redfish-updateservice-use-dbus',
Ed Tanousf4225d72025-02-20 14:56:15 -080039 'redfish-use-3-digit-messageid',
Janet Adkinseb261e12025-09-15 13:25:45 -050040 'redfish-use-hardcoded-system-location-indicator',
Ed Tanous25b54db2024-04-17 15:40:31 -070041 'rest',
42 'session-auth',
43 'static-hosting',
44 'tests',
45 'vm-websocket',
46 'xtoken-auth',
47]
48
49string_options = [
50 'dns-resolver',
Ed Tanous3ce36882024-06-09 10:58:16 -070051 'mutual-tls-common-name-parsing-default',
Ed Tanous253f11b2024-05-16 09:38:31 -070052 'redfish-manager-uri-name',
53 'redfish-system-uri-name',
Ed Tanous25b54db2024-04-17 15:40:31 -070054]
55
rohitpaicf9085a2025-02-24 12:33:59 +053056int_options = ['http-body-limit', 'watchdog-timeout-seconds']
Ed Tanous25b54db2024-04-17 15:40:31 -070057
Ed Tanous7e5e98d2025-03-12 10:34:24 -070058feature_options_string = '\n// Feature options\n'
Ed Tanousfe907df2024-05-07 16:37:09 -070059string_options_string = '\n// String options\n'
60int_options_string = '\n// Integer options\n'
Ed Tanous25b54db2024-04-17 15:40:31 -070061
Ed Tanous25b54db2024-04-17 15:40:31 -070062
Ed Tanous7e5e98d2025-03-12 10:34:24 -070063foreach feature_type, feature_list : {
64 'Feature': feature_options,
65 'Numeric': int_options,
66 'String': string_options,
67}
68 summary_dict = {}
69 foreach option_key : feature_list
70 option_key_config = 'BMCWEB_' + option_key.to_upper()
71 option_key_config = option_key_config.replace('-', '_')
Ed Tanousfe907df2024-05-07 16:37:09 -070072
Ed Tanous7e5e98d2025-03-12 10:34:24 -070073 opt = get_option(option_key)
74 if feature_type == 'Feature'
75 opt = opt.allowed()
76 feature_options_string += 'constexpr const bool @0@=@1@;\n'.format(
77 option_key_config,
78 opt.to_string(),
79 )
80 endif
81 if feature_type == 'Numeric'
82 int_options_string += 'constexpr const int @0@=@1@;\n'.format(
83 option_key_config,
84 opt.to_string(),
85 )
86 endif
87 if feature_type == 'String'
88 string_options_string += 'constexpr std::string_view @0@="@1@";\n'.format(
89 option_key_config,
90 opt,
91 )
92 endif
93 summary_dict += {option_key: opt}
94 endforeach
95 summary(summary_dict, section: feature_type + ' Options', bool_yn: true)
Ed Tanous25b54db2024-04-17 15:40:31 -070096endforeach
97
Myung Bae662aa6e2023-01-10 14:20:28 -060098# Logging level
99loglvlopt = get_option('bmcweb-logging')
100if get_option('buildtype').startswith('debug') and loglvlopt == 'disabled'
Ed Tanous25b54db2024-04-17 15:40:31 -0700101 # Override logging level as 'debug' if 'bmcweb-logging' is set as 'disabled'
Ed Tanousf2caadc2024-01-02 18:34:36 -0800102 loglvlopt = 'debug'
Myung Bae662aa6e2023-01-10 14:20:28 -0600103endif
Ed Tanouse7245fe2023-07-24 17:01:38 -0700104loglvlopt = loglvlopt.to_upper()
Ed Tanousfe907df2024-05-07 16:37:09 -0700105string_options_string += 'constexpr std::string_view BMCWEB_LOGGING_LEVEL' + ' = "' + loglvlopt + '";\n'
106
107# NBD proxy is disabled due to lack of maintenance. See meson_options.txt
Ed Tanous7e5e98d2025-03-12 10:34:24 -0700108feature_options_string += 'constexpr const bool BMCWEB_VM_NBDPROXY = false;\n'
Ed Tanousfe907df2024-05-07 16:37:09 -0700109
110conf_data.set(
111 'BMCWEB_OPTIONS',
112 string_options_string + int_options_string + feature_options_string,
113)
Myung Bae662aa6e2023-01-10 14:20:28 -0600114
Nan Zhou307386e2022-10-12 20:29:34 +0000115conf_h_dep = declare_dependency(
116 include_directories: include_directories('.'),
117 sources: configure_file(
118 input: 'bmcweb_config.h.in',
119 output: 'bmcweb_config.h',
Ed Tanousf2caadc2024-01-02 18:34:36 -0800120 configuration: conf_data,
121 ),
Nan Zhou307386e2022-10-12 20:29:34 +0000122)
123
124# Configure and install systemd unit files
Ed Tanous796ba932020-08-02 04:29:21 +0000125https_port = get_option('https_port')
126if https_port > 0
127 configure_file(
128 input: 'bmcweb.socket.in',
129 output: 'bmcweb.socket',
130 install_dir: systemd_system_unit_dir,
131 install: true,
132 configuration: configuration_data(
133 {
134 'BMCWEB_PORT': https_port,
135 'HTTP_LEVEL_ALLOWED': 'https',
136 'HTTP_AUTH_LEVEL': 'auth',
137 'HTTP_BIND': '',
138 },
139 ),
140 )
141endif
142
143ports = get_option('additional-ports')
144binds = get_option('additional-bind-to-device')
Janet Adkins58d3aab2025-02-19 14:45:43 -0600145auths = get_option('additional-auth')
Ed Tanous796ba932020-08-02 04:29:21 +0000146foreach index : range(ports.length())
147 port_number = ports[index]
148 bind_to_device = '0.0.0.0'
149 auth = 'auth'
150 if index < binds.length()
Janet Adkins58d3aab2025-02-19 14:45:43 -0600151 bind_to_device = binds[index]
Ed Tanous796ba932020-08-02 04:29:21 +0000152 endif
153
Janet Adkins58d3aab2025-02-19 14:45:43 -0600154 if index < auths.length()
155 auth = auths[index]
Ed Tanous796ba932020-08-02 04:29:21 +0000156 endif
157
Thu Nguyen762bfdf2025-08-12 13:49:54 +0000158 filename = 'bmcweb_' + port_number + '.socket'
Ed Tanous796ba932020-08-02 04:29:21 +0000159 configure_file(
160 input: 'bmcweb.socket.in',
161 output: filename,
162 install_dir: systemd_system_unit_dir,
163 install: true,
164 configuration: configuration_data(
165 {
Thu Nguyen762bfdf2025-08-12 13:49:54 +0000166 'BMCWEB_PORT': port_number,
Ed Tanous796ba932020-08-02 04:29:21 +0000167 'HTTP_LEVEL_ALLOWED': 'https',
Janet Adkins58d3aab2025-02-19 14:45:43 -0600168 'HTTP_BIND': bind_to_device,
Ed Tanous796ba932020-08-02 04:29:21 +0000169 'HTTP_AUTH_LEVEL': auth,
170 },
171 ),
172 )
173endforeach
Nan Zhou307386e2022-10-12 20:29:34 +0000174
Ed Tanousb360d5b2024-07-02 11:49:19 -0700175if get_option('experimental-bmcweb-user').allowed()
176 user = 'bmcweb'
177 group = 'bmcweb'
178 dynamic_user = 'yes'
179 state_directory = 'bmcweb'
180 work_dir = '-~'
181else
182 user = 'root'
183 group = 'root'
184 dynamic_user = 'no'
185 state_directory = '/home/root'
186 work_dir = '/home/root'
187endif
188
Ed Tanousf2caadc2024-01-02 18:34:36 -0800189configure_file(
190 input: 'bmcweb.service.in',
191 output: 'bmcweb.service',
192 install_dir: systemd_system_unit_dir,
Ed Tanousf2caadc2024-01-02 18:34:36 -0800193 install: true,
Ed Tanous92e26be2024-08-21 13:39:14 -0700194 configuration: configuration_data(
rohitpaicf9085a2025-02-24 12:33:59 +0530195 {
196 'MESON_INSTALL_PREFIX': get_option('prefix'),
Ed Tanousb360d5b2024-07-02 11:49:19 -0700197 'BMCWEB_USER': user,
198 'BMCWEB_GROUP': group,
199 'BMCWEB_STATE_DIRECTORY': state_directory,
200 'BMCWEB_DYNAMICUSER': dynamic_user,
201 'BMCWEB_WORKING_DIRECTORY': work_dir,
Roger G. Coscojuela38b3b6f2025-04-16 15:58:00 +0200202 'BMCWEB_WATCHDOG_TIMEOUT_SECONDS': get_option(
203 'watchdog-timeout-seconds',
204 ),
rohitpaicf9085a2025-02-24 12:33:59 +0530205 },
Ed Tanous92e26be2024-08-21 13:39:14 -0700206 ),
Ed Tanousf2caadc2024-01-02 18:34:36 -0800207)
Nan Zhou307386e2022-10-12 20:29:34 +0000208
209# Copy pam-webserver to etc/pam.d
Ed Tanous92e26be2024-08-21 13:39:14 -0700210install_data('pam-webserver', install_dir: '/etc/pam.d/', rename: 'webserver')