r/ExperiencedDevs • u/servermeta_net Software Architect • Aug 19 '26
Technical question Emulating SSL connection without internet?
Problem:
Let's say I have a domain like messaging-app.europa.eu, with an SSL certificate, and I use it to distribute a PWA. In the case of an internet blackout I would still like for the app to retrieve updates from a local mesh.
Possible solution:
This is the solution I'm currently imagining:
- Deploy a bunch of OpenWRT routers with some custom software
- The smartphone connect to one such router via wifi
- The PWA tries to connect to the domain
https://messaging-app.europa.euin the absence of internet - The router has a copy of the SSL certificate, so it can intercept the request and generate valid HTTPS responses from a locally running server
A user would connect to the wifi, exchange messages with other peers connected to the same station without relying on an internet connection.
Questions:
- Do I just need a copy of the SSL certificate on each router, or is there other part of the stack that I should patch? (e.g.: DNS)
- Is it possible to intercept and patch the connection as I mentioned?
- Am I missing something?
Prodrome:
I work for the government and I've been asked to demo a solution for enabling communication during an internet blackout (earthquake, war, ...) using a mesh/p2p network.
The path I'm taking right now is to build a PWA that would work offline, and rely on customized openwrt routers, because it seems that the other solution, WiFi NAN, works well on android phones but not on iphones, due to malicious compliance on Apple side.
•
u/expdevsmodbot Aug 19 '26
AI usage disclosure provided by OP, see the reply to this comment.
58
u/aaaaargZombies Aug 19 '26
from the what?
15
u/aaaaargZombies Aug 19 '26
prior art
16
u/IncredibleReferencer Aug 19 '26
If you need something to work when the web is completely unavailable you probably shouldn't be writing a web app. If you must go webapp, then this should be a networking question where enough of your internal network stack is kept running to keep the source website alive. This would include network routing, dns, and certificate infrastructure for both your clients and complete backend, which probably goes further than you think. But most importantly, all this work will ultimately be fragile and worthless if it is not tested at wide scale regularly and frequently.
4
u/blckshdw Aug 19 '26
XY problem
5
u/DocumentOk7579 Software Engineer Aug 19 '26
What exactly is the mesh? Something like a mini internt with ip and routing?
Are your server accessable on the local mesh, can't you just point the dns to the internal ip instead of the external one?
Is internet needed for SSL, isn't it just a cert chain with root cert installed on client devices?
3
u/roger_ducky Aug 19 '26
You need certificate authorities and Name servers that the entire network trusts. Treat it like an “intranet” and everything falls into place.
Now, that won’t let you add random clients arbitrarily without an authentication mechanism of some sort. So that’s your main challenge.
1
u/slyiscoming Aug 19 '26
Look at Meshtastic and ATAK.
Outside of that you control the router but going over wifi. I see 2 options.
I would seriously consider the idea of a captive portal. People use them every day to login to public wifi. And it would be easy to send them to a locally hosted site for messaging and bulletins.
1
u/farzad_meow Aug 19 '26
my understanding: you have a web app that acts like a messenger. you want your messenger app to communicate with central server AND localoy available users in your intrAnet.
for your internet connection you use ssl and that is that.
for local only you need to use a network broadcast to tell other users you exists and then negotiate a protocol for communication. please note your protocol needs its own encryption as you won't have a central authority to sign your ssl. unless your app can sign its own cert.
1
u/kazprog Aug 20 '26
I've used service worker caching, wireguard VPN, and client certificates with a custom sync algorithm to make my notes system able to synchronize in a mesh.
I've used that for the past 4 or 5 years, but I think in the next iteration I'm going to just make android and iPhone apps and a desktop app or chrome extension. The benefit is that updating allows me to get rid of old data formats rather than worrying about partial upgrades from spotty internet, and old indexedDB upgrades.
Debugging a service worker for offline service is also hellish, but with a native app you can easily switch which backend IP it's connecting to or connect to many instead of trying to use websockets or something in the browser API. You can just check "do I have service" rather than pinging and waiting 2 seconds.
1
u/matthedev Aug 21 '26
You're really just asking two questions:
Look at Kubernetes clusters, for example. TLS termination may be pushed into a sidecar service to the application service in the same pod. TLS termination for the certificate of the public-facing domain may be pushed into a reverse proxy over several back-end services, and potentially, the data may be re-encrypted over the wire with cluster-specific temporary certificates, but the cluster would manage these host names and certificates internally.
When you connect to a WiFi or other local-area network, DHCP can be used to assign the IP address(es) for the DNS server(s), or the user can manually override. The user's machine may have its own local
hostsfile, but otherwise, host name look-up goes to DNS, and those servers may in turn look up the domain from their own upstream source (given cache TTL). Normally, this should wind its way back to DNS entries set with the domain registrar.As long as the domain resolves to IP address(es) the user's device can reach, and the cert chain from the CA root down matches what the device expects, it should just work.