65535) $httpPort = 81; if ($httpsPort < 1 || $httpsPort > 65535) $httpsPort = 444; $web['desktop_user'] = $target; $web['http_port'] = $httpPort; $web['https_port'] = $httpsPort; unset($web['language'], $web['theme']); bg_write_json('web_options.json', $web); $status = bg_wizard_config_status($target ?: null); $scan = bg_config_scan_dir($target ?: null); $desktopMode = bg_desktop_mode_status($target ?: null); $wizardLock = bg_wizard_lock_status($target ?: null, $scan, $status, $desktopMode); if ($action === 'run_initial_wizard') { if (!empty($wizardLock['locked'])) { $errors[] = bg_t('wizard_locked_no_post'); $log .= "Wizard locked: existing desktop configuration detected. No changes made.\n"; } elseif ($target === '') { $errors[] = bg_t('wizard_missing_desktop_user'); } else { $selectedServices = bg_wizard_selected_services_from_post($_POST, $defaultServices); $selectedSteps = bg_wizard_selected_steps_from_post($_POST); $log .= "### " . bg_t('wizard_config_file_title') . "\n"; $cfgRes = bg_write_first_run_config($target, $selectedServices); $log .= trim((string)($cfgRes['output'] ?? '')) . "\n"; if (($cfgRes['code'] ?? 1) !== 0) { $errors[] = bg_t('wizard_config_error'); } else { $messages[] = bg_t('wizard_config_created'); } if (empty($errors)) { $log .= "\n### " . bg_t('wizard_services_log_title') . "\n"; $svcRes = bg_apply_services_from_config($selectedServices); $log .= trim((string)($svcRes['output'] ?? '')) . "\n"; } if (empty($errors)) { $opts = ['desktop_user'=>$target, 'http_port'=>$httpPort, 'https_port'=>$httpsPort]; foreach ($selectedSteps as $k => $v) $opts[$k] = $v; if (count(array_filter($selectedSteps)) > 0) { $sysRes = bg_wizard_apply($opts); $log .= "\n### " . bg_t('wizard_system_log_title') . "\n" . trim((string)($sysRes['output'] ?? '')) . "\n"; if (($sysRes['code'] ?? 1) === 0) $messages[] = bg_t('wizard_system_completed'); else $errors[] = bg_t('wizard_system_error'); } else { $log .= "\n### " . bg_t('wizard_system_log_title') . "\n" . bg_t('wizard_no_system_steps_selected') . "\n"; $messages[] = bg_t('wizard_system_skipped'); } } } $status = bg_wizard_config_status($target ?: null); $scan = bg_config_scan_dir($target ?: null); $desktopMode = bg_desktop_mode_status($target ?: null); $wizardLock = bg_wizard_lock_status($target ?: null, $scan, $status, $desktopMode); } } $currentServices = is_array($status['data'] ?? null) && is_array($status['data']['services'] ?? null) ? $status['data']['services'] : $defaultServices; $lang = bg_lang_attr(); $theme = bg_theme(); $bsTheme = $theme === 'dark' ? 'dark' : 'light'; $wizardLocked = !empty($wizardLock['locked']); $stepTitles = [ bg_t('wizard_step_welcome_ui'), bg_t('wizard_step_services_ui'), bg_t('wizard_step_resolver'), bg_t('wizard_step_dnsmasq'), bg_t('wizard_step_firewall'), bg_t('wizard_step_nftables_short'), bg_t('wizard_step_certs'), bg_t('wizard_step_webserver'), bg_t('wizard_step_native'), bg_t('wizard_step_useragent'), bg_t('wizard_step_banks'), bg_t('wizard_step_review_ui'), ]; $canRun = !$wizardLocked && empty($status['exists']); ?> <?= bg_e(bg_t('wizard_page_title')) ?>
EN IT

', bg_e(bg_t('auth_webpanel_bastionguard'))) ?>

BastionGuard

config.json


$title): ?>

:

$enabled): $meta=$labels[$unit]??['label'=>$unit,'description'=>'']; $webuiDisabled = bg_webui_disabled_unit($unit); $checked = $webuiDisabled ? false : (array_key_exists($unit, $currentServices) ? !empty($currentServices[$unit]) : !empty($enabled)); ?>

      v1.0