# Has anyone got STARTTLS to work for IMAP?

**URL:** <https://forums.interworx.com/t/has-anyone-got-starttls-to-work-for-imap/14127>\
**Category:** General Inquries\
**Tags:** email, imap, tls, starttls\
**Created:** [January 10, 2017, 8:08am UTC](https://forums.interworx.com/t/has-anyone-got-starttls-to-work-for-imap/14127 "2017-01-10T08:08:23Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Justec](https://forums.interworx.com/letter_avatar_proxy/v4/letter/j/e47774/32.png) [@Justec](https://forums.interworx.com/u/Justec)\
**Post date:** [January 10, 2017, 8:08am UTC](https://forums.interworx.com/t/has-anyone-got-starttls-to-work-for-imap/14127/1 "2017-01-10T08:08:23Z")

</div>

I thought I had an issue with Outlook 2010 being old, so as a test I got the latest version of Thunderbird which clearly supports STARTTLS.

I changed my server back to TLSv1 temporarily for both TLS and STARTTLS connections and was not able to connect using STARTTLS on port 143.  
If I changed it back to the standard TLS on port 993 it works fine.

So trying to figure out if there is a STARTTLS issue on my server, my computer (Windows 10), or something with STARTTLS in general on interworx CentOS 7 servers???

I mean I assume most people, including me, still just use the old way of having explicit ports for secure channels, but this should work as it’s enabled on the server by default.

---

<div class="post-metadata">

**Author:** ![Justec](https://forums.interworx.com/letter_avatar_proxy/v4/letter/j/e47774/32.png) [@Justec](https://forums.interworx.com/u/Justec)\
**Post date:** [January 10, 2017, 8:11am UTC](https://forums.interworx.com/t/has-anyone-got-starttls-to-work-for-imap/14127/2 "2017-01-10T08:11:10Z")

</div>

Well I just found this old post here from 2011 before STARTTLS was enabled:  
[http://forums.interworx.com/threads/3674-starttls-not-available-on-imapd?highlight=starttls](http://forums.interworx.com/threads/3674-starttls-not-available-on-imapd?highlight=starttls)

[QUOTE=nars;18782]I did noticed that starttls is not available on iworx courier imapd:

telnet localhost 143

```auto
* OK [CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA IDLE] Courier-IMAP ready. Copyright 1998-2003 Double Precision, Inc. See COPYING for distribution information.

```

I do have a similar courier version on another machine (w/o iworx) and it does support it:

```auto
* OK [CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA IDLE ACL ACL2=UNION STARTTLS] Courier-IMAP ready. Copyright 1998-2004 Double Precision, Inc. See COPYING for distribution information.

```

I did compared configuration files and they are very very similar, I guess the problem may be related to the way iworx uses courier with tcpserver, any ideas to sort it?[/QUOTE]

When I checked mine with telnet I seem to not be supporting it, which explains why it isn’t working.

```auto

* OK [CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA IDLE] Courier-IMAP ready. Copyright 1998-2003 Double Precision, Inc. See COPYING for distribution information.

```

The conf file does have it though. So maybe this is a bug?

```auto

##NAME: IMAPDSTARTTLS:0
#
# Whether or not to implement IMAP STARTTLS extension instead:

IMAPDSTARTTLS=YES

```

---

<div class="post-metadata">

**Author:** ![d2d4j](https://forums.interworx.com/user_avatar/forums.interworx.com/d2d4j/32/16_2.png) [@d2d4j](https://forums.interworx.com/u/d2d4j)\
**Post date:** [January 10, 2017, 12:05pm UTC](https://forums.interworx.com/t/has-anyone-got-starttls-to-work-for-imap/14127/3 "2017-01-10T12:05:46Z")

</div>

Hi Justin

The test I did this morning was using TLS on 143 I think from memory

Also, it maybe tired eyes here, but I cannot see any difference in your telnet output sorry

I’ll rerun my tls test to be sure

Many thanks

John

---

<div class="post-metadata">

**Author:** ![d2d4j](https://forums.interworx.com/user_avatar/forums.interworx.com/d2d4j/32/16_2.png) [@d2d4j](https://forums.interworx.com/u/d2d4j)\
**Post date:** [January 10, 2017, 12:18pm UTC](https://forums.interworx.com/t/has-anyone-got-starttls-to-work-for-imap/14127/4 "2017-01-10T12:18:20Z")

</div>

Hi Justin

Sorry, the test port was 993

I thought I would check, and a quick google shows imaps should only work on port 993 for SSL or TLS, with imap only using 143

So starttls on port 143 would not work by design. Starttls does work on pop and smtp as it should

I hope that helps, and guess I should have checked that this morning sorry

Many thanks

John

---

<div class="post-metadata">

**Author:** ![Justec](https://forums.interworx.com/letter_avatar_proxy/v4/letter/j/e47774/32.png) [@Justec](https://forums.interworx.com/u/Justec)\
**Post date:** [January 10, 2017, 12:23pm UTC](https://forums.interworx.com/t/has-anyone-got-starttls-to-work-for-imap/14127/5 "2017-01-10T12:23:33Z")

</div>

My telnet does not give me the STARTTLS as an option as it should.

What does yours show if you telnet [host.com](http://host.com) 143??

---

<div class="post-metadata">

**Author:** ![d2d4j](https://forums.interworx.com/user_avatar/forums.interworx.com/d2d4j/32/16_2.png) [@d2d4j](https://forums.interworx.com/u/d2d4j)\
**Post date:** [January 10, 2017, 1:35pm UTC](https://forums.interworx.com/t/has-anyone-got-starttls-to-work-for-imap/14127/6 "2017-01-10T13:35:59Z")

</div>

Hi Justin  
Sorry, my 1 brain cell is not working, so please disregard my comment over starttls on imap, it is possible.  
My telnet gives below, and running starttls gives no errors on imap  
Many thanks  
John

- OK [CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THRE  
AD=REFERENCES SORT QUOTA IDLE] Courier-IMAP ready. Copyright 1998-2003 Double Pr  
ecision, Inc. See COPYING for distribution information.

---

<div class="post-metadata">

**Author:** ![Justec](https://forums.interworx.com/letter_avatar_proxy/v4/letter/j/e47774/32.png) [@Justec](https://forums.interworx.com/u/Justec)\
**Post date:** [January 10, 2017, 2:27pm UTC](https://forums.interworx.com/t/has-anyone-got-starttls-to-work-for-imap/14127/7 "2017-01-10T14:27:59Z")

</div>

Hey John, I had no idea about STARTTLS stuff until this week. I’ve always gone with the secure and unsecure ports. But they are trying to bring one service / one port. So both secure and unsecure on one port.

So SSL/TLS (basically the same thing, TLS is just newer SSL) works on port 993.  
STARTTLS runs on port 143, and basically allows port 143 IMAP to be secure.

When I telnet to port 143 I expect to get this:

- OK [CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA IDLE STARTTLS] Courier-IMAP ready.

But I get this:

- OK [CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA IDLE] Courier-IMAP ready.

---

<div class="post-metadata">

**Author:** ![d2d4j](https://forums.interworx.com/user_avatar/forums.interworx.com/d2d4j/32/16_2.png) [@d2d4j](https://forums.interworx.com/u/d2d4j)\
**Post date:** [January 10, 2017, 3:08pm UTC](https://forums.interworx.com/t/has-anyone-got-starttls-to-work-for-imap/14127/8 "2017-01-10T15:08:44Z")

</div>

Hi Justin

Yes, I know what your saying

Starttls upgrades to connection to secure, which I believe should go from 143 to 993, just as smtp goes from 25 to 587 (that’s why you cannot create a secure 587 directly)

Your correct with SSL and TLS, but in simple terms, the connection is not bothered if it’s SSL or TLS, it just knows to use secure, then negotiate a cipher i.e. TLS is replacement for SSL

It should work on imap so I’ll email Iw this thread, and kudos to you

Many thanks and have a lovely night

John

---

<div class="post-metadata">

**Author:** ![Justec](https://forums.interworx.com/letter_avatar_proxy/v4/letter/j/e47774/32.png) [@Justec](https://forums.interworx.com/u/Justec)\
**Post date:** [January 10, 2017, 4:59pm UTC](https://forums.interworx.com/t/has-anyone-got-starttls-to-work-for-imap/14127/9 "2017-01-10T16:59:28Z")

</div>

> [@d2d4j;29403](#):
>
> Starttls upgrades to connection to secure, which I believe should go from 143 to 993

This is incorrect. The idea of STARTTLS is to eliminate the need to have 2 ports for 1 service. So that both secure and not secure can run on port 25, port 110, and port 143. Then you have the option to require secure (TLS) or not. So you can continue to support both nonsecure and secure connection on IMAP 143 or just make it secure only on 143.

> [@d2d4j;29403](#):
>
> just as smtp goes from 25 to 587 (that’s why you cannot create a secure 587 directly)

SMTP you can go secure on port 25 or 587, both use STARTTLS.

Originally, before STARTTLS, I believe the secure port for SMTP was 465. After STARTTLS they got rid of that port completely.  
Port 587 was created as a SMTP submission port, basically for user sending emails from a program like outlook to connect to the server.  
Now port 25 is supposed to be used just for server to server communication.

Have a good night as well!

---

<div class="post-metadata">

**Author:** ![d2d4j](https://forums.interworx.com/user_avatar/forums.interworx.com/d2d4j/32/16_2.png) [@d2d4j](https://forums.interworx.com/u/d2d4j)\
**Post date:** [January 11, 2017, 1:23am UTC](https://forums.interworx.com/t/has-anyone-got-starttls-to-work-for-imap/14127/10 "2017-01-11T01:23:14Z")

</div>

Hi Justin

Your 100% correct on starttls

I can be slow sorry, but for some reason, I always believed the port was changed - absolutely no idea why I came to that conclusion sorry

I do not think port 25 would ever be solely used for server to server only, I think it has been a lifetime of all user usage, and will continue to be

I emailed Iw the thread

Many thanks

John

---

<div class="post-metadata">

**Author:** ![Justec](https://forums.interworx.com/letter_avatar_proxy/v4/letter/j/e47774/32.png) [@Justec](https://forums.interworx.com/u/Justec)\
**Post date:** [January 11, 2017, 7:34am UTC](https://forums.interworx.com/t/has-anyone-got-starttls-to-work-for-imap/14127/11 "2017-01-11T07:34:47Z")

</div>

> [@d2d4j;29406](#):
>
> I do not think port 25 would ever be solely used for server to server only, I think it has been a lifetime of all user usage, and will continue to be

Right, this is just “the plan.” Similar to the plan to get rid of port 993 and 995 for secure POP and IMAP. But most server still support that because older client email programs can’t use STARTTLS.

I have a information ticket open with iworx as well on the STARTTLS issue. I’m still not sure if it’s just something I did on my server or a real issue. I guess a lot of people still use 993 and 995 so it could be a real issue.

---

<div class="post-metadata">

**Author:** ![d2d4j](https://forums.interworx.com/user_avatar/forums.interworx.com/d2d4j/32/16_2.png) [@d2d4j](https://forums.interworx.com/u/d2d4j)\
**Post date:** [January 11, 2017, 10:21am UTC](https://forums.interworx.com/t/has-anyone-got-starttls-to-work-for-imap/14127/12 "2017-01-11T10:21:05Z")

</div>

Hi Justin

Many thanks, but I do think as these ports are already assigned for usage, it will take many many years, even when old client software has been updated or no longer used. E.g. iPhone 5, 6 and 7 (iOS10), still allow 993, and defaults to 993

It’s just my thoughts though, and I’m usually wrong sorry

I had a quick login look at imapd/imapd-ssl, including dist and cf, and it does look like starttls has not been set in imapd, though starttls was set 1 on imapd, with starttls option left out on imapd. So that would indicate to me from the quick look, that it is intentional for imap to use imapd 143 and imapd-ssl 993

I could be wrong though, so apologies in advance and appreciate an update once Iw have resolved it

Many thanks

John

---

<div class="post-metadata">

**Author:** ![Justec](https://forums.interworx.com/letter_avatar_proxy/v4/letter/j/e47774/32.png) [@Justec](https://forums.interworx.com/u/Justec)\
**Post date:** [January 11, 2017, 2:19pm UTC](https://forums.interworx.com/t/has-anyone-got-starttls-to-work-for-imap/14127/13 "2017-01-11T14:19:46Z")

</div>

Yes, moving away from 993 / 995 is more of a client issue. Until all the old clients that only use regular TLS on 993/995 are phased out, servers will have to continue to support these ports.  
I would just like to offer the new way of doing it to clients that can use it.

[QUOTE=d2d4j;29415]  
I had a quick login look at imapd/imapd-ssl, including dist and cf, and it does look like starttls has not been set in imapd, though starttls was set 1 on imapd, with starttls option left out on imapd. So that would indicate to me from the quick look, that it is intentional for imap to use imapd 143 and imapd-ssl 993[/QUOTE]

I heard back from interworx and they said only support STARTTLS for SMTP. So basically right now the interworx server doesn’t support this new way of making secure IMAP and POP3 connections.

What’s strange to me is that in the imapd-ssl.conf, there is a reference to the STARTTLS. But if imapd-ssl.conf is only for the imap4-ssl service, then having STARTTLS in there doesn’t make sense. If you connect to port 993, that is already a secure port by default. So you would never issue a STARTTLS command. It’s redundant.

I’ve asked this question about “what’s the point of STARTTLS on port 993” and waiting to hear back.

But as of now, it just seems it’s not an option for interworx.

---

<div class="post-metadata">

**Author:** ![Justec](https://forums.interworx.com/letter_avatar_proxy/v4/letter/j/e47774/32.png) [@Justec](https://forums.interworx.com/u/Justec)\
**Post date:** [January 12, 2017, 10:32am UTC](https://forums.interworx.com/t/has-anyone-got-starttls-to-work-for-imap/14127/14 "2017-01-12T10:32:55Z")

</div>

I have my test VM server setup now. I’m currently testing the MariaDB upgrade against some of my larger sites before I apply to my main server.

After I complete that I am going to try upgrading Courier-IMAP server to see if that enables STARTTLS. I’ll report back here after I get to that.

---

<div class="post-metadata">

**Author:** ![d2d4j](https://forums.interworx.com/user_avatar/forums.interworx.com/d2d4j/32/16_2.png) [@d2d4j](https://forums.interworx.com/u/d2d4j)\
**Post date:** [January 12, 2017, 12:34pm UTC](https://forums.interworx.com/t/has-anyone-got-starttls-to-work-for-imap/14127/15 "2017-01-12T12:34:10Z")

</div>

Hi Justin

Good luck, hope it goes well

Many thanks

John
