diff --git a/templates/lib_template.go b/templates/lib_template.go index a583b02..5aa32ca 100644 --- a/templates/lib_template.go +++ b/templates/lib_template.go @@ -22,6 +22,7 @@ import ( "runtime" "runtime/pprof" "strings" + "strconv" "time" mrand "math/rand" "crypto/rand" @@ -469,7 +470,30 @@ func buildACN(globalSettings settings.GlobalSettings, torPath string, appDir str // Override Ports if on Tails... if cwtchTails := os.Getenv("CWTCH_TAILS"); strings.ToLower(cwtchTails) == "true" { log.Infof("CWTCH_TAILS environment variable set... overriding tor config...") + controlPort = 9051 + + // In tails 5.13 the control port was changed to 951 + // so read the Tails Version File and if it exists... + b, err := os.ReadFile("/etc/amnesia/version") + if err == nil { + // the file should start with the version followed + // by a space... + versionEnd := strings.Index(string(b), " ") + versionStr := string(b)[:versionEnd] + version, err := strconv.ParseFloat(versionStr, 64) + if err == nil { + log.Infof("Confirming Tails Version: %v", version) + // assert the control port if we are at the dedicated version... + // we know this change happened sometime after 5.11 + if version >= 5.13 { + controlPort = 951 + } + } else { + log.Errorf("Unable to confirm Tails version. CWTCH_TAILS options may not function correctly.") + } + } + socksPort = 9050 globalSettings.CustomControlPort = controlPort globalSettings.CustomSocksPort = socksPort