Skip to content

Only write /etc/hosts when necessary.#545

Merged
brianmay merged 1 commit intosshuttle:masterfrom
skuhl:avoid-touching-etc-hosts
Oct 19, 2020
Merged

Only write /etc/hosts when necessary.#545
brianmay merged 1 commit intosshuttle:masterfrom
skuhl:avoid-touching-etc-hosts

Conversation

@skuhl
Copy link
Contributor

@skuhl skuhl commented Oct 19, 2020

Without this patch, sshuttle 'restores' /etc/hosts even if it didn't
make any modifications to it. This can be confirmed by running without
--auto-hosts and confirming that the modification time of /etc/hosts
is unchanged while sshuttle is running, but is updated when sshuttle
exits (and a debug2() message is printed indicating the file is
written).

I'm not aware of the previous behavior causing problems. However,
writing an important file unnecessarily as root should be avoided.

Without this patch, sshuttle 'restores' /etc/hosts even if it didn't
make any modifications to it. This can be confirmed by running without
--auto-hosts and confirming that the modification time of /etc/hosts
is unchanged while sshuttle is running, but is updated when sshuttle
exits (and a debug2() message is printed indicating the file is
written).

I'm not aware of the previous behavior causing problems. However,
writing an important file unnecessarily as root should be avoided.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants