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

Add support for transparent TCP egress #69

Open
russellhaering opened this issue Oct 20, 2022 · 1 comment
Open

Add support for transparent TCP egress #69

russellhaering opened this issue Oct 20, 2022 · 1 comment

Comments

@russellhaering
Copy link
Contributor

russellhaering commented Oct 20, 2022

Enable processes in enclaves to transparently resolve and connect to any hostname or IP address permitted by the egress policy, without explicit use of any proxy.

We can likely accomplish this through some combination of providing a custom DNS resolver, to track the processes mapping of host names to IP addresses, and transparent TCP redirection to our proxy via nftables or iptables.

We should support UDP while we’re at it, if it is easy.

@eyakubovich
Copy link
Contributor

As a workaround, one can run a proxy that listens on a TCP port and then issues an HTTP CONNECT to a predefined host/port. One such tool is the socat utility (available on most distros). Create an entrypoint script that looks like this:

# The Enclaver sets `http_proxy` env variable that looks like "http://127.0.0.1:9000"
# but it's a bit tricky to parse it in the shell script. The port 9000 is the default used by Enclaver
# unless overridden in the enclaver.yaml
proxy_host=127.0.0.1
proxy_port=9000

# The host and port that you want to egress to. Be sure to add the host or IP to the
# egress.allow list in enclaver.yaml
remote_host="mysql-database.local"
remote_port=3306

# Start the TCP tunnel
socat TCP4-LISTEN:${remote_port},reuseaddr,fork PROXY:${proxy_host}:${remote_host}:${remote_port},proxyport=$proxy_port &

# Run your regular entrypoint
mysql --host="$remote_host" mydatabase

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

No branches or pull requests

2 participants