<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin-top:0cm;
margin-right:0cm;
margin-bottom:0cm;
margin-left:36.0pt;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:1647665227;
mso-list-type:hybrid;
mso-list-template-ids:486840836 -437901230 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
@list l0:level1
{mso-level-start-at:2017;
mso-level-number-format:bullet;
mso-level-text:-;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Calibri","sans-serif";
mso-fareast-font-family:Calibri;
mso-bidi-font-family:"Times New Roman";}
@list l0:level2
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l0:level3
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;}
@list l0:level4
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l0:level5
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l0:level6
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;}
@list l0:level7
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l0:level8
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l0:level9
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;}
ol
{margin-bottom:0cm;}
ul
{margin-bottom:0cm;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal>I’m trying to do a proof of concept using Stunnel on AIX 6.1. <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Without stunnel I’d have:<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Telnet session -> listening service<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>With stunnel, I want:<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>telnet session -> stunnel client –[secure connection]--> Stunnel server -->listening service.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>The stunnel client seems to be working fine, but the stunnel server abends as soon as it receives a secure connection.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span lang=FR>Client:<o:p></o:p></span></p><p class=MsoNormal><span lang=FR><o:p> </o:p></span></p><p class=MsoNormal><span lang=FR>Accepts non-secure on port 33342. </span>Forwards to secure socket 33343<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>stunnel stunnel.conf.2<o:p></o:p></p><p class=MsoNormal>2017.02.21 09:31:35 LOG5[ui]: stunnel 5.40 on powerpc-ibm-aix6.1.0.0 platform<o:p></o:p></p><p class=MsoNormal>2017.02.21 09:31:35 LOG5[ui]: Compiled/running with OpenSSL 1.0.2j 26 Sep 2016<o:p></o:p></p><p class=MsoNormal>2017.02.21 09:31:35 LOG5[ui]: Threading:PTHREAD Sockets:POLL,IPv6 TLS:ENGINE,FIPS,OCSP,PSK,SNI<o:p></o:p></p><p class=MsoNormal>2017.02.21 09:31:35 LOG5[ui]: Reading configuration from file /bmo/stunnel/bin/stunnel.conf.2<o:p></o:p></p><p class=MsoNormal>2017.02.21 09:31:35 LOG5[ui]: UTF-8 byte order mark detected<o:p></o:p></p><p class=MsoNormal>2017.02.21 09:31:35 LOG5[ui]: FIPS mode disabled<o:p></o:p></p><p class=MsoNormal>2017.02.21 09:31:35 LOG6[ui]: Initializing service [hif]<o:p></o:p></p><p class=MsoNormal>2017.02.21 09:31:35 LOG6[ui]: Loading certificate from file: /bmo/stunnel/stunnel.pem<o:p></o:p></p><p class=MsoNormal>2017.02.21 09:31:35 LOG6[ui]: Certificate loaded from file: /bmo/stunnel/stunnel.pem<o:p></o:p></p><p class=MsoNormal>2017.02.21 09:31:35 LOG6[ui]: Loading private key from file: /bmo/stunnel/stunnel.pem<o:p></o:p></p><p class=MsoNormal>2017.02.21 09:31:35 LOG4[ui]: Insecure file permissions on /bmo/stunnel/stunnel.pem<o:p></o:p></p><p class=MsoNormal>2017.02.21 09:31:35 LOG6[ui]: Private key loaded from file: /bmo/stunnel/stunnel.pem<o:p></o:p></p><p class=MsoNormal>2017.02.21 09:31:35 LOG4[ui]: Service [hif] needs authentication to prevent MITM attacks<o:p></o:p></p><p class=MsoNormal>2017.02.21 09:31:35 LOG5[ui]: Configuration successful<o:p></o:p></p><p class=MsoNormal>2017.02.21 09:31:38 LOG5[0]: Service [hif] accepted connection from 127.0.0.1:34749<o:p></o:p></p><p class=MsoNormal>2017.02.21 09:31:38 LOG6[0]: s_connect: connecting 127.0.0.1:33343<o:p></o:p></p><p class=MsoNormal>2017.02.21 09:31:38 LOG6[0]: s_connect: connected 127.0.0.1:33343<o:p></o:p></p><p class=MsoNormal>2017.02.21 09:31:38 LOG5[0]: Service [hif] connected remote server from 127.0.0.1:34750<o:p></o:p></p><p class=MsoNormal>2017.02.21 09:31:38 LOG6[0]: SNI: sending servername: localhost<o:p></o:p></p><p class=MsoNormal>2017.02.21 09:31:38 LOG6[0]: Peer certificate not required<o:p></o:p></p><p class=MsoNormal>2017.02.21 09:31:38 LOG3[0]: SSL_connect: Peer suddenly disconnected<o:p></o:p></p><p class=MsoNormal>2017.02.21 09:31:38 LOG5[0]: Connection reset: 0 byte(s) sent to TLS, 0 byte(s) sent to socket<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><b>Server<o:p></o:p></b></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Accepts SSL connections on port 33343, connects to a non-secure service.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>stunnel stunnel.conf.1<o:p></o:p></p><p class=MsoNormal>2017.02.21 09:31:25 LOG5[ui]: stunnel 5.40 on powerpc-ibm-aix6.1.0.0 platform<o:p></o:p></p><p class=MsoNormal>2017.02.21 09:31:25 LOG5[ui]: Compiled/running with OpenSSL 1.0.2j 26 Sep 2016<o:p></o:p></p><p class=MsoNormal>2017.02.21 09:31:25 LOG5[ui]: Threading:PTHREAD Sockets:POLL,IPv6 TLS:ENGINE,FIPS,OCSP,PSK,SNI<o:p></o:p></p><p class=MsoNormal>2017.02.21 09:31:25 LOG5[ui]: Reading configuration from file /bmo/stunnel/bin/stunnel.conf.1<o:p></o:p></p><p class=MsoNormal>2017.02.21 09:31:25 LOG5[ui]: UTF-8 byte order mark detected<o:p></o:p></p><p class=MsoNormal>2017.02.21 09:31:25 LOG5[ui]: FIPS mode disabled<o:p></o:p></p><p class=MsoNormal>2017.02.21 09:31:25 LOG6[ui]: Initializing service [hif]<o:p></o:p></p><p class=MsoNormal>2017.02.21 09:31:25 LOG6[ui]: Loading certificate from file: /bmo/stunnel/stunnel.pem<o:p></o:p></p><p class=MsoNormal>2017.02.21 09:31:25 LOG6[ui]: Certificate loaded from file: /bmo/stunnel/stunnel.pem<o:p></o:p></p><p class=MsoNormal>2017.02.21 09:31:25 LOG6[ui]: Loading private key from file: /bmo/stunnel/stunnel.pem<o:p></o:p></p><p class=MsoNormal>2017.02.21 09:31:25 LOG4[ui]: Insecure file permissions on /bmo/stunnel/stunnel.pem<o:p></o:p></p><p class=MsoNormal>2017.02.21 09:31:25 LOG6[ui]: Private key loaded from file: /bmo/stunnel/stunnel.pem<o:p></o:p></p><p class=MsoNormal>2017.02.21 09:31:25 LOG5[ui]: Configuration successful<o:p></o:p></p><p class=MsoNormal>2017.02.21 09:31:38 LOG5[0]: Service [hif] accepted connection from 127.0.0.1:34750<o:p></o:p></p><p class=MsoNormal>2017.02.21 09:31:38 LOG6[0]: Peer certificate not required<o:p></o:p></p><p class=MsoNormal>INTERNAL ERROR: Bad magic at OpenSSL, line 0<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>(this is an abend – core file gets created).<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>log file exactly matches the standard output.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Any idea what’s going wrong here?<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>dbx of the core file:<o:p></o:p></p><p class=MsoNormal>tbs@netcbccadvwvr01 /bmo/hif/stunnel-5.40/src>dbx /bmo/stunnel/bin/stunnel core<o:p></o:p></p><p class=MsoNormal>Type 'help' for help.<o:p></o:p></p><p class=MsoNormal>[using memory image in core]<o:p></o:p></p><p class=MsoNormal>reading symbolic information ...<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>IOT/Abort trap in abort at 0xd01af1f8 ($t3)<o:p></o:p></p><p class=MsoNormal>0xd01af1f8 (abort+0xf8) 80410014 lwz r2,0x14(r1)<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>(dbx) where<o:p></o:p></p><p class=MsoNormal>abort() at 0xd01af1f8<o:p></o:p></p><p class=MsoNormal>fatal_debug(txt = "Bad magic", file = "OpenSSL", line = 0), line 359 in "log.c"<o:p></o:p></p><p class=MsoNormal>get_alloc_list_ptr(ptr = 0x2007e1c8, file = "OpenSSL", line = 0), line 399 in "str.c"<o:p></o:p></p><p class=MsoNormal>str_detach_debug(ptr = 0x2007e1c8, file = "OpenSSL", line = 0), line 348 in "str.c"<o:p></o:p></p><p class=MsoNormal>str_free_debug(ptr = 0x2007e1c8, file = "OpenSSL", line = 0), line 383 in "str.c"<o:p></o:p></p><p class=MsoNormal>free_function(ptr = 0x2007e1c8), line 191 in "tls.c"<o:p></o:p></p><p class=MsoNormal>mem.CRYPTO_free() at 0xd97dd8d8<o:p></o:p></p><p class=MsoNormal>bn_lib.bn_expand2@AF37_5() at 0xd97e8da4<o:p></o:p></p><p class=MsoNormal>bn_mont.BN_mod_mul_montgomery() at 0xd981e150<o:p></o:p></p><p class=MsoNormal>ecp_mont.ec_GFp_mont_field_mul() at 0xd9837a18<o:p></o:p></p><p class=MsoNormal>ecp_smpl.ec_GFp_simple_point_get_affine_coordinates() at 0xd9839890<o:p></o:p></p><p class=MsoNormal>ec_lib.EC_POINT_get_affine_coordinates_GFp() at 0xd9a81dfc<o:p></o:p></p><p class=MsoNormal>ecp_oct.ec_GFp_simple_point2oct() at 0xd9acc0d4<o:p></o:p></p><p class=MsoNormal>ec_oct.EC_POINT_point2oct() at 0xd9acb754<o:p></o:p></p><p class=MsoNormal>ssl3_send_server_key_exchange() at 0xd99e7c28<o:p></o:p></p><p class=MsoNormal>ssl3_accept() at 0xd99e9950<o:p></o:p></p><p class=MsoNormal>SSL_accept() at 0xd99c0b98<o:p></o:p></p><p class=MsoNormal>ssl23_get_client_hello() at 0xd9a003f4<o:p></o:p></p><p class=MsoNormal>ssl23_accept() at 0xd9a00c5c<o:p></o:p></p><p class=MsoNormal>SSL_accept() at 0xd99c0b98<o:p></o:p></p><p class=MsoNormal>ssl_start(c = 0x20084cb8), line 431 in "client.c"<o:p></o:p></p><p class=MsoNormal>client_try(c = 0x20084cb8), line 273 in "client.c"<o:p></o:p></p><p class=MsoNormal>client_run(c = 0x20084cb8), line 181 in "client.c"<o:p></o:p></p><p class=MsoNormal>client_main(c = 0x20084cb8), line 140 in "client.c"<o:p></o:p></p><p class=MsoNormal>client_thread(arg = 0x20084cb8), line 99 in "client.c"<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>(dbx) thread<o:p></o:p></p><p class=MsoNormal> thread state-k wchan state-u k-tid mode held scope function<o:p></o:p></p><p class=MsoNormal> $t1 run running 26279997 u no sys __fd_poll<o:p></o:p></p><p class=MsoNormal> $t2 run running 45088879 u no sys _p_nsleep<o:p></o:p></p><p class=MsoNormal>>$t3 run running 19070997 k no sys abort<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>(dbx) list free_function<o:p></o:p></p><p class=MsoNormal> 186<o:p></o:p></p><p class=MsoNormal> 187 #if OPENSSL_VERSION_NUMBER<0x10100000L<o:p></o:p></p><p class=MsoNormal> 188 NOEXPORT void free_function(void *ptr) {<o:p></o:p></p><p class=MsoNormal> 189 /* CRYPTO_set_mem_ex_functions() needs a function rather than a macro */<o:p></o:p></p><p class=MsoNormal> 190 /* unfortunately, OpenSSL provides no file:line information here */<o:p></o:p></p><p class=MsoNormal> 191 str_free_debug(ptr, "OpenSSL", 0);<o:p></o:p></p><p class=MsoNormal> 192 }<o:p></o:p></p><p class=MsoNormal> 193 #endif<o:p></o:p></p><p class=MsoNormal> 194<o:p></o:p></p><p class=MsoNormal> 195 /* end of tls.c */<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Should I be concerned that it looks like it is executing "free_function" from within an if statement "if OPENSSL_VERSION_NUMBER<0x1010000L but my openssl version is <o:p></o:p></p><p class=MsoNormal>2017.02.21 09:31:35 LOG5[ui]: Compiled/running with OpenSSL 1.0.2j 26 Sep 2016<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Troubleshooting so far:<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoListParagraph style='text-indent:-18.0pt;mso-list:l0 level1 lfo1'><![if !supportLists]><span style='mso-list:Ignore'>-<span style='font:7.0pt "Times New Roman"'> </span></span><![endif]>I had the same problem with earlier versions of openssl. <o:p></o:p></p><p class=MsoListParagraph style='text-indent:-18.0pt;mso-list:l0 level1 lfo1'><![if !supportLists]><span style='mso-list:Ignore'>-<span style='font:7.0pt "Times New Roman"'> </span></span><![endif]>I’ve tried this with 5.37 as well (based on Brian McGinity’s post from a few days ago), but get the same error.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span lang=EN-CA>Jacob<o:p></o:p></span></p></div></body></html>