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

stream_socket_enable_crypto() not implemented for client sockets #1647

Closed
mingtse opened this issue Jan 27, 2014 · 176 comments
Closed

stream_socket_enable_crypto() not implemented for client sockets #1647

mingtse opened this issue Jan 27, 2014 · 176 comments

Comments

@mingtse
Copy link

mingtse commented Jan 27, 2014

stream's ssl and tls are not working in hhvm.

Running the openssl tests

http://gcov.php.net/viewer.php?version=PHP_5_3&func=tests&file=ext%2Fopenssl%2Ftests%2Fsni_001.phpt

None of them pass. HHVM exits with message:

HipHop Fatal error: Undefined function: stream_socket_enable_crypto

@scannell
Copy link
Contributor

It looks stream_socket_enable_crypto has not been implemented yet. Feel free to submit a PR if you (or someone else reading this) gets to this before we do.

@machris
Copy link

machris commented Mar 27, 2014

im on hhvm-fastcgi + Laravel
Im having same issue when trying to send mail SMTP via Mandrill
gives stream_socket_enable_crypto error

@mandersondesign
Copy link

I would love to hear if any progress on this has been made. Unable to send email via Swiftmailer on our server using HHVM.

Thanks!

@benfinn
Copy link

benfinn commented May 12, 2014

Ditto. It makes a number of interest libraries fail, like PHPMailer, for example.

@c0h1b4
Copy link

c0h1b4 commented Jun 24, 2014

Any progress on stream_socket_enable_crypto function to be available? If not is there any workarounds? I really need to use swiftmailer, but without TLS encryption, it is a no go for HHVM. Still using old, slow & reliable PHPFPM.

@aosaginohi
Copy link

Having the same problem with Xenforo it just gives a blank page whenever you try to signup at the point it does try to sent the registration email.

Seems everything else works so this is the only thing stopping me from fully being able to use Xenforo on hhvm.

Error:
\nFatal error: Call to undefined function stream_socket_enable_crypto() in /public/library/Zend/Mail/Protocol/Smtp.php on line 206

@GabrielGil
Copy link

+1 from here!

@ccalleu
Copy link

ccalleu commented Jul 22, 2014

same story, laravel on hhvm using swiftmailer library fails, +1

@aranere
Copy link

aranere commented Jul 23, 2014

Same here.. Using Laravel with Swiftmailer.

@erikcvisser
Copy link

+1! Any way we can contribute?

@SiebelsTim
Copy link
Contributor

@erikcvisser Sure.
stream_socket_enable_crypto needs to be implemented.

Look into hphp/runtime/ext/stream/ext_stream.cpp for other stream functions.

PHP's implementation is at https://github.com/php/php-src/blob/088eedfaa186e79f6f86b814f50efc947350bf88/ext/standard/streamsfuncs.c#L1493

@valentinhocher
Copy link

+1 needed for apple apn push

@asowers1
Copy link

+1 Is there an official work around for this?

zerilliworks added a commit to zerilliworks/CookieSync that referenced this issue Aug 20, 2014
@c0h1b4
Copy link

c0h1b4 commented Aug 26, 2014

Is this issue ever going to be addressed? If HHVM developers are not interested or think this is superfluous, please close this thread.

@r3wt
Copy link

r3wt commented Aug 26, 2014

of course they are not going to fix it. they only fix shit that benefits them. anything else they say "feel free to submit a pull request"

@r3wt
Copy link

r3wt commented Aug 26, 2014

\nFatal error: Uncaught exception 'Swift_TransportException' with message 'Connection could not be established with host smtp.mandrillapp.com [Connection timed out #110]' in /usr/share/nginx/html/giannis/api/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php:274\nStack trace:\n#0 /usr/share/nginx/html/giannis/api/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php(64): Swift_Transport_StreamBuffer->_establishSocketConnection()\n#1 /usr/share/nginx/html/giannis/api/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(115): Swift_Transport_StreamBuffer->initialize()\n#2 /usr/share/nginx/html/giannis/api/swiftmailer/lib/classes/Swift/Mailer.php(80): Swift_Transport_AbstractSmtpTransport->start()\n#3 /usr/share/nginx/html/test.php(14): Swift_Mailer->send()\n#4 {main}
\nFatal error: Uncaught exception 'Swift_TransportException' with message 'Connection could not be established with host smtp.mandrillapp.com [Connection timed out #110]' in /usr/share/nginx/html/giannis/api/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php:274\nStack trace:\n#0 /usr/share/nginx/html/giannis/api/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php(64): Swift_Transport_StreamBuffer->_establishSocketConnection()\n#1 /usr/share/nginx/html/giannis/api/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(115): Swift_Transport_StreamBuffer->initialize()\n#2 /usr/share/nginx/html/giannis/api/swiftmailer/lib/classes/Swift/Mailer.php(80): Swift_Transport_AbstractSmtpTransport->start()\n#3 /usr/share/nginx/html/test.php(14): Swift_Mailer->send()\n#4 {main}

I can successfully reproduce the problem

`

@fredemmott
Copy link
Contributor

Sorry; while we currently have 7 people working full-time on improving HHVM for non-Facebook users, this currently isn't at the top of the pile - we try to prioritize based on balancing how popular a request is vs how long it's likely to take to implement/test. This is becoming a popular issue, so it's fairly likely to be re-prioritized once some of our current projects finish.

@fredemmott fredemmott changed the title stream ssl and tls are not working stream ssl and tls are not implemented Sep 5, 2014
@JoelMarcey
Copy link
Contributor

This functionality is something that takes longer than it might appear on the surface, given the sensitivity of the security implications around SSL and TLS. We just don't what to throw a half-baked implementation out to the world for something of this nature.

@emlynwest
Copy link

This would be a useful feature for fuelphp/email so 👍 from fuelphp

@jg-development
Copy link

Hi @antonbe
you can use smtp in magento and it works fine with hhvm. Install an extension like smtppro.
Greetings Jan

fredemmott added a commit that referenced this issue Jun 29, 2015
Summary: - session_stream is not supported (putting this up as it's a reviewable
   unit)
 - creating SSL or TLS servers is not supported
 - incompatible: raise a warning if SSL is specified because it is
   insecure.
 - hopefully enough for SMTP + STARTTLS

refs #1647

Reviewed By: @siyengar

Differential Revision: D2169850
@fredemmott
Copy link
Contributor

Closing as implementation is in master (hopefully in tomorrow's nightlies); we are currently expecting this in 3.8 too (it's in the branch), though that's not guaranteed - depends on further testing. We'll revert the cherry-pick and delay it to 3.9 if it leads to unrelated problems.

@giano
Copy link

giano commented Jun 30, 2015

Great! Actually we "glided" on this using smtppro + mandrill. Can't wait to
test on dev site.

On Mon, Jun 29, 2015 at 7:46 PM Fred Emmott notifications@github.com
wrote:

Closed #1647 #1647.


Reply to this email directly or view it on GitHub
#1647 (comment).

@corientdev
Copy link
Contributor

Anybody please confirm if this implementation is included in latest nighty released??

@fredemmott
Copy link
Contributor

It's in 2015.07.01 - tested with the Trusty package.

fredemmott added a commit that referenced this issue Jul 7, 2015
Summary: - session_stream is not supported (putting this up as it's a reviewable
   unit)
 - creating SSL or TLS servers is not supported
 - incompatible: raise a warning if SSL is specified because it is
   insecure.
 - hopefully enough for SMTP + STARTTLS

refs #1647

Reviewed By: @siyengar

Differential Revision: D2169850
@linkshops
Copy link

Hi fredemmott, I am still having trouble with Call to undefined function stream_socket_enable_crypto() error for SMTP pro plugin for Magento on Nginx + HHVM. Any tips on how to apply the latest build (and where) to make it applied on my server?

@fredemmott
Copy link
Contributor

If you're not running hhvm-nightly, you don't have it yet. You can either wait for 3.8 (recommended for production), or if you don't mind installing barely-tested versions: http://hhvm.com/blog/3203/nightly-packages

@fredemmott
Copy link
Contributor

This is included in HHVM 3.8.0 :)

@KarimGeiger
Copy link

@fredemmott You're awesome! Thanks a lot :)

@linkshops
Copy link

So awesome!

2015-07-15 6:00 GMT+09:00 Karim Geiger notifications@github.com:

@fredemmott https://github.com/fredemmott You're awesome! Thanks a lot
:)


Reply to this email directly or view it on GitHub
#1647 (comment).

@r3wt
Copy link

r3wt commented Jul 15, 2015

@fredemmott How can i enable it? I see that it freezes for like 15 seconds and times out when trying to send with gmail smtp server

img

EDIT; NVM but now i am getting some warnings about the timezone.

@EmperorKonstantin
Copy link

EmperorKonstantin commented Jul 16, 2015 via email

@tomazzaman
Copy link

I tried this out and it's not working properly, I get an error:

Fatal error: Unexpected object type File. in /home/webmaster/www/domain.com/wp-includes/class-smtp.php on line 262

The function in question looks like this:

    public function startTLS()
    {
        if (!$this->sendCommand("STARTTLS", "STARTTLS", 220)) {
            return false;
        }
        // Begin encrypted connection
        if (!stream_socket_enable_crypto(
            $this->smtp_conn,
            true,
            STREAM_CRYPTO_METHOD_TLS_CLIENT
        ) # This is line 262
        ) {
            return false;
        }
        return true;
    }

Am I missing something?

@ghost
Copy link

ghost commented Jul 21, 2015

Can confirm with latest (and one older) version of PHPMailer, and HHVM 3.8.0.
I think this is postfix/TLS related.

smtpd_helo_required                 = yes
smtpd_delay_reject                  = yes
smtpd_use_tls                       = yes
smtpd_tls_eecdh_grade               = strong
tls_eecdh_strong_curve              = prime256v1
tls_eecdh_ultra_curve               = secp384r1
tls_preempt_cipherlist              = yes
smtpd_tls_received_header           = yes
smtpd_tls_mandatory_ciphers         = high
smtpd_tls_ciphers                   = medium
smtpd_tls_mandatory_protocols       = !SSLv2,!SSLv3
smtpd_tls_mandatory_exclude_ciphers = aNULL,eNULL,EXPORT,DES,RC4,MD5,PSK,eECDH,EDH-DSS-DES-CBC3-SHA,EDH-RSA-DES-CDC3-SHA,KRB5-DE5,CBC3-SHA
smtpd_tls_dh1024_param_file         = /etc/ssl/dh2048.pem

Peer Debug Log:

Jul 21 13:57:45 xxx postfix/submission/smtpd[8316]: connect from remote.host[1.1.1.1]
Jul 21 13:57:45 xxx postfix/submission/smtpd[8316]: smtp_stream_setup: maxtime=300 enable_deadline=0
Jul 21 13:57:45 xxx postfix/submission/smtpd[8316]: match_hostname: remote.host ~? 127.0.0.0/8
Jul 21 13:57:45 xxx postfix/submission/smtpd[8316]: match_hostaddr: 1.1.1.1 ~? 127.0.0.0/8
Jul 21 13:57:45 xxx postfix/submission/smtpd[8316]: match_hostname: remote.host ~? [::ffff:127.0.0.0]/104
Jul 21 13:57:45 xxx postfix/submission/smtpd[8316]: match_hostaddr: 1.1.1.1 ~? [::ffff:127.0.0.0]/104
Jul 21 13:57:45 xxx postfix/submission/smtpd[8316]: match_hostname: remote.host ~? [::1]/128
Jul 21 13:57:45 xxx postfix/submission/smtpd[8316]: match_hostaddr: 1.1.1.1 ~? [::1]/128
Jul 21 13:57:45 xxx postfix/submission/smtpd[8316]: match_hostname: remote.host ~? 1.1.1.0/24
Jul 21 13:57:45 xxx postfix/submission/smtpd[8316]: match_hostaddr: 1.1.1.1 ~? 1.1.1.0/24
Jul 21 13:57:45 xxx postfix/submission/smtpd[8316]: > remote.host[1.1.1.1]: 220 xxx ESMTP Postfix (Debian/GNU)
Jul 21 13:57:45 xxx postfix/submission/smtpd[8316]: watchdog_pat: 0x7f1f04069ef0
Jul 21 13:57:45 xxx postfix/submission/smtpd[8316]: < remote.host[1.1.1.1]: EHLO zzz
Jul 21 13:57:45 xxx postfix/submission/smtpd[8316]: match_list_match: remote.host: no match
Jul 21 13:57:45 xxx postfix/submission/smtpd[8316]: match_list_match: 1.1.1.1: no match
Jul 21 13:57:45 xxx postfix/submission/smtpd[8316]: > remote.host[1.1.1.1]: 250-xxx
Jul 21 13:57:45 xxx postfix/submission/smtpd[8316]: > remote.host[1.1.1.1]: 250-PIPELINING
Jul 21 13:57:45 xxx postfix/submission/smtpd[8316]: > remote.host[1.1.1.1]: 250-SIZE
Jul 21 13:57:45 xxx postfix/submission/smtpd[8316]: > remote.host[1.1.1.1]: 250-VRFY
Jul 21 13:57:45 xxx postfix/submission/smtpd[8316]: > remote.host[1.1.1.1]: 250-ETRN
Jul 21 13:57:45 xxx postfix/submission/smtpd[8316]: > remote.host[1.1.1.1]: 250-STARTTLS
Jul 21 13:57:45 xxx postfix/submission/smtpd[8316]: > remote.host[1.1.1.1]: 250-ENHANCEDSTATUSCODES
Jul 21 13:57:45 xxx postfix/submission/smtpd[8316]: > remote.host[1.1.1.1]: 250-8BITMIME
Jul 21 13:57:45 xxx postfix/submission/smtpd[8316]: > remote.host[1.1.1.1]: 250 DSN
Jul 21 13:57:45 xxx postfix/submission/smtpd[8316]: watchdog_pat: 0x7f1f04069ef0
Jul 21 13:57:45 xxx postfix/submission/smtpd[8316]: < remote.host[1.1.1.1]: STARTTLS
Jul 21 13:57:45 xxx postfix/submission/smtpd[8316]: > remote.host[1.1.1.1]: 220 2.0.0 Ready to start TLS
Jul 21 13:57:45 xxx postfix/submission/smtpd[8316]: send attr request = seed
Jul 21 13:57:45 xxx postfix/submission/smtpd[8316]: send attr size = 32
Jul 21 13:57:45 xxx postfix/submission/smtpd[8316]: private/tlsmgr: wanted attribute: status
Jul 21 13:57:45 xxx postfix/submission/smtpd[8316]: input attribute name: status
Jul 21 13:57:45 xxx postfix/submission/smtpd[8316]: input attribute value: 0
Jul 21 13:57:45 xxx postfix/submission/smtpd[8316]: private/tlsmgr: wanted attribute: seed
Jul 21 13:57:45 xxx postfix/submission/smtpd[8316]: input attribute name: seed
Jul 21 13:57:45 xxx postfix/submission/smtpd[8316]: input attribute value: rJyHJDgGPVCOJrmcO1S275VY2V1UM+wFm3ezVlr8JJw=
Jul 21 13:57:45 xxx postfix/submission/smtpd[8316]: private/tlsmgr: wanted attribute: (list terminator)
Jul 21 13:57:45 xxx postfix/submission/smtpd[8316]: input attribute name: (end)
Jul 21 13:57:45 xxx postfix/submission/smtpd[8316]: SSL_accept error from remote.host[1.1.1.1]: lost connection
Jul 21 13:57:45 xxx postfix/submission/smtpd[8316]: match_hostname: remote.host ~? 127.0.0.0/8
Jul 21 13:57:45 xxx postfix/submission/smtpd[8316]: match_hostaddr: 1.1.1.1 ~? 127.0.0.0/8
Jul 21 13:57:45 xxx postfix/submission/smtpd[8316]: match_hostname: remote.host ~? [::ffff:127.0.0.0]/104
Jul 21 13:57:45 xxx postfix/submission/smtpd[8316]: match_hostaddr: 1.1.1.1 ~? [::ffff:127.0.0.0]/104
Jul 21 13:57:45 xxx postfix/submission/smtpd[8316]: match_hostname: remote.host ~? [::1]/128
Jul 21 13:57:45 xxx postfix/submission/smtpd[8316]: match_hostaddr: 1.1.1.1 ~? [::1]/128
Jul 21 13:57:45 xxx postfix/submission/smtpd[8316]: match_hostname: remote.host ~? 1.1.1.0/24
Jul 21 13:57:45 xxx postfix/submission/smtpd[8316]: match_hostaddr: 1.1.1.1 ~? 1.1.1.0/24
Jul 21 13:57:45 xxx postfix/submission/smtpd[8316]: lost connection after STARTTLS from remote.host[1.1.1.1]
Jul 21 13:57:45 xxx postfix/submission/smtpd[8316]: disconnect from remote.host[1.1.1.1]

Not much to go on though.

@ghost
Copy link

ghost commented Jul 21, 2015

Ooooh. I just realized, PHPMailer isn't working AT ALL with HHVM 3.8, regardless of stream_socket_enable_crypto(). Before (up to 3.7.2), I never cared that much for the issue on this topic, because I was using PHPMailer on localhost and let postfix do the auth thingy with the relayhost. Latest update broke that. :-(

@Krapulat
Copy link

I have the same error as @tomazzaman.

Fatal error: Unexpected object type File. in /var/www/domain.com/wp-includes/class-smtp.php on line 262

Only happen when using STARTTLS.

Without HHVM, with PHP-FPM, it works fine. So I think it is not problem of Postfix.

Any thought?

@fredemmott
Copy link
Contributor

Please open a new issue, ideally with < 5 line example that's just a call to stream_socket_enable_crypto() on a stream that works in PHP5 and not hhvm and doesn't depend on any framework/library. calling get_resource-type on $this->smtp_conn) seems likely to be a good starting point.

@Krapulat
Copy link

class-smtp.php uses library PHPMailer. So the problem is with PHPMailer?

@andrewmclagan
Copy link

+1 this makes HHVM unusable for Laravel developers

@fredemmott
Copy link
Contributor

@andrewmclagan : this issue is fixed. If you are still having a problem with Laravel, please file a new issue with details - HHVM version, what PHP functionality is not working (i.e. which PHP functions, not which parts of laravel), and so on.

@andrewmclagan
Copy link

apologies, i pulled an old version

lainme pushed a commit to lainme/dokuwiki-plugin-smtp that referenced this issue May 26, 2023
af82e9a Update README.md
7d9a245 Merge pull request splitbrain#32 from lainme/master
b1bf14d Allow insecure ssl connection
e09f9a1 Merge pull request splitbrain#25 from Borian23/master
2a63e44 Set reply-to
ecee529 Merge pull request splitbrain#24 from txthinking/updates
55ccc4d explicitly set protocols on 'tls' connection
c0f0480 slightly updated phpunit, adjusted travis
49cd4e5 Merge pull request splitbrain#22 from Xylane/patch-1
2de137b Update Message.php
073c654 remove php5.6 test, next version will unsupport
09013cf support tlsv1.0 tlsv1.1 tlsv1.2
cf3af43 Merge pull request splitbrain#19 from joshtronic/feat_expand-tls
c375f9f feat(tls): expand tls options
648ca5a remove setTo,setAttachment fixed splitbrain#15
06a378f Merge pull request splitbrain#14 from Echosong/master
e95c7ab cli
3bbf157 update test from email
d243432 Merge branch 'vinkla-patch-2'
27001aa Merge branch 'patch-2' of git://github.com/vinkla/Mailer into vinkla-patch-2
c384252 Merge pull request splitbrain#12 from vinkla/patch-1
ba62b03 Ignore phpunit.xml locally
72aef58 Rename phpunit.xml to phpunit.xml.dist
f6ae003 Remove blankline
7cabdf3 Add .gitattributes
a5d9ebb support SASL AUTH OAUTHBEARER Mechanism. splitbrain#11
6d3e91a for non-ascii reply-to
364c937 Merge pull request splitbrain#10 from daemionfox/master
e7783dd Added reply-to
da10c0b readme
b0124f9 allow add cc and bcc
4dcaeda base64 encode subject
a5478de utf-8 base64 encode name
f372aa2 allow to send more persons who has same name, and love psr2
4746e50 add ci status
25d95e1 facebook/hhvm#1647
4943e69 fxied undefine variable
0708abd fixed for 5.3 syntax error in testing file and hhvm namespace function error
8b7bd57 add more sleeping
33b095a auto test
8c92f5a Merge pull request splitbrain#7 from splitbrain/mailtrap
574b664 Merge pull request splitbrain#8 from splitbrain/minorcleanup
9d029a0 do not send /etc/hosts in test mails
e8ff6d1 removed outdated param docs
a15e2d2 added missing PHPdocs
2253bdf send returns bool
3914f8a added travis config for automated tests
6acc17d run a SMTP test via TLS
1c2faeb run the exception test against localhost again
70e1674 adhere to limits
7d912a6 use mailtrap.io for testing
98cfc1f Merge pull request splitbrain#6 from splitbrain/tls
21624b3 fix TLS command
248353c Merge branch 'master' of github.com:txthinking/Mailer into ehlo
97331ad Merge branch 'splitbrain-master' into develop
543f35d update composer
85662a3 allow to set custom EHLO message

git-subtree-dir: subtree/txtthinking/Mailer
git-subtree-split: af82e9a
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