mirror of
git://f0xx.org/ac/ac-ms-remote-access
synced 2026-07-29 02:17:46 +03:00
Remote access: accept iodine opt_in_mode in heartbeat and schema.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
committed by
Anton Afanasyeu
parent
d2602391c3
commit
8d42f818c6
@@ -9,6 +9,7 @@ final class RemoteAccessRepository {
|
||||
public const OPT_NONE = 'none';
|
||||
public const OPT_WIREGUARD = 'wireguard';
|
||||
public const OPT_RSSH = 'rssh';
|
||||
public const OPT_IODINE = 'iodine';
|
||||
|
||||
public const STATUS_PENDING = 'pending';
|
||||
public const STATUS_ACTIVE = 'active';
|
||||
@@ -243,9 +244,12 @@ final class RemoteAccessRepository {
|
||||
if ($c === 'ssh_reverse' || $c === 'rssh') {
|
||||
return self::OPT_RSSH;
|
||||
}
|
||||
if ($c === 'iodine') {
|
||||
return self::OPT_IODINE;
|
||||
}
|
||||
}
|
||||
$mode = strtolower(trim((string) ($heartbeat['tunnel_mode'] ?? '')));
|
||||
if (in_array($mode, [self::OPT_WIREGUARD, self::OPT_RSSH, self::OPT_NONE], true)) {
|
||||
if (in_array($mode, [self::OPT_WIREGUARD, self::OPT_RSSH, self::OPT_IODINE, self::OPT_NONE], true)) {
|
||||
return $mode;
|
||||
}
|
||||
return self::OPT_WIREGUARD;
|
||||
@@ -614,7 +618,7 @@ final class RemoteAccessRepository {
|
||||
return ['ok' => false, 'error' => 'device_not_opted_in'];
|
||||
}
|
||||
$optIn = (string) ($device['opt_in_mode'] ?? self::OPT_NONE);
|
||||
if (!in_array($optIn, [self::OPT_WIREGUARD, self::OPT_RSSH], true)) {
|
||||
if (!in_array($optIn, [self::OPT_WIREGUARD, self::OPT_RSSH, self::OPT_IODINE], true)) {
|
||||
return ['ok' => false, 'error' => 'device_not_opted_in'];
|
||||
}
|
||||
self::closeActiveSessionsForDevice($deviceId, 'superseded');
|
||||
|
||||
Reference in New Issue
Block a user