Skip to content

Commit 977f185

Browse files
some notes on https support
1 parent 0dc6303 commit 977f185

4 files changed

Lines changed: 28 additions & 0 deletions

File tree

packaging/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,9 @@ This directory contains files used to build or install Pioreactor outside the no
1515
## Ownership Boundary
1616

1717
The Pioreactor repo owns these files because they describe the Pioreactor application runtime contract. CustoPiZer consumes selected files from here when building Raspberry Pi images, but CustoPiZer still owns Raspberry Pi image-specific boot, hardware, networking, service ordering, and firstboot behavior.
18+
19+
## WIP Local HTTPS Support
20+
21+
The runtime lighttpd assets include early, disabled support for serving the browser UI over local HTTPS. `runtime-files/lighttpd/10-pioreactor-https.conf` is copied into image and installer inputs, but it is not enabled by default. It expects a generated local certificate bundle at `/etc/pioreactor/tls/local-ui.lighttpd.pem` and proxies `/mqtt` to the existing Mosquitto websocket listener on `127.0.0.1:9001` so an HTTPS-loaded browser can use same-origin WSS.
22+
23+
This is infrastructure for a future opt-in setup flow, not production HTTPS-by-default. Do not change `config.example.ini` to `wss` / `443`, enable the lighttpd HTTPS config, add HTTP-to-HTTPS redirects, or add HSTS until the local CA generation, browser trust onboarding, certificate regeneration, and rollback behavior are productized.

packaging/linux-leader/install.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,11 @@ install_apt_dependencies() {
122122
git \
123123
jq \
124124
lighttpd \
125+
lighttpd-mod-openssl \
125126
logrotate \
126127
mosquitto \
127128
mosquitto-clients \
129+
openssl \
128130
openssh-client \
129131
python3 \
130132
python3-dev \
@@ -265,6 +267,7 @@ install_system_files() {
265267
install -d -o root -g root -m 0755 /etc/lighttpd/conf-available
266268
install -m 0644 "$RUNTIME_FILES_DIR/lighttpd/lighttpd.conf" /etc/lighttpd/lighttpd.conf
267269
sed -i "s/server.port = 80/server.port = $UI_PORT/" /etc/lighttpd/lighttpd.conf
270+
install -m 0644 "$RUNTIME_FILES_DIR/lighttpd"/10-pioreactor-https.conf /etc/lighttpd/conf-available/
268271
install -m 0644 "$RUNTIME_FILES_DIR/lighttpd"/10-expire.conf /etc/lighttpd/conf-available/
269272
install -m 0644 "$RUNTIME_FILES_DIR/lighttpd"/50-pioreactorui.conf /etc/lighttpd/conf-available/
270273
install -m 0644 "$RUNTIME_FILES_DIR/lighttpd"/51-cors.conf /etc/lighttpd/conf-available/
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Optional local HTTPS listener for Pioreactor UI.
2+
#
3+
# This file is intentionally not enabled by default. Generate
4+
# /etc/pioreactor/tls/local-ui.lighttpd.pem before enabling this config.
5+
6+
server.modules += ( "mod_openssl" )
7+
ssl.pemfile = "/etc/pioreactor/tls/local-ui.lighttpd.pem"
8+
9+
$SERVER["socket"] == "0.0.0.0:443" {
10+
ssl.engine = "enable"
11+
}
12+
include_shell "/usr/share/lighttpd/use-ipv6.pl 443"
13+
14+
# Keep browser MQTT same-origin when the UI is loaded over HTTPS.
15+
$HTTP["url"] =~ "^/mqtt" {
16+
proxy.header = ( "upgrade" => "enable" )
17+
proxy.server = ( "" => ( ( "host" => "127.0.0.1", "port" => 9001 ) ) )
18+
}

packaging/runtime-files/lighttpd/lighttpd.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ server.modules = (
55
"mod_alias",
66
"mod_redirect",
77
"mod_fastcgi",
8+
"mod_proxy",
89
"mod_staticfile",
910
)
1011

0 commit comments

Comments
 (0)