openwrt/luci

luci-app-ttyd: integrate luci-ssl

Open

#5,347 opened on Sep 8, 2021

View on GitHub
 (16 comments) (5 reactions) (0 assignees)JavaScript (2,383 forks)batch import
help wanted

Repository metrics

Stars
 (5,706 stars)
PR merge metrics
 (Avg merge 6d 21h) (44 merged PRs in 30d)

Description

It would be great if the same SSL certificates could be used for both luci-ssl and luci-app-ttyd. I tried pointing luci-app-ttyd at the /etc/uhttpd.crt and /etc/uhttpd.key files, but unfortunately this does not work as it seems uhttpd.key is in some binary format that ttyd does not understand and hence ttyd does not start. Not sure what the best solution to this would be - perhaps change the format for the automatically-generated uhttpd.key to something that both uhttpd and ttyd can understand, or alternatively to patch ttyd to understand whatever format is used for uhttpd.key.

As a side-note, installing luci-app-ttyd alongside luci-ssl without enabling SSL in luci-app-ttyd is rather useless as modern browsers tend to block the non-secure iframe that luci-app-ttyd uses to connect to ttyd when the page is served over HTTPS. So having a nice way to make this work out-of-the-box would be quite convenient.

Edit: @ysc3839 has a much better idea; set up a reverse proxy for ttyd as part of luci-app-ttyd. In this way, the SSL configuration for ttyd will follow the configuration for uhttpd. No oddball open ports, no mixed SSL/non-SSL issues, no mucking around with config files and generating SSL certs.

Contributor guide