차량 모니터 인증 유지를 보강

This commit is contained in:
seo
2026-06-29 04:53:35 +09:00
parent ff58a0b956
commit 80d472aa05
2 changed files with 21 additions and 4 deletions
+3 -2
View File
@@ -113,8 +113,9 @@ Worker 교체나 예외 종료로 `processing`, `ui_timeout_pending` 상태가
## 보안 ## 보안
- 차량 API는 API token 또는 허용 IP 정책을 사용합니다. - 차량 API는 API token 또는 허용 IP 정책을 사용합니다.
- 차량 모니터 화면과 `monitor.php?mode=ajax`, `monitor.php?mode=usage`는 런처 공통 인증 쿠키 유효할 때만 응답합니다. - 차량 모니터 화면과 `monitor.php?mode=ajax`, `monitor.php?mode=usage`는 런처 공통 인증 쿠키 또는 사이트 관리자 세션이 유효할 때만 응답합니다.
- 런처 공통 인증은 `https://chaegeon.com/custom/launcher/api.php?session=1` 응답으로 확인하며, `/mnt` 아래 NFS 마운트 경로를 런타임 fallback으로 사용하지 않습니다. - 사이트 관리자 세션이 확인되면 공통 인증 쿠키를 장기로 발급해 PWA에서 반복 인증이 뜨는 일을 줄입니다.
- 런처 공통 인증은 우선 공통 인증 모듈로 직접 확인하고, 필요 시 `https://chaegeon.com/custom/launcher/api.php?session=1` 응답으로 확인합니다.
- 차량 제어 명령은 허용된 명령 코드로 제한합니다. - 차량 제어 명령은 허용된 명령 코드로 제한합니다.
- Secret 파일은 저장소 밖에서 제한된 권한으로 유지합니다. - Secret 파일은 저장소 밖에서 제한된 권한으로 유지합니다.
- 실제 제어 명령은 최신 상태 조회와 명령 검증 이후에만 전송합니다. - 실제 제어 명령은 최신 상태 조회와 명령 검증 이후에만 전송합니다.
+18 -2
View File
@@ -548,6 +548,24 @@ function car_monitor_launcher_session(): array
return $session; return $session;
} }
$commonAuth = '/mnt/synology-web/custom/common/auth.php';
if (is_readable($commonAuth)) {
require_once $commonAuth;
if (function_exists('custom_has_auth_cookie') && custom_has_auth_cookie()) {
$session = ['authenticated' => true, 'admin' => false];
return $session;
}
if (function_exists('custom_is_site_admin') && custom_is_site_admin()) {
if (function_exists('custom_issue_auth_cookie')) {
custom_issue_auth_cookie();
}
$session = ['authenticated' => true, 'admin' => true];
return $session;
}
}
$cookieHeader = trim((string)($_SERVER['HTTP_COOKIE'] ?? '')); $cookieHeader = trim((string)($_SERVER['HTTP_COOKIE'] ?? ''));
if ($cookieHeader === '') { if ($cookieHeader === '') {
$session = ['authenticated' => false, 'admin' => false]; $session = ['authenticated' => false, 'admin' => false];
@@ -629,8 +647,6 @@ a{display:inline-flex;align-items:center;justify-content:center;min-height:44px;
<body> <body>
<main class="box"> <main class="box">
<h1>인증이 필요합니다</h1> <h1>인증이 필요합니다</h1>
<p>런처에서 관리자 세션 또는 공통 비밀번호 인증을 완료한 뒤 차량 모니터에 접속할 수 있습니다.</p>
<a href="https://chaegeon.com/blog">런처로 이동</a>
</main> </main>
</body> </body>
</html> </html>