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

Support UNIX sockets based on vibe.D's IO #2101

Closed
aberba opened this issue Mar 6, 2018 · 3 comments
Closed

Support UNIX sockets based on vibe.D's IO #2101

aberba opened this issue Mar 6, 2018 · 3 comments

Comments

@aberba
Copy link

aberba commented Mar 6, 2018

UNIX sockets provide a way to securely connect in an enclosed/isolated environment without exposing connection externally. This is used in my our microservice infrastructure on: we connect to our db instance using a proxy and its the recommended approach in microservices.

Its a very common security practice. The default approach on Google Cloud. I would do the same for any db I want to prevent external access to. If vibe.d doesn't support it then its missing a big piece of a puzzle.

Database libs like mysql-native could benefit from vibe.D's implementation to support UNIX socket connection that integrates well with vibe.d

@wilzbach
Copy link
Member

wilzbach commented Mar 6, 2018

#2073

Is this what you are looking for? Your issue is pretty unspecific. Please clarify.

@aberba
Copy link
Author

aberba commented Mar 8, 2018

The thing is we use the nodejs mysql package in production as the cloud db instance uses UNIX sockets (proxy) to connect to the database in as secure way when deployed. The docs there says under Connection options :

socketPath: The path to a UNIX domain socket to connect to. When used host and port are ignored.

It works as if both server process and database are on the same host machine. Its kind of like this code found in the issue you reference though:

// examples/unix_socket_server/source/app.d 
auto settings = new HTTPServerSettings;
settings.bindAddresses = ["/tmp/vibe.sock"];
listenHTTP(settings, router);

The the "/tmp/vibe.sock" will be the path to the database socket connection. An example style of this approach is in the Google Cloud SQL Nodejs demo here where they connect to the database using a proxy (UNIX socket connection). Here is a snippet from the page:

const config = {
  user: process.env.SQL_USER,
  password: process.env.SQL_PASSWORD,
  database: process.env.SQL_DATABASE
};

if (process.env.INSTANCE_CONNECTION_NAME && process.env.NODE_ENV === 'production') {
  config.socketPath = `/cloudsql/${process.env.INSTANCE_CONNECTION_NAME}`;
}

// Connect to the database
const knex = Knex({
  client: 'mysql',
  connection: config
});

I requested UNIX socket connection support in mysql-native dub package and the dev mentioned vibe.d's IO something... needs to support such unix socket before mysql-native can support Unix socket IO compatible with vibe.d.

@Geod24
Copy link
Contributor

Geod24 commented Jul 7, 2019

This looks like a duplicate of #500 which has been fixed (but not closed yet) AFAIK.

@Geod24 Geod24 closed this as completed Jan 10, 2020
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

3 participants