Fix Cwtch on Tails > 5.13
This commit is contained in:
parent
dd0f1cd868
commit
243727a131
|
@ -22,6 +22,7 @@ import (
|
||||||
"runtime"
|
"runtime"
|
||||||
"runtime/pprof"
|
"runtime/pprof"
|
||||||
"strings"
|
"strings"
|
||||||
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
mrand "math/rand"
|
mrand "math/rand"
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
|
@ -469,7 +470,30 @@ func buildACN(globalSettings settings.GlobalSettings, torPath string, appDir str
|
||||||
// Override Ports if on Tails...
|
// Override Ports if on Tails...
|
||||||
if cwtchTails := os.Getenv("CWTCH_TAILS"); strings.ToLower(cwtchTails) == "true" {
|
if cwtchTails := os.Getenv("CWTCH_TAILS"); strings.ToLower(cwtchTails) == "true" {
|
||||||
log.Infof("CWTCH_TAILS environment variable set... overriding tor config...")
|
log.Infof("CWTCH_TAILS environment variable set... overriding tor config...")
|
||||||
|
|
||||||
controlPort = 9051
|
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
|
socksPort = 9050
|
||||||
globalSettings.CustomControlPort = controlPort
|
globalSettings.CustomControlPort = controlPort
|
||||||
globalSettings.CustomSocksPort = socksPort
|
globalSettings.CustomSocksPort = socksPort
|
||||||
|
|
Loading…
Reference in New Issue