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

[SSL/TLS] Support for pass the stream context #63

Closed
michalbundyra opened this issue Jan 15, 2020 · 4 comments
Closed

[SSL/TLS] Support for pass the stream context #63

michalbundyra opened this issue Jan 15, 2020 · 4 comments

Comments

@michalbundyra
Copy link
Member

From PHP 5.6, SSL/TLS client streams now enable peer verification by default.
So, error occurs when communicate with the server that is using a self-signed certificate.

See: http://php.net/manual/migration56.openssl.php

In order to avoid the above problem:

$options = [
    'ssl' => [
        'verify_peer_name' => false,
        'verify_peer'      => false,
    ]
];

$context = stream_context_create($options);

// ex. https://github.com/zendframework/zend-mail/blob/release-2.7.0/src/Protocol/Pop3.php#L95

// $this->socketfsockopen($host, $port, $errno, $errstr, self::TIMEOUT_CONNECTION);
$this->socketfsockopen($host, $port, $errno, $errstr, self::TIMEOUT_CONNECTION, $context);

In this way, there is a need to pass a stream context to the stream function.

However, the current Zend\Mail\Protocol\Pop3 and Zend\Mail\Protocol\Smtp look like does not provide an interface to pass stream context.
Is there support for the above interface in future?


A similar way: zend-http/zend.http.client.adapters.md at release-2.5.4 · zendframework/zend-http


Originally posted by @gongo at zendframework/zend-mail#84

@michalbundyra
Copy link
Member Author

I created a fork which solves this issue hard-coded here: https://github.com/Cruiser13/zend-mail
I don't think they'll add a config solution inside the core since ZF1 reached end of lifetime.


Originally posted by @Cruiser13 at zendframework/zend-mail#84 (comment)

@michalbundyra
Copy link
Member Author

Um... This component is v2, and still maintained...

On Aug 26, 2016 11:54 AM, "Lennart Sauter" notifications@github.com wrote:

I created a fork which solves this issue hard-coded here:
https://github.com/Cruiser13/zend-mail
I don't think they'll add a config solution inside the core since ZF1
reached end of lifetime.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
zendframework/zend-mail#84 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AABlV-Sz3eJCN8XTp2BB0UPt4DBVKD-3ks5qjwzZgaJpZM4IOoHi
.


Originally posted by @weierophinney at zendframework/zend-mail#84 (comment)

@michalbundyra
Copy link
Member Author

Sorry, I meant to post it here, got the versions mixed up: zendframework/zf1#709
So there's hope for ZF2 and this issue :)


Originally posted by @Cruiser13 at zendframework/zend-mail#84 (comment)

@michalbundyra
Copy link
Member Author

Same here. Would be great if we could disable verify_peer for Zend\Mail\Protocol\Pop3 Zend\Mail\Protocol\Smtp Zend\Mail\Protocol\Imap. This issue appears to be open for 2 years?


Originally posted by @jensstalder at zendframework/zend-mail#84 (comment)

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 a pull request may close this issue.

1 participant