1# Gather the Configuration data 2 3conf_data = configuration_data() 4 5feature_options = [ 6 'basic-auth', 7 'cookie-auth', 8 'experimental-bmcweb-user', 9 'experimental-redfish-dbus-log-subscription', 10 'experimental-redfish-multi-computer-system', 11 'google-api', 12 'host-serial-socket', 13 'http-zstd', 14 'http2', 15 'hypervisor-computer-system', 16 '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', 23 'kvm', 24 'mutual-tls-auth', 25 'redfish', 26 'redfish-aggregation', 27 'redfish-allow-deprecated-indicatorled', 28 'redfish-allow-deprecated-power-thermal', 29 'redfish-allow-simple-update', 30 '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', 38 'redfish-updateservice-use-dbus', 39 'redfish-use-3-digit-messageid', 40 'redfish-use-hardcoded-system-location-indicator', 41 'rest', 42 'session-auth', 43 'static-hosting', 44 'tests', 45 'vm-websocket', 46 'xtoken-auth', 47] 48 49string_options = [ 50 'dns-resolver', 51 'mutual-tls-common-name-parsing-default', 52 'redfish-manager-uri-name', 53 'redfish-system-uri-name', 54] 55 56int_options = ['http-body-limit', 'watchdog-timeout-seconds'] 57 58feature_options_string = '\n// Feature options\n' 59string_options_string = '\n// String options\n' 60int_options_string = '\n// Integer options\n' 61 62 63foreach 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('-', '_') 72 73 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) 96endforeach 97 98# Logging level 99loglvlopt = get_option('bmcweb-logging') 100if get_option('buildtype').startswith('debug') and loglvlopt == 'disabled' 101 # Override logging level as 'debug' if 'bmcweb-logging' is set as 'disabled' 102 loglvlopt = 'debug' 103endif 104loglvlopt = loglvlopt.to_upper() 105string_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 108feature_options_string += 'constexpr const bool BMCWEB_VM_NBDPROXY = false;\n' 109 110conf_data.set( 111 'BMCWEB_OPTIONS', 112 string_options_string + int_options_string + feature_options_string, 113) 114 115conf_h_dep = declare_dependency( 116 include_directories: include_directories('.'), 117 sources: configure_file( 118 input: 'bmcweb_config.h.in', 119 output: 'bmcweb_config.h', 120 configuration: conf_data, 121 ), 122) 123 124# Configure and install systemd unit files 125https_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') 145auths = get_option('additional-auth') 146foreach 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() 151 bind_to_device = binds[index] 152 endif 153 154 if index < auths.length() 155 auth = auths[index] 156 endif 157 158 filename = 'bmcweb_' + port_number + '.socket' 159 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 { 166 'BMCWEB_PORT': port_number, 167 'HTTP_LEVEL_ALLOWED': 'https', 168 'HTTP_BIND': bind_to_device, 169 'HTTP_AUTH_LEVEL': auth, 170 }, 171 ), 172 ) 173endforeach 174 175if 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 189configure_file( 190 input: 'bmcweb.service.in', 191 output: 'bmcweb.service', 192 install_dir: systemd_system_unit_dir, 193 install: true, 194 configuration: configuration_data( 195 { 196 'MESON_INSTALL_PREFIX': get_option('prefix'), 197 'BMCWEB_USER': user, 198 'BMCWEB_GROUP': group, 199 'BMCWEB_STATE_DIRECTORY': state_directory, 200 'BMCWEB_DYNAMICUSER': dynamic_user, 201 'BMCWEB_WORKING_DIRECTORY': work_dir, 202 'BMCWEB_WATCHDOG_TIMEOUT_SECONDS': get_option( 203 'watchdog-timeout-seconds', 204 ), 205 }, 206 ), 207) 208 209# Copy pam-webserver to etc/pam.d 210install_data('pam-webserver', install_dir: '/etc/pam.d/', rename: 'webserver') 211