Status of SSL on Pharo? (and some general questions on mail and IO)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Status of SSL on Pharo? (and some general questions on mail and IO)

larrry
Hi, 

I'm looking for a way to send email using SSL. Googling I've found several conversations from earlier this year on the subject, including one thread from May and another from January. In the May thread it sounded like a project was getting kicked off to do something that might be official-ish.  Has there been progress on this?

Second question, while playing with mail in my pharo image, the entire image seems to block during the handshake/send.  Is there a way around that? If not, would a solution perhaps be to run a separate image to send emails and communicate via a db or file system?

Final question, does Pharo always block on IO? My impression was that all Smalltalks did at one time, but that some (visualworks? squeak?) had fixed that years ago. 

Thanks. 
Reply | Threaded
Open this post in threaded view
|

Re: Status of SSL on Pharo? (and some general questions on mail and IO)

Sven Van Caekenberghe
Larry,

On 20 Sep 2011, at 02:13, Larry White wrote:

> Hi,
>
> I'm looking for a way to send email using SSL.

There is no ready out-of-the-box solution for this (yet), as far as I know.

> Googling I've found several conversations from earlier this year on the subject, including one thread from May and another from January. In the May thread it sounded like a project was getting kicked off to do something that might be official-ish.  Has there been progress on this?

Yes, there is a project called Zodiac that reimplements socketstream and adds secure (SSL) socket streams. These are then used for HTTPS. I think they should also work for sending email over SSL.

At the moment Zodiac is still in development, if you are interested, see my messages to the Pharo dev list.

Some people have used local tunneling (http -> https) using stunnel as a way around this problem.

> Second question, while playing with mail in my pharo image, the entire image seems to block during the handshake/send.  Is there a way around that? If not, would a solution perhaps be to run a separate image to send emails and communicate via a db or file system?
>
> Final question, does Pharo always block on IO? My impression was that all Smalltalks did at one time, but that some (visualworks? squeak?) had fixed that years ago.

Pharo typically blocks when the main or UI thread is doing something, which includes IO. You can perfectly do all kinds of things in other threads. Check the process monitor or try some multithreaded server.

HTH,

Sven


Reply | Threaded
Open this post in threaded view
|

Re: Status of SSL on Pharo? (and some general questions on mail and IO)

Guillermo Polito


On Tue, Sep 20, 2011 at 3:16 AM, Sven Van Caekenberghe <[hidden email]> wrote:
Larry,

On 20 Sep 2011, at 02:13, Larry White wrote:

> Hi,
>
> I'm looking for a way to send email using SSL.

There is no ready out-of-the-box solution for this (yet), as far as I know.

> Googling I've found several conversations from earlier this year on the subject, including one thread from May and another from January. In the May thread it sounded like a project was getting kicked off to do something that might be official-ish.  Has there been progress on this?

Yes, there is a project called Zodiac that reimplements socketstream and adds secure (SSL) socket streams. These are then used for HTTPS. I think they should also work for sending email over SSL.

At the moment Zodiac is still in development, if you are interested, see my messages to the Pharo dev list.

Some people have used local tunneling (http -> https) using stunnel as a way around this problem.

I've used the SSL Plugin + Zodiac to access some Google APIs with success last week in Linux (ubuntu).  If you can use the plugin, maybe it's worth to use it :).
I just followed Sven instructions from one of hist last emails :).

Cheers,
Guille
Reply | Threaded
Open this post in threaded view
|

Re: Status of SSL on Pharo? (and some general questions on mail and IO)

larrry
In reply to this post by Sven Van Caekenberghe

On Tue, Sep 20, 2011 at 2:16 AM, Sven Van Caekenberghe <[hidden email]> wrote:

> Final question, does Pharo always block on IO? My impression was that all Smalltalks did at one time, but that some (visualworks? squeak?) had fixed that years ago.

Pharo typically blocks when the main or UI thread is doing something, which includes IO. You can perfectly do all kinds of things in other threads. Check the process monitor or try some multithreaded server.


Thanks Sven, 
I tried sending the email by wrapping the code in a block and sending fork to the block, but the image was still frozen until it returned. Is that the wrong way to do it?

thanks again.
 
HTH,

Sven



Reply | Threaded
Open this post in threaded view
|

Re: Status of SSL on Pharo? (and some general questions on mail and IO)

Sven Van Caekenberghe

On 20 Sep 2011, at 17:56, Larry White wrote:

> On Tue, Sep 20, 2011 at 2:16 AM, Sven Van Caekenberghe <[hidden email]> wrote:
>
> > Final question, does Pharo always block on IO? My impression was that all Smalltalks did at one time, but that some (visualworks? squeak?) had fixed that years ago.
>
> Pharo typically blocks when the main or UI thread is doing something, which includes IO. You can perfectly do all kinds of things in other threads. Check the process monitor or try some multithreaded server.
>
>
> Thanks Sven,
> I tried sending the email by wrapping the code in a block and sending fork to the block, but the image was still frozen until it returned. Is that the wrong way to do it?
>
> thanks again.

I need more information and code that I can execute in order to try to help you.

Sven
Reply | Threaded
Open this post in threaded view
|

Re: Status of SSL on Pharo? (and some general questions on mail and IO)

larrry
This is what I ran (excepting the actual email addresses).

[SMTP client deliverMailFrom: '[hidden email]' to: #('[hidden email]') text:
'Subject: this is a test
Hello from Pharo!
' usingServer: 'smtp.gmail.com' ] fork.

it fails of course (no ssl) but it hangs while it tries.

thanks.

On Tue, Sep 20, 2011 at 12:34 PM, Sven Van Caekenberghe <[hidden email]> wrote:

On 20 Sep 2011, at 17:56, Larry White wrote:

> On Tue, Sep 20, 2011 at 2:16 AM, Sven Van Caekenberghe <[hidden email]> wrote:
>
> > Final question, does Pharo always block on IO? My impression was that all Smalltalks did at one time, but that some (visualworks? squeak?) had fixed that years ago.
>
> Pharo typically blocks when the main or UI thread is doing something, which includes IO. You can perfectly do all kinds of things in other threads. Check the process monitor or try some multithreaded server.
>
>
> Thanks Sven,
> I tried sending the email by wrapping the code in a block and sending fork to the block, but the image was still frozen until it returned. Is that the wrong way to do it?
>
> thanks again.

I need more information and code that I can execute in order to try to help you.

Sven

Reply | Threaded
Open this post in threaded view
|

Re: Status of SSL on Pharo? (and some general questions on mail and IO)

Sven Van Caekenberghe
Larry,

This works for me using our own SMTP server without the SSL option.
Note that we have a custom port and of course don't allow annonymous relaying.

| client |
client := SMTPClient new.
text := String streamContents: [ :stream |
        stream << 'Subject: Test'; crlf; crlf.
        stream << 'Hi there!'; crlf; << 'Sent from Pharo Smalltalk'; crlf ].
[
        client user: '[hidden email]'; password: '???'.
        client
                openOnHost: (NetNameResolver addressForName: 'smtp.beta9.be')
                port: 2525.
        client
                mailFrom: '[hidden email]'
                to: #('[hidden email]')
                text: text.
        client quit ] ensure: [ client close ].
client

If you have Seaside in your image, look at the references of SMTPClient, they do something similar.

Next, I will subclass SMTPClient to try to do an SSL connection with our server.

Concerning the 'hanging': are you sure you cannot interrupt and enter the debugger using CMD-. ?

What version of Pharo are you using and on which platform ?

Sven


On 20 Sep 2011, at 20:13, Larry White wrote:

> This is what I ran (excepting the actual email addresses).
>
> [SMTP client deliverMailFrom: '[hidden email]' to: #('[hidden email]') text:
> 'Subject: this is a test
> Hello from Pharo!
> ' usingServer: 'smtp.gmail.com' ] fork.
>
> it fails of course (no ssl) but it hangs while it tries.
>
> thanks.
>
> On Tue, Sep 20, 2011 at 12:34 PM, Sven Van Caekenberghe <[hidden email]> wrote:
>
> On 20 Sep 2011, at 17:56, Larry White wrote:
>
> > On Tue, Sep 20, 2011 at 2:16 AM, Sven Van Caekenberghe <[hidden email]> wrote:
> >
> > > Final question, does Pharo always block on IO? My impression was that all Smalltalks did at one time, but that some (visualworks? squeak?) had fixed that years ago.
> >
> > Pharo typically blocks when the main or UI thread is doing something, which includes IO. You can perfectly do all kinds of things in other threads. Check the process monitor or try some multithreaded server.
> >
> >
> > Thanks Sven,
> > I tried sending the email by wrapping the code in a block and sending fork to the block, but the image was still frozen until it returned. Is that the wrong way to do it?
> >
> > thanks again.
>
> I need more information and code that I can execute in order to try to help you.
>
> Sven
>


Reply | Threaded
Open this post in threaded view
|

Re: Status of SSL on Pharo? (and some general questions on mail and IO)

Sven Van Caekenberghe

On 21 Sep 2011, at 09:00, Sven Van Caekenberghe wrote:

> Next, I will subclass SMTPClient to try to do an SSL connection with our server.

I made a very simple ZdcSecureSMTPClient subclass available in Zodiac-Extra (http://www.squeaksource.com/Zodiac) to test this setup, but it does not seem to work: the 'connect' handshake does not complete (actually it hangs in a loop). Since this essentially goes to a primitive and into the plugin's native code and the OS's libraries, this is currently a mistery to me.

Sven
Reply | Threaded
Open this post in threaded view
|

Re: Status of SSL on Pharo? (and some general questions on mail and IO)

larrry
In reply to this post by Sven Van Caekenberghe
Hi Sven, 

When I said 'hanging' i wasn't implying that mail didn't work: it can't connect to that server without SSL.  Anyway, I tried to interrupt with CMD "." - I wasn't aware of that option - but now I'm getting the error msg back so fast I can't interrupt it. Sigh.  I'll keep trying when I'm not on my day job. 


On Wed, Sep 21, 2011 at 3:00 AM, Sven Van Caekenberghe <[hidden email]> wrote:
Larry,

This works for me using our own SMTP server without the SSL option.
Note that we have a custom port and of course don't allow annonymous relaying.

| client |
client := SMTPClient new.
text := String streamContents: [ :stream |
       stream << 'Subject: Test'; crlf; crlf.
       stream << 'Hi there!'; crlf; << 'Sent from Pharo Smalltalk'; crlf ].
[
       client user: '[hidden email]'; password: '???'.
       client
               openOnHost: (NetNameResolver addressForName: 'smtp.beta9.be')
               port: 2525.
       client
               mailFrom: '[hidden email]'
               to: #('[hidden email]')
               text: text.
       client quit ] ensure: [ client close ].
client

If you have Seaside in your image, look at the references of SMTPClient, they do something similar.

Next, I will subclass SMTPClient to try to do an SSL connection with our server.

Concerning the 'hanging': are you sure you cannot interrupt and enter the debugger using CMD-. ?

What version of Pharo are you using and on which platform ?

Sven


On 20 Sep 2011, at 20:13, Larry White wrote:

> This is what I ran (excepting the actual email addresses).
>
> [SMTP client deliverMailFrom: '[hidden email]' to: #('[hidden email]') text:
> 'Subject: this is a test
> Hello from Pharo!
> '     usingServer: 'smtp.gmail.com' ] fork.
>
> it fails of course (no ssl) but it hangs while it tries.
>
> thanks.
>
> On Tue, Sep 20, 2011 at 12:34 PM, Sven Van Caekenberghe <[hidden email]> wrote:
>
> On 20 Sep 2011, at 17:56, Larry White wrote:
>
> > On Tue, Sep 20, 2011 at 2:16 AM, Sven Van Caekenberghe <[hidden email]> wrote:
> >
> > > Final question, does Pharo always block on IO? My impression was that all Smalltalks did at one time, but that some (visualworks? squeak?) had fixed that years ago.
> >
> > Pharo typically blocks when the main or UI thread is doing something, which includes IO. You can perfectly do all kinds of things in other threads. Check the process monitor or try some multithreaded server.
> >
> >
> > Thanks Sven,
> > I tried sending the email by wrapping the code in a block and sending fork to the block, but the image was still frozen until it returned. Is that the wrong way to do it?
> >
> > thanks again.
>
> I need more information and code that I can execute in order to try to help you.
>
> Sven
>



Reply | Threaded
Open this post in threaded view
|

Re: Status of SSL on Pharo? (and some general questions on mail and IO)

Sven Van Caekenberghe
In reply to this post by Sven Van Caekenberghe

On 21 Sep 2011, at 17:05, Sven Van Caekenberghe wrote:

>> Next, I will subclass SMTPClient to try to do an SSL connection with our server.
>
> I made a very simple ZdcSecureSMTPClient subclass available in Zodiac-Extra (http://www.squeaksource.com/Zodiac) to test this setup, but it does not seem to work: the 'connect' handshake does not complete (actually it hangs in a loop). Since this essentially goes to a primitive and into the plugin's native code and the OS's libraries, this is currently a mistery to me.

I just read http://www.ietf.org/rfc/rfc3207.txt

It turns out that before doing the TLS negociation (connect handshake), some prior conversation is needed, including the STARTTLS command. I think this might be doable, I will try.

Sven