Habrβ€’September 21, 2026β€’πŸ‡·πŸ‡ΊTranslated from Russian

Implementing 2FA Kubernetes Access via Gateway API, Dex and MULTIDIRECTORY

A Russian cybersecurity firm has published a detailed account of replacing static, long-lived kubeconfig certificates with corporate accounts and mandatory two-factor authentication across its Talos Linux Kubernetes clusters.

The previous approach relied on exchanging root kubeconfig files through a password vault. Each certificate was valid for a year, worked from any location, and could not be revoked without rotating the cluster CA. When an employee left or a laptop was lost, the credentials remained active.

Target requirements

The team defined four goals: login with corporate credentials, enforced second factor, cluster rights derived from directory groups, and a kubeconfig file containing no secrets.

Architecture components

  • Talos Linux 1.13 as the immutable operating system
  • Kubernetes v1.33
  • ArgoCD for GitOps management
  • NGINX Gateway Fabric 2.6 implementing Gateway API
  • Dex 0.24 as the OIDC provider
  • kube-oidc-proxy performing token validation and impersonation
  • MULTIDIRECTORY as the LDAP source of truth for users, groups and 2FA policies

MULTIDIRECTORY supplies both LDAP attributes and 2FA enforcement. Dex connects to it with a standard LDAP connector; the second factor itself is configured only inside the directory, so neither Dex nor Kubernetes is aware of its existence.

Groups returned by Dex are placed in the OIDC token claim and forwarded by kube-oidc-proxy. Standard ClusterRoleBinding objects then grant permissions to those groups, allowing access changes to be performed solely by editing directory membership.

Single-host routing with Gateway API

All traffic arrives at one FQDN. An HTTPRoute splits requests among three backends: Dex OIDC endpoints, a Python kubeconfig generator, and kube-oidc-proxy. The catch-all rule for β€œ/” does not override more specific prefixes, a behavior that differs from classic NGINX location ordering.

The generated kubeconfig uses the kubelogin exec plugin. It contains only the public cluster address, CA data and client ID; no certificates or tokens are embedded.

Gateway API migration issues

The team encountered several non-obvious problems. Routes placed in a different namespace from the Gateway were silently rejected because the listener defaulted to β€œSame” namespace. Explicitly setting allowedRoutes.namespaces.from: All resolved the issue. BackendTLSPolicy required the exact hostname present in the backend certificate rather than the internal service name, otherwise 502 errors occurred. Finally, the OIDC issuer URL had to remain identical inside and outside the cluster, solved with hostAliases on the proxy deployment.

All cluster-specific values were externalized into Kustomize patches and ArgoCD Application values, making the configuration reusable across additional clusters without code changes.

Related articles

Habrβ€’Other

AmneziaWG Container for MikroTik Routers Delivers Top Performance Six Months After Launch

A developer released an AmneziaWG container for MikroTik devices in February 2026 and has since added major improvements in speed, protocol support, and stability. The lightweight container leverages the router's native WireGuard implementation for cryptography while handling AmneziaWG obfuscation in software. Performance now reaches 250-350 Mbit/s on models such as Hap Ax3 and RB5009B after switching to C code and increasing buffer sizes with RouterOS 7.24. New features include server mode for connecting multiple MikroTik devices, random port hopping, IPv6 support, dynamic DNS, and offline configuration. The project survived an early GitHub ban caused by test scripts and has grown to over 370 stars while remaining fully offline and privacy-focused.

Habrβ€’Other

Building Resilient DoH Failover on MikroTik RouterOS to Handle Unreachable Cloudflare Responses

A network administrator encountered a persistent issue in a branch office where pages like Tailwind CSS CDN failed to load despite valid DNS responses from Cloudflare DoH. The problem stemmed from unreachable IP addresses such as 8.6.112.0 and 8.47.69.0 returned by the resolver, which RouterOS treated as healthy because it only checked for valid IP types rather than route reachability. RouterOS supports only a single active DoH upstream via the use-doh-server parameter, requiring custom scripting for failover between multiple endpoints like Cloudflare and dns.google. The solution involved static DNS entries for bootstrap addresses, certificate trust anchors including SSL.com TLS ECC Root CA 2022, and a health monitor script that probes using DNS-JSON API calls instead of switching the resolver directly. Multiple iterations addressed issues like cache-based false positives, plain DNS fallback risks from provider spoofing, and clock validation to prevent certificate failures. The final implementation uses thresholds for failure and recovery to avoid flapping and ensures post-switch verification before committing to a backup endpoint.

Habrβ€’Other

NetRuleRouter Alpha Released to Route Traffic Across Multiple Connections Without Disabling VPN

Developer krox1 has released the first public alpha of NetRuleRouter v0.1.0-alpha.1 for Windows and Linux, a local network policy manager that distributes traffic between primary and secondary connections based on domains, IP ranges, applications, and subnets. The tool emerged from practical issues that intensified after Russian authorities discussed VPN restrictions in March 2026, with operators and platforms later prompting users to disable VPN for domestic services. NetRuleRouter sits on top of existing connections rather than acting as a VPN client or proxy, allowing users to keep corporate VPNs, personal VPNs, and direct internet active simultaneously. It supports seven matching methods including exact domains, wildcard subdomains, CIDR ranges, and application paths, with priority rules to resolve overlaps and built-in leak protection that prevents protected destinations from falling back when the secondary connection drops. The alpha includes diagnostic tracing, preset rule sets for Russia and other regions, import/export capabilities, and a first-run wizard that configures the background service and initial bindings. Limitations around DNS, shared IPs, and brief startup windows are documented, and the project explicitly does not protect against account-level blocks by services such as Anthropic.

Habrβ€’Other

Setting Up Nextcloud Talk on TrueNAS with Custom Domain for Private Family Calls

A detailed guide explains how to deploy Nextcloud Talk on a TrueNAS server behind a custom domain to create a self-hosted messaging and calling platform for family use. The author addresses problems with commercial messengers such as VK notifications failing on iOS and Telegram requiring VPN connections. The solution uses HestiaCP on a VPS for reverse proxying, Let's Encrypt SSL certificates, and port forwarding on a home router to reach the TrueNAS instance at 192.168.0.17:30027. Additional steps cover configuring coturn for TURN relay to enable reliable voice and video calls, updating trusted domains in Nextcloud, and disabling router DoS protection. The setup also enables Screen Sharing, reactions, and push notifications while keeping all data under user control.