mirror of
https://github.com/netbirdio/netbird.git
synced 2026-10-05 21:19:08 +02:00
Leave the VNC approver nil when there is no broker to ask
This commit is contained in:
@@ -133,6 +133,16 @@ func (e *Engine) startVNCServer() error {
|
|||||||
log.Info("VNC: running as system service, enabling service mode (per-session agent proxy)")
|
log.Info("VNC: running as system service, enabling service mode (per-session agent proxy)")
|
||||||
}
|
}
|
||||||
requireApproval := e.config.DisableVNCApproval == nil || !*e.config.DisableVNCApproval
|
requireApproval := e.config.DisableVNCApproval == nil || !*e.config.DisableVNCApproval
|
||||||
|
|
||||||
|
// Left nil when there is no broker to ask, so the server's own
|
||||||
|
// no-approver refusal runs and the client is told which of the two it hit.
|
||||||
|
// Wrapping a nil broker still denies, because Broker.Request reports one as
|
||||||
|
// an error, but it denies as "approval denied" and hides the real reason.
|
||||||
|
var approver vncserver.Approver
|
||||||
|
if e.approvalBroker != nil {
|
||||||
|
approver = &vncApprover{broker: e.approvalBroker, statusRecorder: e.statusRecorder}
|
||||||
|
}
|
||||||
|
|
||||||
srv := vncserver.New(vncserver.Config{
|
srv := vncserver.New(vncserver.Config{
|
||||||
Capturer: capturer,
|
Capturer: capturer,
|
||||||
Injector: injector,
|
Injector: injector,
|
||||||
@@ -141,7 +151,7 @@ func (e *Engine) startVNCServer() error {
|
|||||||
SessionRecorder: sessionRecorder,
|
SessionRecorder: sessionRecorder,
|
||||||
NetstackNet: e.wgInterface.GetNet(),
|
NetstackNet: e.wgInterface.GetNet(),
|
||||||
RequireApproval: requireApproval,
|
RequireApproval: requireApproval,
|
||||||
Approver: &vncApprover{broker: e.approvalBroker, statusRecorder: e.statusRecorder},
|
Approver: approver,
|
||||||
// Session start/stop is invisible to the peer status recorder, so push a
|
// Session start/stop is invisible to the peer status recorder, so push a
|
||||||
// snapshot ourselves; otherwise the UI's session list goes stale until an
|
// snapshot ourselves; otherwise the UI's session list goes stale until an
|
||||||
// unrelated peer change happens to fire one.
|
// unrelated peer change happens to fire one.
|
||||||
|
|||||||
Reference in New Issue
Block a user