-
Notifications
You must be signed in to change notification settings - Fork 786
Allow swtiching hostwatch cache file via $TMPDIR #322
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Btw, what happens if you run more than one sshuttle instance with the hosts discovery option, are they going to overwrite each other? This is not a problem you are introducing but maybe you can fix it by just generating a temporary file name as well. |
69d971f to
9165498
Compare
|
Added |
|
I am sorry I did not check earlier but I think sshuttle is correctly adding uniqueness by appending the PID to the cache file: https://github.com/sshuttle/sshuttle/pull/322/files#diff-d5c2ab2c87904bc5904c8bac0eb00b32R37 I think your first version of this PR was enough. Sorry again. Also, this PR will not work because the directory will not exist and nowhere in the code it is currently creating it. |
|
@komapa not really, it's a atomic write creating a temporary file with the pid, https://github.com/sshuttle/sshuttle/pull/322/files#diff-d5c2ab2c87904bc5904c8bac0eb00b32R44 |
9165498 to
504f5ae
Compare
504f5ae to
581c1ae
Compare
|
btw, yes, i missed the directory issue, dropping that out. |
|
Using a predictable filename under |
|
@brianmay true, having |
|
Yes, a option would probably be a good idea. |
If an exception occurs in hostwatch, sshuttle exits. Problems read/writing the ~/.sshuttle.hosts cache file on the remote machine would therefore cause sshuttle to exit. With this patch, we simply continue running without writing/reading the cache file in the remote home directory. This serves as an alternate fix for pull request sshuttle#322 which proposed storing the cache file elsewhere. A list of included changes: - If we can't read or write the host cache file on the server, continue running. Hosts can be collected through the netstat, /etc/hosts, etc and the information can be reconstructed each run if a cache file isn't available to read. We write a log() message when this occurs. - Add additional types of exceptions to handle. - Continue even if we cannot read /etc/hosts on the server. - Update man page to mention the cache file on the remote host. - Indicate that messages are related to remote host instead of local host. - Add comments and descriptions to the code.
646c6cf to
fd6b6bb
Compare
|
No updates in many years. Closing. |
This patch allows user to change the cache file location by passing
$TMPDIRvariable or one of those supported bytempfile.tempdirover SSH.This is desiged for container environment that has
$HOMEbeing read-only and the writeable location will betmpfsmounted somewhere, e.g./tmp.