Review lists the ports a firewall must let in for the enabled components
Docker opens them on the server, but a provider's firewall or a router in front of it doesn't, and the playbook's docs spread them over each component's page. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c6930b12df
commit
87d8f39301
7 files changed
+119
-21
No files matched your search
@@ -176,7 +176,11 @@ or the [Telegram group](https://t.me/+6UwIu9F4gZQxNjM0).
|
||||
- **Checks before it touches anything.** The Review screen logs into the
|
||||
server and checks root access, OS, CPU, Python, memory, disk and ports
|
||||
80/443 (and 8448 for Synapse and Dendrite), then resolves every DNS record the setup needs and compares
|
||||
it with the server's addresses. Once you've deployed, it shows what
|
||||
it with the server's addresses. It also lists the ports a firewall in
|
||||
front of the server (your provider's, or a router) has to let in for the
|
||||
components you've turned on: web and federation, Coturn, LiveKit for
|
||||
Element Call and Matrix RTC, Jitsi and Postmoogle (`interzone check`
|
||||
prints them too). Once you've deployed, it shows what
|
||||
changes in `vars.yml` since the last successful deploy (`x` switches to
|
||||
the whole file).
|
||||
- **Checks after deploying.** The playbook's self-check runs at the end and
|
||||
|
||||
@@ -182,6 +182,11 @@ func Check(args []string) error {
|
||||
fmt.Println(head.Render("==> Server and DNS"))
|
||||
fs2 := deploy.ServerChecks(c)
|
||||
printFindings(fs2)
|
||||
fmt.Println()
|
||||
fmt.Println(head.Render("==> Ports to open in a firewall in front of the server"))
|
||||
for _, p := range c.Ports() {
|
||||
fmt.Printf(" %-40s %s\n", p.Port, muted.Render(p.For))
|
||||
}
|
||||
if max(worst, deploy.Worst(fs2)) == deploy.Fail {
|
||||
return ErrFailed
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package config
|
||||
|
||||
import "interzone/internal/catalog"
|
||||
|
||||
// Port is a port (or range) the server must accept from the internet, and
|
||||
// what for.
|
||||
type Port struct{ Port, For string }
|
||||
|
||||
// Ports lists what a firewall in front of the server must let in, from the
|
||||
// playbook's docs (prerequisites.md and the pages of the components that
|
||||
// need more). Docker opens them on the server itself.
|
||||
// shortcut: the playbook's default port numbers; a port moved in extra vars isn't followed.
|
||||
func (c *Config) Ports() []Port {
|
||||
on := func(id string) bool {
|
||||
comp, ok := catalog.ByID(id)
|
||||
return ok && c.Enabled(comp)
|
||||
}
|
||||
out := []Port{{"80/tcp, 443/tcp+udp", "Web (HTTPS, certificates)"}}
|
||||
// UVS and Matrix RTC need the federation port even with federation off.
|
||||
if fp := c.FederationPort(); fp != "443" && (c.Federation || on("uvs") || on("matrix-rtc") || on("element-call")) {
|
||||
out = append(out, Port{fp + "/tcp+udp", "Federation"})
|
||||
}
|
||||
if on("coturn") {
|
||||
out = append(out, Port{"3478, 5349/tcp+udp; 49152-49172/udp", "Coturn (TURN for calls)"})
|
||||
}
|
||||
if on("matrix-rtc") || on("element-call") {
|
||||
out = append(out, Port{"7881/tcp, 5350/tcp; 7882, 3479, 30000-30020/udp", "LiveKit (Element Call, Element X calls)"})
|
||||
}
|
||||
if on("jitsi") {
|
||||
out = append(out, Port{"4443/tcp, 10000/udp", "Jitsi media"})
|
||||
}
|
||||
if on("postmoogle") {
|
||||
out = append(out, Port{"25/tcp, 587/tcp", "Postmoogle (receiving email)"})
|
||||
}
|
||||
return out
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestPorts(t *testing.T) {
|
||||
list := func(c *Config) string {
|
||||
var s []string
|
||||
for _, p := range c.Ports() {
|
||||
s = append(s, p.Port)
|
||||
}
|
||||
return strings.Join(s, " | ")
|
||||
}
|
||||
c := Default()
|
||||
c.Homeserver, c.Federation = "synapse", false
|
||||
c.Components = map[string]bool{}
|
||||
if got := list(c); got != "80/tcp, 443/tcp+udp" {
|
||||
t.Errorf("bare server: %s", got)
|
||||
}
|
||||
c.Components = map[string]bool{"uvs": true, "coturn": true, "postmoogle": true}
|
||||
got := list(c)
|
||||
for _, want := range []string{"8448/tcp+udp", "3478, 5349/tcp+udp", "49152-49172/udp", "25/tcp, 587/tcp"} {
|
||||
if !strings.Contains(got, want) {
|
||||
t.Errorf("missing %s in %s", want, got)
|
||||
}
|
||||
}
|
||||
c.Homeserver, c.Federation = "conduit", true // federation on 443
|
||||
if strings.Contains(list(c), "8448") {
|
||||
t.Errorf("conduit opens 8448: %s", list(c))
|
||||
}
|
||||
}
|
||||
@@ -266,6 +266,7 @@ func (s *reviewScreen) view(w, h int) string {
|
||||
status = []string{card("", strings.Split(strings.Join(status, "\n"), "\n"), cw, 0, tone)}
|
||||
status = append(status, gap...)
|
||||
status = append(status, s.checksView(lw-2)...)
|
||||
status = append(append(status, gap...), portsView(s.cfg, lw-2)...)
|
||||
summary = []string{card("", summary, cw, 0, cFaint)}
|
||||
|
||||
left := lipgloss.JoinVertical(lipgloss.Left, append(summary, append(gap, status...)...)...)
|
||||
@@ -370,6 +371,25 @@ func (s *reviewScreen) checksView(w int) []string {
|
||||
return lines
|
||||
}
|
||||
|
||||
// portsView lists the ports a firewall in front of the server must let in
|
||||
// for the components turned on.
|
||||
func portsView(c *config.Config, w int) []string {
|
||||
lines := []string{rule("Ports a firewall in front must let in", min(w, 72))}
|
||||
ports := c.Ports()
|
||||
pw := 0
|
||||
for _, p := range ports {
|
||||
pw = max(pw, len(p.Port)+2)
|
||||
}
|
||||
for _, p := range ports {
|
||||
if w < 60 || pw > w/2 { // the ports go under the name
|
||||
lines = append(lines, " "+sTitle.Render(p.For), " "+sMuted.Render(p.Port))
|
||||
continue
|
||||
}
|
||||
lines = append(lines, " "+lipgloss.NewStyle().Width(pw).Render(sMuted.Render(p.Port))+sTitle.Render(truncate(p.For, max(8, w-pw-2))))
|
||||
}
|
||||
return lines
|
||||
}
|
||||
|
||||
func indexOf(xs []string, v string) int {
|
||||
for i, x := range xs {
|
||||
if x == v {
|
||||
|
||||
+8
-8
@@ -22,14 +22,14 @@
|
||||
│ ││ ○ Element Web element.example.org │
|
||||
│ ││ ○ Cinny cinny.example.org │
|
||||
│ ││ │
|
||||
│ ││ ╭────────────────────────────────────────────────────────────────────────────────────╮ │
|
||||
│ ││ │ vars.yml preview │ │
|
||||
│ ││ │ # Generated by interzone on 0000-00-00 00:00. │ │
|
||||
│ ││ │ # Re-running interzone rewrites this file. Put hand-written settings in the │ │
|
||||
│ ││ │ # "Extra vars" box inside interzone so they survive. │ │
|
||||
│ ││ │ --- │ │
|
||||
│ ││ │ │ │
|
||||
│ ◫ auto (wide) ctrl+l ││ ╰────────────────────────────────────────────────────────────────────────────────────╯ │
|
||||
│ ││ Ports a firewall in front must let in ────────────────────────────────── │
|
||||
│ ││ 80/tcp, 443/tcp+udp Web (HTTPS, certificates) │
|
||||
│ ││ 8448/tcp+udp Federation │
|
||||
│ ││ 3478, 5349/tcp+udp; 49152-49172/udp Coturn (TURN for calls) │
|
||||
│ ││ │
|
||||
│ ││ │
|
||||
│ ││ │
|
||||
│ ◫ auto (wide) ctrl+l ││ │
|
||||
│ ◐ interzone ctrl+y ││ │
|
||||
│ ◂ fold ctrl+b menu ││ │
|
||||
╰────────────────────────╯╰────────────────────────────────────────────────────────────────────────────────────────────╯
|
||||
|
||||
+12
-12
@@ -24,17 +24,17 @@
|
||||
○ Cinny
|
||||
cinny.example.org
|
||||
|
||||
╭──────────────────────────────────────────╮
|
||||
│ vars.yml preview │
|
||||
│ # Generated by interzone on 0000-00-00 0 │
|
||||
│ # Re-running interzone rewrites this fil │
|
||||
│ # "Extra vars" box inside interzone so t │
|
||||
│ --- │
|
||||
│ │
|
||||
│ # ── Basics ──────────────────────────── │
|
||||
│ matrix_playbook_migration_validated_vers │
|
||||
│ matrix_domain: 'example.org' │
|
||||
│ matrix_homeserver_implementation: synaps │
|
||||
╰──────────────────────────────────────────╯
|
||||
Ports a firewall in front must let in ────
|
||||
Web (HTTPS, certificates)
|
||||
80/tcp, 443/tcp+udp
|
||||
Federation
|
||||
8448/tcp+udp
|
||||
Coturn (TURN for calls)
|
||||
3478, 5349/tcp+udp; 49152-49172/udp
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
‹ back ≡ menu deploy › ⋯
|
||||
Reference in new issue
Block a user