diff --git a/installer.sh b/installer.sh index 3f090b4..81b2619 100755 --- a/installer.sh +++ b/installer.sh @@ -114,6 +114,10 @@ create_user_and_dirs() { useradd --system --home "$APP_ROOT" --shell /usr/sbin/nologin "$APP_USER" fi + if id www-data >/dev/null 2>&1; then + usermod -aG "$APP_GROUP" www-data + fi + mkdir -p \ "$APP_ROOT/app/admin" \ "$APP_ROOT/app/decoy" \ @@ -129,9 +133,17 @@ create_user_and_dirs() { "$OPENCANARY_CONF_DIR" touch "$APP_LOG" + chown -R "$APP_USER:$APP_GROUP" "$APP_ROOT" - chmod 750 "$APP_ROOT" - chmod 770 "$APP_ROOT/db" "$APP_ROOT/logs" "$APP_ROOT/config" + + chmod 755 "$APP_ROOT" + chmod 755 "$APP_ROOT/app" + chmod 755 "$APP_ROOT/app/admin" + chmod 755 "$APP_ROOT/app/decoy" + chmod 755 "$APP_ROOT/app/common" + chmod 755 "$APP_ROOT/app/reports" + + chmod 775 "$APP_ROOT/db" "$APP_ROOT/logs" "$APP_ROOT/config" } install_python_env() { @@ -224,8 +236,9 @@ INSERT OR IGNORE INTO settings(key, value) VALUES('admin_expires_at', ''); INSERT OR IGNORE INTO settings(key, value) VALUES('appliance_name', 'BaldCanary Appliance'); SQL - chown "$APP_USER:$APP_GROUP" "$APP_DB" "$APP_ROOT/db" -R - chmod 660 "$APP_DB" +chown -R "$APP_USER:$APP_GROUP" "$APP_ROOT/db" +chmod 775 "$APP_ROOT/db" +chmod 660 "$APP_DB" } write_common_php() { @@ -329,6 +342,48 @@ function bc_detection_for_request(): array { return ['page_view', null]; } + +function bc_event_label(?string $type): string { + $type = trim((string)$type); + + $labels = [ + // BaldCanary web events + 'page_view' => 'Page View', + 'form_submit' => 'Form Submission', + 'xss_probe' => 'XSS Probe', + 'sql_injection_probe' => 'SQL Injection Probe', + 'command_injection_probe' => 'Command Injection Probe', + 'path_traversal_probe' => 'Path Traversal Probe', + 'sensitive_file_probe' => 'Sensitive File Probe', + 'session_file_probe' => 'Session File Probe', + 'exposed_session_directory' => 'Exposed Session Directory', + 'php_session_file' => 'PHP Session File Access', + 'backup_directory' => 'Backup Directory Access', + 'mysql_backup_directory' => 'MySQL Backup Directory Access', + 'api_docs' => 'API Documentation Access', + 'swagger_docs' => 'Swagger Documentation Access', + 'phpinfo_probe' => 'PHP Info Probe', + 'env_file_probe' => 'Environment File Probe', + 'config_file_probe' => 'Config File Probe', + + // OpenCanary common numeric log types + '1001' => 'OpenCanary Started', + '1002' => 'OpenCanary Stopped', + '1003' => 'OpenCanary Error', + '18001' => 'RDP Connection', + ]; + + if (isset($labels[$type])) { + return $labels[$type]; + } + + // Friendly fallback: "some_event_name" -> "Some Event Name" + if (preg_match('/^[a-z0-9_\\-\\.]+$/i', $type)) { + return ucwords(str_replace(['_', '-', '.'], ' ', $type)); + } + + return $type !== '' ? $type : 'Unknown Event'; +} PHP chown -R "$APP_USER:$APP_GROUP" "$APP_ROOT/app/common" @@ -543,7 +598,7 @@ $webhooks = $db->query('SELECT * FROM webhook_targets ORDER BY id DESC')->fetchA
BaldCanary recorded interaction with the selected deception profile and exposed canary services. Events below may indicate penetration test activity, unauthorized curiosity, automated scanning, or attempted exploitation.
| Time | Severity | Type | Source IP | Method | Path | Bait |
|---|---|---|---|---|---|---|
| =h($e['event_time'])?> | =h($e['severity'])?> | =h($e['event_type'])?> | =h($e['src_ip'])?> | =h($e['method'])?> | =h($e['path'])?> | =h($e['matched_bait'])?> |
| =h($e['event_time'])?> | =h($e['severity'])?> | =h(bc_event_label($e['event_type']))?> | =h($e['src_ip'])?> | =h($e['method'])?> | =h($e['path'])?> | =h($e['matched_bait'])?> |