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-hardcoded-system-location-indicator', 40 'rest', 41 'session-auth', 42 'static-hosting', 43 'tests', 44 'vm-websocket', 45 'xtoken-auth', 46] 47 48string_options = [ 49 'dns-resolver', 50 'mutual-tls-common-name-parsing-default', 51 'redfish-manager-uri-name', 52 'redfish-system-uri-name', 53] 54 55int_options = ['http-body-limit', 'watchdog-timeout-seconds'] 56 57feature_options_string = '\n// Feature options\n' 58string_options_string = '\n// String options\n' 59int_options_string = '\n// Integer options\n' 60 61 62foreach feature_type, feature_list : { 63 'Feature': feature_options, 64 'Numeric': int_options, 65 'String': string_options, 66} 67 summary_dict = {} 68 foreach option_key : feature_list 69 option_key_config = 'BMCWEB_' + option_key.to_upper() 70 option_key_config = option_key_config.replace('-', '_') 71 72 opt = get_option(option_key) 73 if feature_type == 'Feature' 74 opt = opt.allowed() 75 feature_options_string += 'constexpr const bool @0@=@1@;\n'.format( 76 option_key_config, 77 opt.to_string(), 78 ) 79 endif 80 if feature_type == 'Numeric' 81 int_options_string += 'constexpr const int @0@=@1@;\n'.format( 82 option_key_config, 83 opt.to_string(), 84 ) 85 endif 86 if feature_type == 'String' 87 string_options_string += 'constexpr std::string_view @0@="@1@";\n'.format( 88 option_key_config, 89 opt, 90 ) 91 endif 92 summary_dict += {option_key: opt} 93 endforeach 94 summary(summary_dict, section: feature_type + ' Options', bool_yn: true) 95endforeach 96 97# Logging level 98loglvlopt = get_option('bmcweb-logging') 99if get_option('buildtype').startswith('debug') and loglvlopt == 'disabled' 100 # Override logging level as 'debug' if 'bmcweb-logging' is set as 'disabled' 101 loglvlopt = 'debug' 102endif 103loglvlopt = loglvlopt.to_upper() 104string_options_string += 'constexpr std::string_view BMCWEB_LOGGING_LEVEL' + ' = "' + loglvlopt + '";\n' 105 106# NBD proxy is disabled due to lack of maintenance. See meson_options.txt 107feature_options_string += 'constexpr const bool BMCWEB_VM_NBDPROXY = false;\n' 108 109conf_data.set( 110 'BMCWEB_OPTIONS', 111 string_options_string + int_options_string + feature_options_string, 112) 113 114conf_h_dep = declare_dependency( 115 include_directories: include_directories('.'), 116 sources: configure_file( 117 input: 'bmcweb_config.h.in', 118 output: 'bmcweb_config.h', 119 configuration: conf_data, 120 ), 121) 122 123# Configure and install systemd unit files 124https_port = get_option('https_port') 125if https_port > 0 126 configure_file( 127 input: 'bmcweb.socket.in', 128 output: 'bmcweb.socket', 129 install_dir: systemd_system_unit_dir, 130 install: true, 131 configuration: configuration_data( 132 { 133 'BMCWEB_PORT': https_port, 134 'HTTP_LEVEL_ALLOWED': 'https', 135 'HTTP_AUTH_LEVEL': 'auth', 136 'HTTP_BIND': '', 137 }, 138 ), 139 ) 140endif 141 142ports = get_option('additional-ports') 143binds = get_option('additional-bind-to-device') 144auths = get_option('additional-auth') 145foreach index : range(ports.length()) 146 port_number = ports[index] 147 bind_to_device = '0.0.0.0' 148 auth = 'auth' 149 if index < binds.length() 150 bind_to_device = binds[index] 151 endif 152 153 if index < auths.length() 154 auth = auths[index] 155 endif 156 157 filename = 'bmcweb_' + port_number + '.socket' 158 configure_file( 159 input: 'bmcweb.socket.in', 160 output: filename, 161 install_dir: systemd_system_unit_dir, 162 install: true, 163 configuration: configuration_data( 164 { 165 'BMCWEB_PORT': port_number, 166 'HTTP_LEVEL_ALLOWED': 'https', 167 'HTTP_BIND': bind_to_device, 168 'HTTP_AUTH_LEVEL': auth, 169 }, 170 ), 171 ) 172endforeach 173 174if get_option('experimental-bmcweb-user').allowed() 175 user = 'bmcweb' 176 group = 'bmcweb' 177 dynamic_user = 'yes' 178 state_directory = 'bmcweb' 179 work_dir = '-~' 180else 181 user = 'root' 182 group = 'root' 183 dynamic_user = 'no' 184 state_directory = '/home/root' 185 work_dir = '/home/root' 186endif 187 188configure_file( 189 input: 'bmcweb.service.in', 190 output: 'bmcweb.service', 191 install_dir: systemd_system_unit_dir, 192 install: true, 193 configuration: configuration_data( 194 { 195 'MESON_INSTALL_PREFIX': get_option('prefix'), 196 'BMCWEB_USER': user, 197 'BMCWEB_GROUP': group, 198 'BMCWEB_STATE_DIRECTORY': state_directory, 199 'BMCWEB_DYNAMICUSER': dynamic_user, 200 'BMCWEB_WORKING_DIRECTORY': work_dir, 201 'BMCWEB_WATCHDOG_TIMEOUT_SECONDS': get_option( 202 'watchdog-timeout-seconds', 203 ), 204 }, 205 ), 206) 207 208# Copy pam-webserver to etc/pam.d 209install_data('pam-webserver', install_dir: '/etc/pam.d/', rename: 'webserver') 210