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

Secure Socket Server #462

Open
kdubuc opened this issue Aug 8, 2019 · 3 comments
Open

Secure Socket Server #462

kdubuc opened this issue Aug 8, 2019 · 3 comments

Comments

@kdubuc
Copy link

kdubuc commented Aug 8, 2019

It would be great to setup a secure socket server (https://github.com/reactphp/socket/blob/master/src/SecureServer.php). It could be easily implemented :

After initialization of web server :

$this->web = new Server(sprintf('%s:%d', $this->host, $this->port), $this->loop);

We could adding :

$socket = new \React\Socket\SecureServer($socket, $loop, array(
    'local_cert' => $this->cert
));

ProcessManager constructor will gain one tls_options array parameter to provide TLS context (cert, etc ..).

What do you think ?

@jkrzefski
Copy link
Contributor

jkrzefski commented Sep 20, 2019

I would prefer a more versatile approach to this. Something like this would be better:

$this->web = new Server(sprintf('%s:%d', $this->host, $this->port), $this->loop, ['tls' => [
    'local_cert' => '/etc/letsencrypt/live/<hostname>/fullchain.pem',
    'local_pk' => '/etc/letsencrypt/live/<hostname>/privkey.pem',
    'cafile' => '/etc/letsencrypt/live/<hostname>/cert.pem',
    'CN_match' => '<hostname>',
    'crypto_method' => STREAM_CRYPTO_METHOD_TLSv1_2_SERVER,
]]);

If possible, this should be configurable through the config-command. Of course these hardcoded values should be variables.

@kdubuc
Copy link
Author

kdubuc commented Sep 20, 2019

Exactly, good point.

So, ProcessManager constructor will have one (array) context option (CLI too with a --context arg), which will be used by Server bootstraping.

If maintainers are okay, I can work on a PR.

@jkrzefski
Copy link
Contributor

Please include in your PR a way to dump this context into the configuration json file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants