Skip to content
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

Harden stunredis.sh by not using a local TCP port #2

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

tw-bert
Copy link

@tw-bert tw-bert commented Feb 27, 2019

Your script is very helpful. However, it is not secure in a multiuser host. The script opens up a TCP port bound to the loopback device, which IMHO means that (at least without some ip[6]tables hardening) anyone on localhost can use the TCP port without having the cert and/or private key (in case of two-way trust TLS, which we use. cert and key in stunnel.). This might not seem relevant to (for example) a vagrant dev VM, but it's easy to avoid: just use a unix domain socket. stunnel as well as redis-cli supports it. As a bonus: the unix domain socket performs better as well.
Sidenote: stunnel removes the socket file automatically, with a clean exit. Please judge yourself if a more resilient cleanup is needed (I don't think so, but could be wrong).

Your script is very helpful. However, it is not secure in a multiuser host. The script opens up a TCP port bound to the loopback device, which IMHO means that (at least without some ip[6]tables hardening) anyone on localhost can use the TCP port without having the cert and/or private key (in case of two-way trust TLS, which we use. `cert` and `key` in `stunnel`.). This might not seem relevant to (for example) a vagrant dev VM, but it's easy to avoid: just use a unix domain socket. `stunnel` as well as `redis-cli` supports it. **As a bonus:** the unix domain socket performs better as well.
Sidenote: `stunnel` removes the socket file automatically, with a clean exit. Please judge yourself if a more resilient cleanup is needed (I don't think so, but could be wrong).
@tw-bert tw-bert changed the title Harden strunredis.sh by not using a local TCP port Harden stunredis.sh by not using a local TCP port Mar 2, 2019
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.

1 participant