@@ -13,20 +13,20 @@ import (
13
13
"golang.org/x/exp/slog"
14
14
)
15
15
16
- const racAutoDisableCheckInterval = 3 * time .Minute
16
+ const unauthorisedUserNodeCheckInterval = 3 * time .Minute
17
17
18
- // AddRacHooks - adds hooks for Remote Access Client
19
- func AddRacHooks () {
20
- slog .Debug ("adding RAC autodisable hook" )
18
+ // AddUnauthorisedUserNodeHooks - adds hook to prevent access from unauthorised (expired) user nodes
19
+ func AddUnauthorisedUserNodeHooks () {
20
+ slog .Debug ("adding unauthorisedUserNode hook" )
21
21
logic .HookManagerCh <- models.HookDetails {
22
- Hook : racAutoDisableHook ,
23
- Interval : racAutoDisableCheckInterval ,
22
+ Hook : unauthorisedUserNodeHook ,
23
+ Interval : unauthorisedUserNodeCheckInterval ,
24
24
}
25
25
}
26
26
27
- // racAutoDisableHook - checks if RAC is enabled and if it is, checks if it should be disabled
28
- func racAutoDisableHook () error {
29
- slog .Debug ("running RAC autodisable hook" )
27
+ // unauthorisedUserNodeHook - checks if a user node should be disabled, using the user's last login time
28
+ func unauthorisedUserNodeHook () error {
29
+ slog .Debug ("running unauthorisedUserNode hook" )
30
30
31
31
users , err := logic .GetUsers ()
32
32
if err != nil {
@@ -55,16 +55,16 @@ func racAutoDisableHook() error {
55
55
}
56
56
if (client .OwnerID == user .UserName ) &&
57
57
client .Enabled {
58
- slog .Info (fmt .Sprintf ("disabling ext client %s for user %s due to RAC autodisabling " , client .ClientID , client .OwnerID ))
58
+ slog .Info (fmt .Sprintf ("disabling user node %s for user %s: auth token expired " , client .ClientID , client .OwnerID ))
59
59
if err := disableExtClient (& client ); err != nil {
60
- slog .Error ("error disabling ext client in RAC autodisable hook " , "error" , err )
60
+ slog .Error ("error disabling user node " , "error" , err )
61
61
continue // dont return but try for other clients
62
62
}
63
63
}
64
64
}
65
65
}
66
66
67
- slog .Debug ("finished running RAC autodisable hook" )
67
+ slog .Debug ("finished running unauthorisedUserNode hook" )
68
68
return nil
69
69
}
70
70
0 commit comments