Clarified and Split Apart Environment Variables that alter port binding behaviour. #47

Merged
sarah merged 7 commits from whonix into master 2023-08-18 21:03:41 +00:00
1 changed files with 5 additions and 0 deletions
Showing only changes of commit 61ced82cb4 - Show all commits

View File

@ -274,6 +274,10 @@ func (tp *torProvider) Listen(identity connectivity.PrivateKey, port int) (conne
if _, ferr := os.Stat("/usr/share/anon-ws-base-files/workstation"); !os.IsNotExist(ferr) {
dan marked this conversation as resolved
Review

from the docs i thought i could specify the range on the cmd line. can't we just change this to an .exists() check as a flag? any value means it was set?

from the docs i thought i could specify the range on the cmd line. can't we just change this to an `.exists()` check as a flag? any value means it was set?
Review

I'd rather be explicit. Someone setting this to "false" should not be surprised.

I'd rather be explicit. Someone setting this to "false" should not be surprised.
localListener, err = net.Listen("tcp", "0.0.0.0:"+strconv.Itoa(localport))
}
// for whonix like systems we tightly restrict possible listen...
dan marked this conversation as resolved
Review

dont understand this line

dont understand this line
Review

I had to pick a subrange of ports (technically we could allow these to be configurable, but the additional complexity does not seem worth it atm), and this how I arrived at the top range.

I had to pick a subrange of ports (technically we could allow these to be configurable, but the additional complexity does not seem worth it atm), and this how I arrived at the top range.
// pick a random port between 15300 and 15378
dan marked this conversation as resolved
Review

since its not a specified range, why not call it WHONIX_PORTS since thats what it is

since its not a specified range, why not call it WHONIX_PORTS since thats what it is
Review

there are other possible usecases for this flag e.g. any containerized OS, not just whonix.

there are other possible usecases for this flag e.g. any containerized OS, not just whonix.
// cwtch = 63 *77 *74* 63* 68 = 1537844616
localport = 15300 + ((localport - 1024) % 78)
} else {
localListener, err = net.Listen("tcp", "127.0.0.1:"+strconv.Itoa(localport))
}
@ -298,6 +302,7 @@ func (tp *torProvider) Listen(identity connectivity.PrivateKey, port int) (conne
return nil, err
}
os.ID = onion
os.CloseLocalListenerOnClose = true
ols := &onionListenService{os: os, tp: tp}