Skip to content

Commit 370fdce

Browse files
test(dgw): run injection E2E without debug flags
Keep credential-injection tests focused on public behavior instead of serializing the removed Kerberos debug option. Issue: DVLS-14697 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 746349d commit 370fdce

3 files changed

Lines changed: 20 additions & 27 deletions

File tree

‎testsuite/src/dgw_config.rs‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,6 @@ pub struct DgwConfig {
4545
/// Enable unstable features.
4646
#[builder(default = false)]
4747
enable_unstable: bool,
48-
/// Enable Kerberos credential injection (also requires `enable_unstable`).
49-
#[builder(default = false)]
50-
kerberos_credential_injection: bool,
5148
/// Override the recording path in the gateway config.
5249
///
5350
/// When `None`, the gateway uses its default (`<data_dir>/recordings`).
@@ -87,7 +84,6 @@ impl DgwConfigHandle {
8784
disable_token_validation,
8885
verbosity_profile,
8986
enable_unstable,
90-
kerberos_credential_injection,
9187
recording_path,
9288
agent_tunnel,
9389
} = config;
@@ -141,8 +137,7 @@ impl DgwConfigHandle {
141137
"VerbosityProfile": "{verbosity_profile}",
142138
"__debug__": {{
143139
"disable_token_validation": {disable_token_validation},
144-
"enable_unstable": {enable_unstable},
145-
"kerberos_credential_injection": {kerberos_credential_injection}
140+
"enable_unstable": {enable_unstable}
146141
}}{recording_path_json}{agent_tunnel_json}
147142
}}"#
148143
);

‎testsuite/tests/cli/dgw/cred_injection.rs‎

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -226,12 +226,10 @@ pub(crate) struct GatewayProc {
226226
}
227227

228228
impl GatewayProc {
229-
pub(crate) async fn start(kerberos: bool) -> anyhow::Result<Self> {
229+
pub(crate) async fn start() -> anyhow::Result<Self> {
230230
let config = DgwConfig::builder()
231231
.disable_token_validation(true)
232232
.verbosity_profile(VerbosityProfile::DEBUG)
233-
.enable_unstable(kerberos)
234-
.kerberos_credential_injection(kerberos)
235233
.build()
236234
.init()
237235
.context("init gateway config")?;
@@ -430,7 +428,7 @@ async fn connect_rdp_client(gateway_tcp: u16, association_jwt: &str) -> anyhow::
430428
#[tokio::test]
431429
async fn first_rdp_connection_injects_ntlm() -> anyhow::Result<()> {
432430
let target = FakeRdpTarget::start().await?;
433-
let mut gateway = GatewayProc::start(false).await?;
431+
let mut gateway = GatewayProc::start().await?;
434432

435433
let jti = next_id();
436434
let jet_aid = next_id();
@@ -462,7 +460,7 @@ async fn first_rdp_connection_injects_ntlm() -> anyhow::Result<()> {
462460
#[tokio::test]
463461
async fn reconnect_same_jwt_still_injects() -> anyhow::Result<()> {
464462
let target = FakeRdpTarget::start().await?;
465-
let mut gateway = GatewayProc::start(false).await?;
463+
let mut gateway = GatewayProc::start().await?;
466464

467465
let jti = next_id();
468466
let jet_aid = next_id();
@@ -500,7 +498,7 @@ async fn reconnect_same_jwt_still_injects() -> anyhow::Result<()> {
500498
#[tokio::test]
501499
async fn required_missing_fails_closed() -> anyhow::Result<()> {
502500
let target = FakeRdpTarget::start().await?;
503-
let mut gateway = GatewayProc::start(false).await?;
501+
let mut gateway = GatewayProc::start().await?;
504502

505503
let jti = next_id();
506504
let jet_aid = next_id();
@@ -533,7 +531,7 @@ async fn required_missing_fails_closed() -> anyhow::Result<()> {
533531
#[tokio::test]
534532
async fn unprovisioned_rdp_uses_ordinary_forward() -> anyhow::Result<()> {
535533
let target = FakeRdpTarget::start().await?;
536-
let mut gateway = GatewayProc::start(false).await?;
534+
let mut gateway = GatewayProc::start().await?;
537535

538536
let jti = next_id();
539537
let jet_aid = next_id();
@@ -560,7 +558,7 @@ async fn unprovisioned_rdp_uses_ordinary_forward() -> anyhow::Result<()> {
560558
#[tokio::test]
561559
async fn kerberos_reconnect_reuses_generation_until_reprovision() -> anyhow::Result<()> {
562560
let target = FakeRdpTarget::start().await?;
563-
let mut gateway = GatewayProc::start(true).await?;
561+
let mut gateway = GatewayProc::start().await?;
564562

565563
let jti = next_id();
566564
let jet_aid = next_id();
@@ -647,7 +645,7 @@ async fn kerberos_reconnect_reuses_generation_until_reprovision() -> anyhow::Res
647645
#[tokio::test]
648646
async fn domainless_target_stays_ntlm_even_with_krb_kdc() -> anyhow::Result<()> {
649647
let target = FakeRdpTarget::start().await?;
650-
let mut gateway = GatewayProc::start(true).await?;
648+
let mut gateway = GatewayProc::start().await?;
651649

652650
let jti = next_id();
653651
let jet_aid = next_id();
@@ -673,9 +671,9 @@ async fn domainless_target_stays_ntlm_even_with_krb_kdc() -> anyhow::Result<()>
673671
}
674672

675673
#[tokio::test]
676-
async fn kerberos_opt_out_uses_ntlm_for_domain_user() -> anyhow::Result<()> {
674+
async fn kerberos_injection_does_not_need_debug_flags() -> anyhow::Result<()> {
677675
let target = FakeRdpTarget::start().await?;
678-
let mut gateway = GatewayProc::start(false).await?;
676+
let mut gateway = GatewayProc::start().await?;
679677

680678
let jti = next_id();
681679
let jet_aid = next_id();
@@ -692,8 +690,8 @@ async fn kerberos_opt_out_uses_ntlm_for_domain_user() -> anyhow::Result<()> {
692690
let _client = connect_rdp_client(gateway.config.tcp_port(), &token).await?;
693691
let logs = gateway.logs.wait_contains(INJECT_LOG).await?;
694692
assert!(
695-
logs.contains("kerberos=false"),
696-
"Kerberos injection opt-out must NTLM even with a domain username; logs:\n{logs}"
693+
logs.contains("kerberos=true"),
694+
"Kerberos injection must run without debug flags; logs:\n{logs}"
697695
);
698696

699697
let _ = gateway.process.start_kill();

‎testsuite/tests/cli/dgw/cred_injection_kdc.rs‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -972,7 +972,7 @@ async fn kerberos_injection_completes_credssp_against_mock_kdc() -> anyhow::Resu
972972
install_crypto_provider();
973973
let kdc = MockKdc::start().await?;
974974
let rdp = MockRdp::start_kerberos(kdc.url()).await?;
975-
let mut gateway = GatewayProc::start(true).await?;
975+
let mut gateway = GatewayProc::start().await?;
976976

977977
let jti = next_id();
978978
let jet_aid = next_id();
@@ -1021,7 +1021,7 @@ async fn kerberos_client_and_target_legs_complete_credssp() -> anyhow::Result<()
10211021
install_crypto_provider();
10221022
let kdc = MockKdc::start().await?;
10231023
let rdp = MockRdp::start_kerberos(kdc.url()).await?;
1024-
let mut gateway = GatewayProc::start(true).await?;
1024+
let mut gateway = GatewayProc::start().await?;
10251025

10261026
let jti = next_id();
10271027
let jet_aid = next_id();
@@ -1111,7 +1111,7 @@ async fn kerberos_wrong_target_password_fails_closed() -> anyhow::Result<()> {
11111111
install_crypto_provider();
11121112
let kdc = MockKdc::start().await?;
11131113
let rdp = MockRdp::start_kerberos(kdc.url()).await?;
1114-
let mut gateway = GatewayProc::start(true).await?;
1114+
let mut gateway = GatewayProc::start().await?;
11151115

11161116
let jti = next_id();
11171117
let jet_aid = next_id();
@@ -1219,7 +1219,7 @@ async fn kerberos_kdc_down_fails_closed() -> anyhow::Result<()> {
12191219
let kdc = RefusingKdc::start().await?;
12201220
let rdp_kdc = MockKdc::start().await?;
12211221
let rdp = MockRdp::start_kerberos(rdp_kdc.url()).await?;
1222-
let mut gateway = GatewayProc::start(true).await?;
1222+
let mut gateway = GatewayProc::start().await?;
12231223

12241224
let jti = next_id();
12251225
let jet_aid = next_id();
@@ -1277,7 +1277,7 @@ async fn kerberos_kdc_down_fails_closed() -> anyhow::Result<()> {
12771277
#[tokio::test]
12781278
async fn kerberos_missing_krb_kdc_fails_closed() -> anyhow::Result<()> {
12791279
let rdp = FakeClosedTarget::start().await?;
1280-
let mut gateway = GatewayProc::start(true).await?;
1280+
let mut gateway = GatewayProc::start().await?;
12811281

12821282
let jti = next_id();
12831283
let jet_aid = next_id();
@@ -1309,7 +1309,7 @@ async fn kerberos_missing_krb_kdc_fails_closed() -> anyhow::Result<()> {
13091309
async fn ntlm_injection_completes_credssp_both_legs() -> anyhow::Result<()> {
13101310
install_crypto_provider();
13111311
let rdp = MockRdp::start_ntlm().await?;
1312-
let mut gateway = GatewayProc::start(false).await?;
1312+
let mut gateway = GatewayProc::start().await?;
13131313

13141314
let jti = next_id();
13151315
let jet_aid = next_id();
@@ -1514,7 +1514,7 @@ async fn ironrdp_agent_rdcleanpath_ntlm_injection() -> anyhow::Result<()> {
15141514
};
15151515
install_crypto_provider();
15161516
let rdp = MockRdp::start_ntlm().await?;
1517-
let mut gateway = GatewayProc::start(false).await?;
1517+
let mut gateway = GatewayProc::start().await?;
15181518
let endpoint = ironrdp_agent_endpoint();
15191519
let mut daemon = start_ironrdp_daemon(&bin, &endpoint).await?;
15201520

@@ -1573,7 +1573,7 @@ async fn ironrdp_agent_rdcleanpath_kerberos_injection() -> anyhow::Result<()> {
15731573
install_crypto_provider();
15741574
let kdc = MockKdc::start().await?;
15751575
let rdp = MockRdp::start_kerberos(kdc.url()).await?;
1576-
let mut gateway = GatewayProc::start(true).await?;
1576+
let mut gateway = GatewayProc::start().await?;
15771577
let endpoint = ironrdp_agent_endpoint();
15781578
let mut daemon = start_ironrdp_daemon(&bin, &endpoint).await?;
15791579

0 commit comments

Comments
 (0)