Accès tablette : détection des pare-feu tiers (Bitdefender, Norton…)
Constat terrain : avec Bitdefender, la règle Windows était en place et la vérification affichait « prêt » alors que le pare-feu de l'antivirus filtrait encore les connexions de la tablette. - Lecture du Centre de sécurité Windows (SecurityCenter2/FirewallProduct) : les pare-feu tiers déclarés sont remontés avec le diagnostic. - Vérification du réseau : plus de « tout est prêt » trompeur quand un pare-feu tiers est présent — avertissement nommant le logiciel, consigne (réseau domestique, mode furtif désactivé, règle entrante pour DM Loremind) et lien vers la doc. Vérifié : core clean verify (1221 tests, dont la lecture réelle sur Windows qui remonte bien « Bitdefender Pare-feu »), web build + 337 vitest, lint sans erreur. À redéployer : core + web (mode bureau ; aucune migration).
This commit is contained in:
@@ -15,6 +15,8 @@ import java.util.Locale;
|
||||
* @param publicNetworks réseaux connectés classés « Public » que le pare-feu ne laisse pas passer
|
||||
* @param firewallAllowed une règle active autorise l'application sur les réseaux privés
|
||||
* @param firewallBlocked une règle active BLOQUE l'application (ex. « Annuler » dans la fenêtre Windows)
|
||||
* @param thirdPartyFirewalls pare-feu tiers présents : leurs réglages ne sont pas lisibles, donc {@code ready}
|
||||
* ne peut pas être garanti — le front avertit l'utilisateur de les régler lui-même
|
||||
* @param program exécutable concerné
|
||||
*/
|
||||
public record NetworkReadiness(
|
||||
@@ -23,6 +25,7 @@ public record NetworkReadiness(
|
||||
List<String> publicNetworks,
|
||||
boolean firewallAllowed,
|
||||
boolean firewallBlocked,
|
||||
List<String> thirdPartyFirewalls,
|
||||
String program
|
||||
) {
|
||||
|
||||
@@ -31,7 +34,7 @@ public record NetworkReadiness(
|
||||
|
||||
public static NetworkReadiness evaluate(NetworkSnapshot snapshot) {
|
||||
if (snapshot == null || !snapshot.supported()) {
|
||||
return new NetworkReadiness(false, false, List.of(), false, false, null);
|
||||
return new NetworkReadiness(false, false, List.of(), false, false, List.of(), null);
|
||||
}
|
||||
List<NetworkSnapshot.FirewallRule> rules = snapshot.rules() == null ? List.of() : snapshot.rules();
|
||||
boolean allowedPrivate = covers(rules, "Allow", PRIVATE);
|
||||
@@ -46,8 +49,11 @@ public record NetworkReadiness(
|
||||
// Un réseau public n'est un obstacle que si le pare-feu ne l'ouvre pas explicitement.
|
||||
List<String> blockingPublic = publicOpen ? List.of() : publicNetworks;
|
||||
|
||||
// « ready » ne porte que sur ce qui est lisible (Windows) ; un pare-feu tiers est signalé à part.
|
||||
boolean ready = allowedPrivate && !blockedPrivate && blockingPublic.isEmpty();
|
||||
return new NetworkReadiness(true, ready, blockingPublic, allowedPrivate, blockedPrivate, snapshot.program());
|
||||
List<String> thirdParty = snapshot.thirdPartyFirewalls() == null ? List.of() : snapshot.thirdPartyFirewalls();
|
||||
return new NetworkReadiness(true, ready, blockingPublic, allowedPrivate, blockedPrivate, thirdParty,
|
||||
snapshot.program());
|
||||
}
|
||||
|
||||
/** Une règle ACTIVE de cette action couvre-t-elle ce profil (« Any » couvre tout) ? */
|
||||
|
||||
@@ -11,8 +11,11 @@ import java.util.List;
|
||||
* @param program exécutable visé par les règles (DM Loremind.exe en bureau)
|
||||
* @param networks réseaux connectés
|
||||
* @param rules règles entrantes du pare-feu pour ce programme
|
||||
* @param thirdPartyFirewalls pare-feu tiers déclarés à Windows (Bitdefender, Norton…) : ils filtrent
|
||||
* EN PLUS du pare-feu Windows, avec leurs propres règles, illisibles d'ici
|
||||
*/
|
||||
public record NetworkSnapshot(boolean supported, String program, List<Network> networks, List<FirewallRule> rules) {
|
||||
public record NetworkSnapshot(boolean supported, String program, List<Network> networks, List<FirewallRule> rules,
|
||||
List<String> thirdPartyFirewalls) {
|
||||
|
||||
/** Catégorie Windows : {@code Public}, {@code Private} ou {@code DomainAuthenticated}. */
|
||||
public record Network(String name, String alias, String category) {}
|
||||
@@ -25,6 +28,6 @@ public record NetworkSnapshot(boolean supported, String program, List<Network> n
|
||||
public record FirewallRule(String action, String profile, String enabled) {}
|
||||
|
||||
public static NetworkSnapshot unsupported() {
|
||||
return new NetworkSnapshot(false, null, List.of(), List.of());
|
||||
return new NetworkSnapshot(false, null, List.of(), List.of(), List.of());
|
||||
}
|
||||
}
|
||||
|
||||
+11
-2
@@ -117,7 +117,12 @@ public class WindowsHostNetworkAccess implements HostNetworkAccess {
|
||||
+ "([Environment]::ExpandEnvironmentVariables($_.Program) -ieq $p) } | Get-NetFirewallRule | "
|
||||
+ "Where-Object { $_.Direction.ToString() -eq 'Inbound' } | ForEach-Object { [pscustomobject]@{ "
|
||||
+ "action = $_.Action.ToString(); profile = $_.Profile.ToString(); enabled = $_.Enabled.ToString() } })\n"
|
||||
+ "[pscustomobject]@{ networks = $nets; rules = $rules } | ConvertTo-Json -Depth 4 -Compress\n";
|
||||
// Pare-feu TIERS déclarés au Centre de sécurité (le pare-feu Windows n'y figure pas) :
|
||||
// ils filtrent en plus de Windows, avec des règles qu'on ne peut pas lire.
|
||||
+ "$fw = @(Get-CimInstance -Namespace root/SecurityCenter2 -ClassName FirewallProduct | "
|
||||
+ "ForEach-Object { $_.displayName } | Where-Object { $_ -and $_ -notmatch 'Windows' })\n"
|
||||
+ "[pscustomobject]@{ networks = $nets; rules = $rules; thirdPartyFirewalls = $fw } | "
|
||||
+ "ConvertTo-Json -Depth 4 -Compress\n";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -150,7 +155,11 @@ public class WindowsHostNetworkAccess implements HostNetworkAccess {
|
||||
for (JsonNode r : array(root.path("rules"))) {
|
||||
rules.add(new NetworkSnapshot.FirewallRule(text(r, "action"), text(r, "profile"), text(r, "enabled")));
|
||||
}
|
||||
return new NetworkSnapshot(true, program, networks, rules);
|
||||
List<String> thirdParty = new ArrayList<>();
|
||||
for (JsonNode f : array(root.path("thirdPartyFirewalls"))) {
|
||||
if (f.isTextual() && !f.asText().isBlank()) thirdParty.add(f.asText());
|
||||
}
|
||||
return new NetworkSnapshot(true, program, networks, rules, thirdParty);
|
||||
}
|
||||
|
||||
/** ConvertTo-Json écrit un objet seul (pas un tableau) quand la liste n'a qu'un élément. */
|
||||
|
||||
@@ -17,7 +17,7 @@ class NetworkReadinessTest {
|
||||
private static final FirewallRule ALLOW_PRIVATE = new FirewallRule("Allow", "Private", "True");
|
||||
|
||||
private static NetworkReadiness eval(List<Network> networks, List<FirewallRule> rules) {
|
||||
return NetworkReadiness.evaluate(new NetworkSnapshot(true, "C:\\DM Loremind.exe", networks, rules));
|
||||
return NetworkReadiness.evaluate(new NetworkSnapshot(true, "C:\\DM Loremind.exe", networks, rules, List.of()));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -71,6 +71,15 @@ class NetworkReadinessTest {
|
||||
assertTrue(eval(List.of(HOME_PRIVATE), List.of(new FirewallRule("Allow", "Any", "True"))).ready());
|
||||
}
|
||||
|
||||
@Test
|
||||
void thirdPartyFirewall_isReported_withoutPretendingToKnowItsRules() {
|
||||
// Cas réel du 2026-10-17 : Windows prêt, mais Bitdefender filtre en plus avec ses propres règles.
|
||||
NetworkReadiness r = NetworkReadiness.evaluate(new NetworkSnapshot(true, "C:\\DM Loremind.exe",
|
||||
List.of(HOME_PRIVATE), List.of(ALLOW_PRIVATE), List.of("Bitdefender Pare-feu")));
|
||||
assertTrue(r.ready(), "Windows est prêt…");
|
||||
assertEquals(List.of("Bitdefender Pare-feu"), r.thirdPartyFirewalls(), "…mais le pare-feu tiers est signalé");
|
||||
}
|
||||
|
||||
@Test
|
||||
void publicNetwork_withoutName_usesInterfaceAlias() {
|
||||
NetworkReadiness r = eval(List.of(new Network(null, "Wi-Fi", "Public")), List.of(ALLOW_PRIVATE));
|
||||
|
||||
+14
@@ -33,6 +33,18 @@ class WindowsHostNetworkAccessTest {
|
||||
assertEquals("Private", s.networks().get(0).category());
|
||||
assertEquals(2, s.rules().size());
|
||||
assertEquals("Block", s.rules().get(1).action());
|
||||
assertTrue(s.thirdPartyFirewalls().isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
void parse_readsThirdPartyFirewalls_asSingleValueOrArray() throws Exception {
|
||||
NetworkSnapshot one = WindowsHostNetworkAccess.parseSnapshot(mapper, "C:\\app.exe",
|
||||
"{\"networks\":[],\"rules\":[],\"thirdPartyFirewalls\":\"Bitdefender Pare-feu\"}");
|
||||
assertEquals(java.util.List.of("Bitdefender Pare-feu"), one.thirdPartyFirewalls());
|
||||
|
||||
NetworkSnapshot two = WindowsHostNetworkAccess.parseSnapshot(mapper, "C:\\app.exe",
|
||||
"{\"networks\":[],\"rules\":[],\"thirdPartyFirewalls\":[\"Norton\",\"\"]}");
|
||||
assertEquals(java.util.List.of("Norton"), two.thirdPartyFirewalls());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -55,6 +67,7 @@ class WindowsHostNetworkAccessTest {
|
||||
assertFalse(allow.contains("Public"), "la règle ne doit jamais ouvrir les réseaux publics");
|
||||
assertTrue(allow.contains("Remove-NetFirewallRule"), "les blocages de CE programme sont retirés");
|
||||
assertTrue(WindowsHostNetworkAccess.inspectScript(path).contains("ConvertTo-Json"));
|
||||
assertTrue(WindowsHostNetworkAccess.inspectScript(path).contains("SecurityCenter2"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -69,5 +82,6 @@ class WindowsHostNetworkAccessTest {
|
||||
NetworkSnapshot s = new WindowsHostNetworkAccess(mapper).inspect();
|
||||
assertTrue(s.supported(), "PowerShell doit répondre en lecture seule sur Windows");
|
||||
assertNotNull(s.program());
|
||||
assertNotNull(s.thirdPartyFirewalls());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,6 +38,8 @@ export interface NetworkReadiness {
|
||||
publicNetworks: string[];
|
||||
firewallAllowed: boolean;
|
||||
firewallBlocked: boolean;
|
||||
/** Pare-feu tiers (Bitdefender…) : ils filtrent en plus de Windows, réglages illisibles d'ici. */
|
||||
thirdPartyFirewalls: string[];
|
||||
program?: string | null;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,12 +37,12 @@
|
||||
</div>
|
||||
|
||||
@if (network?.supported) {
|
||||
<div class="remote-block network-check" [class.ok]="network!.ready">
|
||||
<div class="remote-block network-check" [class.ok]="allClear">
|
||||
<h3>{{ 'remoteAccess.network.title' | translate }}</h3>
|
||||
@if (network!.ready) {
|
||||
<p class="check-ok">
|
||||
<lucide-icon [img]="CheckCircle2" [size]="16"></lucide-icon>
|
||||
{{ 'remoteAccess.network.ready' | translate }}
|
||||
{{ (thirdPartyFirewalls.length > 0 ? 'remoteAccess.network.windowsReady' : 'remoteAccess.network.ready') | translate }}
|
||||
</p>
|
||||
} @else {
|
||||
@if (network!.publicNetworks.length > 0) {
|
||||
@@ -68,6 +68,15 @@
|
||||
</div>
|
||||
}
|
||||
}
|
||||
@if (thirdPartyFirewalls.length > 0) {
|
||||
<div class="check-item">
|
||||
<p class="check-problem">{{ 'remoteAccess.network.thirdParty' | translate: { names: thirdPartyFirewalls.join(', ') } }}</p>
|
||||
<p class="note">{{ 'remoteAccess.network.thirdPartyHowTo' | translate }}</p>
|
||||
<a class="btn-link" [href]="'remoteAccess.network.docUrl' | translate" target="_blank" rel="noopener">
|
||||
{{ 'remoteAccess.network.docLink' | translate }}
|
||||
</a>
|
||||
</div>
|
||||
}
|
||||
@if (fixMessage) {
|
||||
<p class="fix-message" role="status">{{ fixMessage }}</p>
|
||||
}
|
||||
|
||||
@@ -188,6 +188,15 @@ export class RemoteAccessSectionComponent implements OnInit, OnDestroy {
|
||||
this.remoteAccess.openNetworkSettings().subscribe({ error: () => undefined });
|
||||
}
|
||||
|
||||
/** Vert seulement si rien ne bloque côté Windows ET qu'aucun pare-feu tiers n'échappe à la vérification. */
|
||||
get allClear(): boolean {
|
||||
return !!this.network && this.network.ready && this.thirdPartyFirewalls.length === 0;
|
||||
}
|
||||
|
||||
get thirdPartyFirewalls(): string[] {
|
||||
return this.network?.thirdPartyFirewalls ?? [];
|
||||
}
|
||||
|
||||
get firewallNeedsFix(): boolean {
|
||||
return !!this.network && (!this.network.firewallAllowed || this.network.firewallBlocked);
|
||||
}
|
||||
|
||||
@@ -2453,7 +2453,12 @@
|
||||
"CANCELLED": "Confirmation cancelled: nothing was changed.",
|
||||
"FAILED": "The permission failed. You can try again, or add it manually (see the documentation).",
|
||||
"UNSUPPORTED": "This check is only available on Windows."
|
||||
}
|
||||
},
|
||||
"windowsReady": "The Windows firewall and the network type let the tablet through.",
|
||||
"thirdParty": "{{names}} also filters connections on this PC, with its own rules that DM Loremind can't check. Until it allows it, the tablet will load forever.",
|
||||
"thirdPartyHowTo": "In that software's firewall settings: classify your Wi-Fi as a home network (not public, stealth mode off), then add a rule allowing incoming connections for DM Loremind.",
|
||||
"docLink": "See how to fix it",
|
||||
"docUrl": "https://loremind-docs.igmlcreation.fr/en/docs/configuration/acces-tablette#the-tablet-loads-forever"
|
||||
}
|
||||
},
|
||||
"mobileShell": {
|
||||
|
||||
@@ -2453,7 +2453,12 @@
|
||||
"CANCELLED": "Confirmation annulée : rien n'a été modifié.",
|
||||
"FAILED": "L'autorisation a échoué. Tu peux réessayer, ou l'ajouter à la main (voir la documentation).",
|
||||
"UNSUPPORTED": "Cette vérification n'est disponible que sur Windows."
|
||||
}
|
||||
},
|
||||
"windowsReady": "Le pare-feu Windows et le type de réseau laissent passer la tablette.",
|
||||
"thirdParty": "{{names}} filtre aussi les connexions sur ce PC, avec ses propres règles que DM Loremind ne peut pas vérifier. Tant qu'il ne l'autorise pas, la tablette chargera sans fin.",
|
||||
"thirdPartyHowTo": "Dans les réglages du pare-feu de ce logiciel : classe ton Wi-Fi en réseau domestique (pas public, sans mode furtif), puis ajoute une règle qui autorise DM Loremind en connexions entrantes.",
|
||||
"docLink": "Voir la marche à suivre",
|
||||
"docUrl": "https://loremind-docs.igmlcreation.fr/docs/configuration/acces-tablette#la-tablette-charge-sans-fin"
|
||||
}
|
||||
},
|
||||
"mobileShell": {
|
||||
|
||||
@@ -64,7 +64,12 @@
|
||||
"CANCELLED": "Confirmation cancelled: nothing was changed.",
|
||||
"FAILED": "The permission failed. You can try again, or add it manually (see the documentation).",
|
||||
"UNSUPPORTED": "This check is only available on Windows."
|
||||
}
|
||||
},
|
||||
"windowsReady": "The Windows firewall and the network type let the tablet through.",
|
||||
"thirdParty": "{{names}} also filters connections on this PC, with its own rules that DM Loremind can't check. Until it allows it, the tablet will load forever.",
|
||||
"thirdPartyHowTo": "In that software's firewall settings: classify your Wi-Fi as a home network (not public, stealth mode off), then add a rule allowing incoming connections for DM Loremind.",
|
||||
"docLink": "See how to fix it",
|
||||
"docUrl": "https://loremind-docs.igmlcreation.fr/en/docs/configuration/acces-tablette#the-tablet-loads-forever"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +64,12 @@
|
||||
"CANCELLED": "Confirmation annulée : rien n'a été modifié.",
|
||||
"FAILED": "L'autorisation a échoué. Tu peux réessayer, ou l'ajouter à la main (voir la documentation).",
|
||||
"UNSUPPORTED": "Cette vérification n'est disponible que sur Windows."
|
||||
}
|
||||
},
|
||||
"windowsReady": "Le pare-feu Windows et le type de réseau laissent passer la tablette.",
|
||||
"thirdParty": "{{names}} filtre aussi les connexions sur ce PC, avec ses propres règles que DM Loremind ne peut pas vérifier. Tant qu'il ne l'autorise pas, la tablette chargera sans fin.",
|
||||
"thirdPartyHowTo": "Dans les réglages du pare-feu de ce logiciel : classe ton Wi-Fi en réseau domestique (pas public, sans mode furtif), puis ajoute une règle qui autorise DM Loremind en connexions entrantes.",
|
||||
"docLink": "Voir la marche à suivre",
|
||||
"docUrl": "https://loremind-docs.igmlcreation.fr/docs/configuration/acces-tablette#la-tablette-charge-sans-fin"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user