로그아웃 인증 정리

This commit is contained in:
seo
2026-07-02 19:17:45 +09:00
parent d000b25648
commit a824d3bcda
3 changed files with 18 additions and 0 deletions
+1
View File
@@ -224,6 +224,7 @@ control-wifi-observe.service
- 로그인 세션과 CSRF token을 사용합니다. - 로그인 세션과 CSRF token을 사용합니다.
- Rhymix 사이트 관리자 세션 또는 `/custom/common` 관리자 인증 쿠키가 확인되면 Control 내부 로그인 세션을 발급합니다. - Rhymix 사이트 관리자 세션 또는 `/custom/common` 관리자 인증 쿠키가 확인되면 Control 내부 로그인 세션을 발급합니다.
- Control 로그아웃은 Control remember token과 세션을 지우고, `/custom/common` 공통 인증 쿠키도 함께 만료합니다.
- POST 조작 API는 CSRF 검증을 통과해야 합니다. - POST 조작 API는 CSRF 검증을 통과해야 합니다.
- sysfs 쓰기와 systemctl 실행 권한은 sudoers 범위로 제한해야 합니다. - sysfs 쓰기와 systemctl 실행 권한은 sudoers 범위로 제한해야 합니다.
- 재부팅 API는 CSRF, 로그인 세션, 설정된 확인 문구, 관리자 암호 재검증을 모두 요구합니다. - 재부팅 API는 CSRF, 로그인 세션, 설정된 확인 문구, 관리자 암호 재검증을 모두 요구합니다.
+16
View File
@@ -707,6 +707,22 @@ function control_admin_session_from_rhymix_or_custom(): bool
return $checked; return $checked;
} }
function clear_common_admin_auth_cookie_if_available(): void
{
$commonAuth = '/mnt/synology-web/custom/common/auth.php';
if (!is_file($commonAuth) || !is_readable($commonAuth)) {
return;
}
try {
require_once $commonAuth;
if (function_exists('custom_clear_auth_cookie')) {
custom_clear_auth_cookie();
}
} catch (Throwable) {
}
}
function require_login(): void function require_login(): void
{ {
if (!signed_in()) { if (!signed_in()) {
+1
View File
@@ -10,6 +10,7 @@ $csrf = csrf_token();
if (isset($_GET['logout'])) { if (isset($_GET['logout'])) {
clear_remember_token(); clear_remember_token();
clear_common_admin_auth_cookie_if_available();
$_SESSION = []; $_SESSION = [];
if (ini_get('session.use_cookies')) { if (ini_get('session.use_cookies')) {
$p = session_get_cookie_params(); $p = session_get_cookie_params();