osixia / docker-openldap

OpenLDAP container image 🐳🌴
MIT License
4.05k stars 977 forks source link

Problems using TLS outside the container #233

Closed enric1994 closed 6 years ago

enric1994 commented 6 years ago

I have an LDAP with the following setup:

docker run --name openldap --hostname openldap \
--volume /home/enric/Downloads/test_ca/server_certs/openldap:/container/service/slapd/assets/certs \
--env LDAP_TLS_CRT_FILENAME=openldap.crt \
--env LDAP_TLS_KEY_FILENAME=openldap.key \
--env LDAP_TLS_CA_CRT_FILENAME=root_CA.test.crt \
--detach -p 389:389 -p 636:636 osixia/openldap:1.2.1

I can correctly access ldap (from inside the container) using: docker exec openldap ldapsearch -x -H ldap://localhost:389 -ZZ -b dc=example,dc=org -D "cn=admin,dc=example,dc=org" -w admin -v -d -1

But when I try to access from outside, I get the following error:


$ ldapsearch -x -H ldap://localhost:389 -ZZ -b dc=example,dc=org -D "cn=admin,dc=example,dc=org" -w admin -v -d -1

OUTPUT:
$ ldapsearch -x -H ldap://localhost:389 -ZZ -b dc=example,dc=org -D "cn=admin,dc=example,dc=org" -w admin -v -d -1
ldap_url_parse_ext(ldap://localhost:389)
ldap_initialize( ldap://localhost:389/??base )
ldap_create
ldap_url_parse_ext(ldap://localhost:389/??base)
ldap_extended_operation_s
ldap_extended_operation
ldap_send_initial_request
ldap_new_connection 1 1 0
ldap_int_open_connection
ldap_connect_to_host: TCP localhost:389
ldap_new_socket: 3
ldap_prepare_socket: 3
ldap_connect_to_host: Trying 127.0.0.1:389
ldap_pvt_connect: fd: 3 tm: -1 async: 0
attempting to connect: 
connect success
ldap_open_defconn: successful
ldap_send_server_request
ber_scanf fmt ({it) ber:
ber_dump: buf=0x55c2f8f83c30 ptr=0x55c2f8f83c30 end=0x55c2f8f83c4f len=31
  0000:  30 1d 02 01 01 77 18 80  16 31 2e 33 2e 36 2e 31   0....w...1.3.6.1  
  0010:  2e 34 2e 31 2e 31 34 36  36 2e 32 30 30 33 37      .4.1.1466.20037   
ber_scanf fmt ({) ber:
ber_dump: buf=0x55c2f8f83c30 ptr=0x55c2f8f83c35 end=0x55c2f8f83c4f len=26
  0000:  77 18 80 16 31 2e 33 2e  36 2e 31 2e 34 2e 31 2e   w...1.3.6.1.4.1.  
  0010:  31 34 36 36 2e 32 30 30  33 37                     1466.20037        
ber_flush2: 31 bytes to sd 3
  0000:  30 1d 02 01 01 77 18 80  16 31 2e 33 2e 36 2e 31   0....w...1.3.6.1  
  0010:  2e 34 2e 31 2e 31 34 36  36 2e 32 30 30 33 37      .4.1.1466.20037   
ldap_write: want=31, written=31
  0000:  30 1d 02 01 01 77 18 80  16 31 2e 33 2e 36 2e 31   0....w...1.3.6.1  
  0010:  2e 34 2e 31 2e 31 34 36  36 2e 32 30 30 33 37      .4.1.1466.20037   
ldap_result ld 0x55c2f8f82cf0 msgid 1
wait4msg ld 0x55c2f8f82cf0 msgid 1 (infinite timeout)
wait4msg continue ld 0x55c2f8f82cf0 msgid 1 all 1
** ld 0x55c2f8f82cf0 Connections:
* host: localhost  port: 389  (default)
  refcnt: 2  status: Connected
  last used: Tue Jul 24 12:36:54 2018

** ld 0x55c2f8f82cf0 Outstanding Requests:
 * msgid 1,  origid 1, status InProgress
   outstanding referrals 0, parent count 0
  ld 0x55c2f8f82cf0 request count 1 (abandoned 0)
** ld 0x55c2f8f82cf0 Response Queue:
   Empty
  ld 0x55c2f8f82cf0 response count 0
ldap_chkResponseList ld 0x55c2f8f82cf0 msgid 1 all 1
ldap_chkResponseList returns ld 0x55c2f8f82cf0 NULL
ldap_int_select
read1msg: ld 0x55c2f8f82cf0 msgid 1 all 1
ber_get_next
ldap_read: want=8, got=8
  0000:  30 0c 02 01 01 78 07 0a                            0....x..          
ldap_read: want=6, got=6
  0000:  01 00 04 00 04 00                                  ......            
ber_get_next: tag 0x30 len 12 contents:
ber_dump: buf=0x55c2f8f65450 ptr=0x55c2f8f65450 end=0x55c2f8f6545c len=12
  0000:  02 01 01 78 07 0a 01 00  04 00 04 00               ...x........      
read1msg: ld 0x55c2f8f82cf0 msgid 1 message type extended-result
ber_scanf fmt ({eAA) ber:
ber_dump: buf=0x55c2f8f65450 ptr=0x55c2f8f65453 end=0x55c2f8f6545c len=9
  0000:  78 07 0a 01 00 04 00 04  00                        x........         
read1msg: ld 0x55c2f8f82cf0 0 new referrals
read1msg:  mark request completed, ld 0x55c2f8f82cf0 msgid 1
request done: ld 0x55c2f8f82cf0 msgid 1
res_errno: 0, res_error: <>, res_matched: <>
ldap_free_request (origid 1, msgid 1)
ldap_parse_extended_result
ber_scanf fmt ({eAA) ber:
ber_dump: buf=0x55c2f8f65450 ptr=0x55c2f8f65453 end=0x55c2f8f6545c len=9
  0000:  78 07 0a 01 00 04 00 04  00                        x........         
ldap_parse_result
ber_scanf fmt ({iAA) ber:
ber_dump: buf=0x55c2f8f65450 ptr=0x55c2f8f65453 end=0x55c2f8f6545c len=9
  0000:  78 07 0a 01 00 04 00 04  00                        x........         
ber_scanf fmt (}) ber:
ber_dump: buf=0x55c2f8f65450 ptr=0x55c2f8f6545c end=0x55c2f8f6545c len=0

ldap_msgfree
tls_write: want=238, written=238
  0000:  16 03 01 00 e9 01 00 00  e5 03 03 5b 57 01 e6 69   ...........[W..i  
  0010:  b5 b3 b0 0a 79 72 b3 34  e8 4d 5a 75 56 09 24 f6   ....yr.4.MZuV.$.  
  0020:  85 af e4 a6 e2 98 3b 76  27 59 23 00 00 72 c0 2c   ......;v'Y#..r.,  
  0030:  c0 87 cc a9 c0 ad c0 0a  c0 24 c0 73 c0 2b c0 86   .........$.s.+..  
  0040:  c0 ac c0 09 c0 23 c0 72  c0 08 c0 30 c0 8b cc a8   .....#.r...0....  
  0050:  c0 14 c0 28 c0 77 c0 2f  c0 8a c0 13 c0 27 c0 76   ...(.w./.....'.v  
  0060:  c0 12 00 9d c0 7b c0 9d  00 35 00 3d 00 84 00 c0   .....{...5.=....  
  0070:  00 9c c0 7a c0 9c 00 2f  00 3c 00 41 00 ba 00 0a   ...z.../.<.A....  
  0080:  00 9f c0 7d cc aa c0 9f  00 39 00 6b 00 88 00 c4   ...}.....9.k....  
  0090:  00 9e c0 7c c0 9e 00 33  00 67 00 45 00 be 00 16   ...|...3.g.E....  
  00a0:  01 00 00 4a 00 17 00 00  00 16 00 00 00 05 00 05   ...J............  
  00b0:  01 00 00 00 00 ff 01 00  01 00 00 23 00 00 00 0a   ...........#....  
  00c0:  00 0c 00 0a 00 17 00 18  00 19 00 15 00 13 00 0b   ................  
  00d0:  00 02 01 00 00 0d 00 16  00 14 04 01 04 03 05 01   ................  
  00e0:  05 03 06 01 06 03 03 01  03 03 02 01 02 03         ..............    
tls_read: want=5, got=5
  0000:  16 03 03 00 5b                                     ....[             
tls_read: want=91, got=91
  0000:  02 00 00 57 03 03 5b 57  01 26 53 38 4d f3 fd 03   ...W..[W.&S8M...  
  0010:  38 f9 00 c9 63 64 93 67  11 b4 67 e3 89 a6 2d 61   8...cd.g..g...-a  
  0020:  d2 67 63 43 98 79 20 3c  6e 85 7f 5f 1a 65 a9 1f   .gcC.y <n.._.e..  
  0030:  33 5f 75 83 e7 d6 83 40  32 56 28 37 d9 4e 2d 16   3_u....@2V(7.N-.  
  0040:  cf fd 5f ef 3b 04 1e c0  30 00 00 0f 00 17 00 00   .._.;...0.......  
  0050:  ff 01 00 01 00 00 0b 00  02 01 00                  ...........       
tls_read: want=5, got=5
  0000:  16 03 03 0d 5d                                     ....]             
tls_read: want=3421, got=3421
  0000:  0b 00 0d 59 00 0d 56 00  06 5d 30 82 06 59 30 82   ...Y..V..]0..Y0.  
  0010:  04 41 a0 03 02 01 02 02  09 00 d8 0f 4e 17 ad 2e   .A..........N...  
  0020:  c6 93 30 0d 06 09 2a 86  48 86 f7 0d 01 01 0b 05   ..0...*.H.......  
  0030:  00 30 81 a4 31 0b 30 09  06 03 55 04 06 13 02 45   .0..1.0...U....E  
  0040:  53 31 12 30 10 06 03 55  04 08 0c 09 42 61 72 63   S1.0...U....Barc  
  0050:  65 6c 6f 6e 61 31 13 30  11 06 03 55 04 07 0c 0a   elona1.0...U....  
  0060:  42 65 6c 6c 61 74 65 72  72 61 31 1d 30 1b 06 03   Bellaterra1.0...  
  0070:  55 04 0a 0c 14 41 70 70  6c 75 73 2b 20 4c 61 62   U....Applus+ Lab  
  0080:  6f 72 61 74 6f 72 69 65  73 31 0f 30 0d 06 03 55   oratories1.0...U  
  0090:  04 0b 0c 06 49 54 4c 61  62 73 31 15 30 13 06 03   ....ITLabs1.0...  
  00a0:  55 04 03 0c 0c 72 6f 6f  74 5f 43 41 2e 74 65 73   U....root_CA.tes  
  00b0:  74 31 25 30 23 06 09 2a  86 48 86 f7 0d 01 09 01   t1%0#..*.H......  
  00c0:  16 16 65 6e 72 69 63 2e  6d 6f 72 65 75 40 61 70   ..enric.moreu@ap  
  00d0:  70 6c 75 73 2e 63 6f 6d  30 1e 17 0d 31 38 30 37   plus.com0...1807  
  00e0:  32 33 31 32 34 30 30 31  5a 17 0d 32 38 30 37 32   23124001Z..28072  
  00f0:  30 31 32 34 30 30 31 5a  30 81 98 31 0b 30 09 06   0124001Z0..1.0..  
  0100:  03 55 04 06 13 02 45 53  31 12 30 10 06 03 55 04   .U....ES1.0...U.  
  0110:  08 0c 09 42 61 72 63 65  6c 6f 6e 61 31 13 30 11   ...Barcelona1.0.  
  0120:  06 03 55 04 07 0c 0a 42  65 6c 6c 61 74 65 72 72   ..U....Bellaterr  
  0130:  61 31 1d 30 1b 06 03 55  04 0a 0c 14 41 70 70 6c   a1.0...U....Appl  
  0140:  75 73 2b 20 4c 61 62 6f  72 61 74 6f 72 69 65 73   us+ Laboratories  
  0150:  31 0f 30 0d 06 03 55 04  0b 0c 06 49 54 4c 61 62   1.0...U....ITLab  
  0160:  73 31 11 30 0f 06 03 55  04 03 0c 08 6f 70 65 6e   s1.0...U....open  
  0170:  6c 64 61 70 31 1d 30 1b  06 09 2a 86 48 86 f7 0d   ldap1.0...*.H...  
  0180:  01 09 01 16 0e 65 6e 72  69 63 40 6a 61 6a 61 2e   .....enric@jaja.  
  0190:  63 6f 6d 30 82 01 22 30  0d 06 09 2a 86 48 86 f7   com0.."0...*.H..  
  01a0:  0d 01 01 01 05 00 03 82  01 0f 00 30 82 01 0a 02   ...........0....  
  01b0:  82 01 01 00 af 01 61 58  e2 9a c0 34 de 21 52 f0   ......aX...4.!R.  
  01c0:  96 69 66 30 9b 5e ef e5  af 0f a9 97 8b ee 14 16   .if0.^..........  
  01d0:  f9 fa 25 08 ee ce a1 c0  50 90 2c 67 a5 9d af d1   ..%.....P.,g....  
  01e0:  62 cd 32 f4 fd 62 7f 51  0e 76 9b 37 81 eb bf ff   b.2..b.Q.v.7....  
  01f0:  77 2e 8b ad 9b dc c5 2d  f8 89 8a 0d 46 16 82 bb   w......-....F...  
  0200:  f2 16 44 04 01 b1 63 6d  41 12 3a 3e c6 86 3c 8c   ..D...cmA.:>..<.  
  0210:  97 98 6b fa e0 ee 80 67  b8 f3 33 1a f8 34 99 90   ..k....g..3..4..  
  0220:  8c bb dc 39 73 ef 87 23  10 4f 80 2b aa a0 a9 2f   ...9s..#.O.+.../  
  0230:  93 97 87 99 42 da 58 9d  47 9b 99 fd 04 22 6f 0b   ....B.X.G...."o.  
  0240:  c0 9f 50 bd 38 1c ee 93  84 de ad 3d dc 6a b2 5e   ..P.8......=.j.^  
  0250:  65 8c 43 e4 36 2c 10 46  52 d1 6f 68 b0 97 06 f2   e.C.6,.FR.oh....  
  0260:  4e 08 54 2f 4b 8c 9c df  62 e5 98 6c 51 37 83 c9   N.T/K...b..lQ7..  
  0270:  77 4a 1a 7a 1b 9e 48 63  17 08 7f d4 04 ce 58 66   wJ.z..Hc......Xf  
  0280:  ef d9 37 3d 9c 1c 6b dd  fe f1 25 85 1a 63 3f 0e   ..7=..k...%..c?.  
  0290:  11 ea e9 c6 ee 56 f6 5a  79 33 32 18 76 57 c0 2b   .....V.Zy32.vW.+  
  02a0:  a6 fa 70 9f eb 24 34 14  8c 64 4d cf 10 a9 7b b8   ..p..$4..dM...{.  
  02b0:  a0 1f 57 0d 02 03 01 00  01 a3 82 01 96 30 82 01   ..W..........0..  
  02c0:  92 30 09 06 03 55 1d 13  04 02 30 00 30 11 06 09   .0...U....0.0...  
  02d0:  60 86 48 01 86 f8 42 01  01 04 04 03 02 06 c0 30   `.H...B........0  
  02e0:  33 06 09 60 86 48 01 86  f8 42 01 0d 04 26 16 24   3..`.H...B...&.$  
  02f0:  4f 70 65 6e 53 53 4c 20  47 65 6e 65 72 61 74 65   OpenSSL Generate  
  0300:  64 20 53 65 72 76 65 72  20 43 65 72 74 69 66 69   d Server Certifi  
  0310:  63 61 74 65 30 1d 06 03  55 1d 0e 04 16 04 14 5d   cate0...U......]  
  0320:  69 95 77 98 aa 94 31 ac  26 d9 97 78 12 e6 ba 06   i.w...1.&..x....  
  0330:  c4 49 54 30 81 d9 06 03  55 1d 23 04 81 d1 30 81   .IT0....U.#...0.  
  0340:  ce 80 14 0f d5 2d 1c e9  b7 84 c4 53 80 db 58 3f   .....-.....S..X?  
  0350:  06 25 a7 cb 37 45 cd a1  81 aa a4 81 a7 30 81 a4   .%..7E.......0..  
  0360:  31 0b 30 09 06 03 55 04  06 13 02 45 53 31 12 30   1.0...U....ES1.0  
  0370:  10 06 03 55 04 08 0c 09  42 61 72 63 65 6c 6f 6e   ...U....Barcelon  
  0380:  61 31 13 30 11 06 03 55  04 07 0c 0a 42 65 6c 6c   a1.0...U....Bell  
  0390:  61 74 65 72 72 61 31 1d  30 1b 06 03 55 04 0a 0c   aterra1.0...U...  
  03a0:  14 41 70 70 6c 75 73 2b  20 4c 61 62 6f 72 61 74   .Applus+ Laborat  
  03b0:  6f 72 69 65 73 31 0f 30  0d 06 03 55 04 0b 0c 06   ories1.0...U....  
  03c0:  49 54 4c 61 62 73 31 15  30 13 06 03 55 04 03 0c   ITLabs1.0...U...  
  03d0:  0c 72 6f 6f 74 5f 43 41  2e 74 65 73 74 31 25 30   .root_CA.test1%0  
  03e0:  23 06 09 2a 86 48 86 f7  0d 01 09 01 16 16 65 6e   #..*.H........en  
  03f0:  72 69 63 2e 6d 6f 72 65  75 40 61 70 70 6c 75 73   ric.moreu@applus  
  0400:  2e 63 6f 6d 82 09 00 d8  0f 4e 17 ad 2e c6 90 30   .com.....N.....0  
  0410:  0e 06 03 55 1d 0f 01 01  ff 04 04 03 02 05 a0 30   ...U...........0  
  0420:  1d 06 03 55 1d 25 04 16  30 14 06 08 2b 06 01 05   ...U.%..0...+...  
  0430:  05 07 03 01 06 08 2b 06  01 05 05 07 03 02 30 13   ......+.......0.  
  0440:  06 03 55 1d 11 04 0c 30  0a 82 08 6f 70 65 6e 6c   ..U....0...openl  
  0450:  64 61 70 30 0d 06 09 2a  86 48 86 f7 0d 01 01 0b   dap0...*.H......  
  0460:  05 00 03 82 02 01 00 dc  3d 3e b0 3b b3 d3 9e cb   ........=>.;....  
  0470:  be 89 9c 63 86 03 83 0d  01 47 84 0e 3f 1f 38 33   ...c.....G..?.83  
  0480:  9f 5e 75 5b 59 f1 c8 d7  a9 87 81 83 2e b6 f6 e2   .^u[Y...........  
  0490:  e9 cd 20 e9 dd 31 c2 b7  3d ba 28 01 23 fa 2f 24   .. ..1..=.(.#./$  
  04a0:  65 18 79 dc 6f 73 a0 80  87 46 4c 20 60 af 4b af   e.y.os...FL `.K.  
  04b0:  d8 5f ae ef c1 43 90 fd  a2 ef 5b cb 4f 60 2b c8   ._...C....[.O`+.  
  04c0:  3b fc b5 a2 cf 12 5a 91  ff e7 7e ad 98 3a 7e 51   ;.....Z...~..:~Q  
  04d0:  92 14 a4 b9 4c d5 b7 e0  c9 b3 3e 38 af 1d ae fd   ....L.....>8....  
  04e0:  d8 44 ed 4c de c7 13 3c  6d c3 4a af 56 00 82 6e   .D.L...<m.J.V..n  
  04f0:  ca a4 f9 57 55 60 30 ce  4d 78 d1 31 5a 6b a2 4b   ...WU`0.Mx.1Zk.K  
  0500:  c6 32 81 05 2e 98 dd 42  73 d6 84 5d 7f 58 7a e3   .2.....Bs..].Xz.  
  0510:  6f 18 d1 81 31 19 28 a0  09 13 da 8f 70 db 33 01   o...1.(.....p.3.  
  0520:  95 53 d6 53 02 45 e7 bb  3f 70 1e 52 f1 53 fe bd   .S.S.E..?p.R.S..  
  0530:  5d 5d e4 56 87 b2 d8 d2  bf 19 96 61 69 b1 8f 65   ]].V.......ai..e  
  0540:  40 55 0c 94 d9 a9 d4 98  08 72 1d 11 95 63 b5 09   @U.......r...c..  
  0550:  a8 65 b2 4c 40 ce 16 5f  1a 74 8d 11 0d 6e d5 b2   .e.L@.._.t...n..  
  0560:  78 02 8f 9a 09 2e 4b 68  14 3c c1 98 be c8 cb dd   x.....Kh.<......  
  0570:  6a 24 83 04 38 57 c6 88  9f 0b 1d 98 af 16 88 87   j$..8W..........  
  0580:  fc 78 be 03 4d af b9 ea  36 74 1b a4 84 05 e8 50   .x..M...6t.....P  
  0590:  5c 92 06 d4 57 19 c0 5f  f6 a8 d4 75 b0 0e 94 bb   \...W.._...u....  
  05a0:  14 07 99 d7 99 53 4f 06  d5 60 54 5a 55 4f 0f 36   .....SO..`TZUO.6  
  05b0:  3b 52 7c bb 52 e4 eb dc  6a 25 2d 78 00 21 e0 7f   ;R|.R...j%-x.!..  
  05c0:  79 2d ff 8c e9 f6 25 35  3d d2 fa 9b 02 ff 2e ac   y-....%5=.......  
  05d0:  c1 7f 94 e1 30 c0 d6 c0  0f 26 42 67 22 6e 10 06   ....0....&Bg"n..  
  05e0:  9c 26 e7 85 05 10 0d 4c  08 8b d2 ec f2 16 35 2f   .&.....L......5/  
  05f0:  d9 ca f8 40 85 f9 66 9d  6f ff e2 be 70 ed c0 1b   ...@..f.o...p...  
  0600:  d8 96 64 6d 77 23 68 e3  1d d6 9e 88 22 87 b6 c3   ..dmw#h....."...  
  0610:  7b 1f c8 12 10 56 2a 5c  b1 0b 86 1a 65 88 8a 1a   {....V*\....e...  
  0620:  1e e9 fe 4a 00 16 02 61  a5 c6 20 22 9b 29 c6 cd   ...J...a.. ".)..  
  0630:  87 3b d5 66 af de 8d d9  12 0d c5 45 4f 1c a0 6c   .;.f.......EO..l  
  0640:  25 34 80 c7 d1 fb 37 04  13 95 67 22 3e b8 4f ff   %4....7...g">.O.  
  0650:  d9 b7 ca 24 21 91 c6 a0  41 d1 d9 d2 3f 69 21 c7   ...$!...A...?i!.  
  0660:  98 0e 45 b8 7a 3d e5 00  06 f3 30 82 06 ef 30 82   ..E.z=....0...0.  
  0670:  04 d7 a0 03 02 01 02 02  09 00 d8 0f 4e 17 ad 2e   ............N...  
  0680:  c6 90 30 0d 06 09 2a 86  48 86 f7 0d 01 01 0b 05   ..0...*.H.......  
  0690:  00 30 81 a4 31 0b 30 09  06 03 55 04 06 13 02 45   .0..1.0...U....E  
  06a0:  53 31 12 30 10 06 03 55  04 08 0c 09 42 61 72 63   S1.0...U....Barc  
  06b0:  65 6c 6f 6e 61 31 13 30  11 06 03 55 04 07 0c 0a   elona1.0...U....  
  06c0:  42 65 6c 6c 61 74 65 72  72 61 31 1d 30 1b 06 03   Bellaterra1.0...  
  06d0:  55 04 0a 0c 14 41 70 70  6c 75 73 2b 20 4c 61 62   U....Applus+ Lab  
  06e0:  6f 72 61 74 6f 72 69 65  73 31 0f 30 0d 06 03 55   oratories1.0...U  
  06f0:  04 0b 0c 06 49 54 4c 61  62 73 31 15 30 13 06 03   ....ITLabs1.0...  
  0700:  55 04 03 0c 0c 72 6f 6f  74 5f 43 41 2e 74 65 73   U....root_CA.tes  
  0710:  74 31 25 30 23 06 09 2a  86 48 86 f7 0d 01 09 01   t1%0#..*.H......  
  0720:  16 16 65 6e 72 69 63 2e  6d 6f 72 65 75 40 61 70   ..enric.moreu@ap  
  0730:  70 6c 75 73 2e 63 6f 6d  30 1e 17 0d 31 38 30 36   plus.com0...1806  
  0740:  31 39 30 38 32 36 32 37  5a 17 0d 32 38 30 36 31   19082627Z..28061  
  0750:  36 30 38 32 36 32 37 5a  30 81 a4 31 0b 30 09 06   6082627Z0..1.0..  
  0760:  03 55 04 06 13 02 45 53  31 12 30 10 06 03 55 04   .U....ES1.0...U.  
  0770:  08 0c 09 42 61 72 63 65  6c 6f 6e 61 31 13 30 11   ...Barcelona1.0.  
  0780:  06 03 55 04 07 0c 0a 42  65 6c 6c 61 74 65 72 72   ..U....Bellaterr  
  0790:  61 31 1d 30 1b 06 03 55  04 0a 0c 14 41 70 70 6c   a1.0...U....Appl  
  07a0:  75 73 2b 20 4c 61 62 6f  72 61 74 6f 72 69 65 73   us+ Laboratories  
  07b0:  31 0f 30 0d 06 03 55 04  0b 0c 06 49 54 4c 61 62   1.0...U....ITLab  
  07c0:  73 31 15 30 13 06 03 55  04 03 0c 0c 72 6f 6f 74   s1.0...U....root  
  07d0:  5f 43 41 2e 74 65 73 74  31 25 30 23 06 09 2a 86   _CA.test1%0#..*.  
  07e0:  48 86 f7 0d 01 09 01 16  16 65 6e 72 69 63 2e 6d   H........enric.m  
  07f0:  6f 72 65 75 40 61 70 70  6c 75 73 2e 63 6f 6d 30   oreu@applus.com0  
  0800:  82 02 22 30 0d 06 09 2a  86 48 86 f7 0d 01 01 01   .."0...*.H......  
  0810:  05 00 03 82 02 0f 00 30  82 02 0a 02 82 02 01 00   .......0........  
  0820:  e2 1a d4 8b 50 ea ae 75  13 9c 14 5c 7a 8d 43 57   ....P..u...\z.CW  
  0830:  c0 2c 5e c0 e8 eb 9c b3  1f f8 45 79 8c d6 49 2c   .,^.......Ey..I,  
  0840:  12 26 19 3e 57 9a cd 88  84 69 59 93 f4 47 a8 a8   .&.>W....iY..G..  
  0850:  71 1e 66 1b 5c 51 3c e7  3f 95 3f 0e 59 ff 3c 33   q.f.\Q<.?.?.Y.<3  
  0860:  da b7 6f 74 b5 fb 9d 6a  b6 64 b2 ad dc 6e f0 f8   ..ot...j.d...n..  
  0870:  71 32 38 6c f2 f6 08 15  e9 67 ac f6 18 61 5d e5   q28l.....g...a].  
  0880:  19 58 a2 eb 0e a2 ac 1b  be 70 5b 62 2c 61 fc 05   .X.......p[b,a..  
  0890:  19 a3 58 38 ab 84 dc 2b  16 20 f6 17 6b e5 c1 a9   ..X8...+. ..k...  
  08a0:  c2 77 39 c5 7e 80 d9 7d  a6 de 0a 24 6b b7 d8 0c   .w9.~..}...$k...  
  08b0:  da 7f 74 27 33 28 a1 d1  2f 10 c1 14 36 f2 9d 53   ..t'3(../...6..S  
  08c0:  49 1f b9 28 e5 eb e6 78  76 49 1b 46 24 79 7d 52   I..(...xvI.F$y}R  
  08d0:  aa 65 4a ee e9 b0 8d 8f  ca c9 b3 a2 00 f0 66 a7   .eJ...........f.  
  08e0:  a7 b0 ed f0 4b c3 24 df  96 40 84 ce 58 f4 c0 c3   ....K.$..@..X...  
  08f0:  31 56 7b e5 32 b2 33 92  53 5b 1f 8d e2 b6 a2 42   1V{.2.3.S[.....B  
  0900:  ee 48 36 27 5f ff ad 10  85 7a 55 4b 94 5d 6d 00   .H6'_....zUK.]m.  
  0910:  a5 54 2e f3 0f a3 1a 15  84 95 dd 4e dd 64 eb 95   .T.........N.d..  
  0920:  31 ac e9 7c ce fb 22 c0  1f 3c 47 33 64 4a b1 c4   1..|.."..<G3dJ..  
  0930:  a5 ae fa be d1 c4 8b 8f  14 e8 22 61 25 95 9d b0   .........."a%...  
  0940:  0e bd a7 d9 0c ec 77 0f  f1 61 cf 7e bc 13 21 ed   ......w..a.~..!.  
  0950:  68 c6 9b 3c a4 23 68 88  ed c4 d7 a3 4a 4a be 61   h..<.#h.....JJ.a  
  0960:  94 1c ae 90 1d 30 8d 49  c6 be c0 1d ef cb 8e 2a   .....0.I.......*  
  0970:  cb 82 63 22 6d 54 98 c5  c0 2c 88 48 9d cd 33 c1   ..c"mT...,.H..3.  
  0980:  90 6c cd c0 73 fc cc 51  59 52 73 d8 7c f9 c4 f5   .l..s..QYRs.|...  
  0990:  c3 22 98 78 0a 40 87 22  61 63 e3 56 d9 23 2f b4   .".x.@."ac.V.#/.  
  09a0:  94 0a 2c 3e 8e e9 d3 90  ac da 8d 5d 68 59 d4 ca   ..,>.......]hY..  
  09b0:  6b aa 30 de 73 89 02 49  1d 4c 70 3b a8 88 eb a8   k.0.s..I.Lp;....  
  09c0:  50 32 27 02 66 f1 c4 f6  62 7e 09 34 75 f6 dd 06   P2'.f...b~.4u...  
  09d0:  f8 79 bc ce 07 d8 ff ea  45 df 17 09 28 02 b3 02   .y......E...(...  
  09e0:  28 5d ad ab c3 82 e1 7b  94 cc 8b 93 2c 2a 4c 4a   (].....{....,*LJ  
  09f0:  d9 f7 2f d8 be b9 53 23  e1 28 9f f4 ce 7f f1 a7   ../...S#.(......  
  0a00:  c9 d1 05 1b 09 08 da 01  68 37 54 00 13 14 d2 ec   ........h7T.....  
  0a10:  53 2a 06 13 b6 14 e5 d6  e0 a4 5a e8 89 d7 bb f7   S*........Z.....  
  0a20:  02 03 01 00 01 a3 82 01  20 30 82 01 1c 30 1d 06   ........ 0...0..  
  0a30:  03 55 1d 0e 04 16 04 14  0f d5 2d 1c e9 b7 84 c4   .U........-.....  
  0a40:  53 80 db 58 3f 06 25 a7  cb 37 45 cd 30 81 d9 06   S..X?.%..7E.0...  
  0a50:  03 55 1d 23 04 81 d1 30  81 ce 80 14 0f d5 2d 1c   .U.#...0......-.  
  0a60:  e9 b7 84 c4 53 80 db 58  3f 06 25 a7 cb 37 45 cd   ....S..X?.%..7E.  
  0a70:  a1 81 aa a4 81 a7 30 81  a4 31 0b 30 09 06 03 55   ......0..1.0...U  
  0a80:  04 06 13 02 45 53 31 12  30 10 06 03 55 04 08 0c   ....ES1.0...U...  
  0a90:  09 42 61 72 63 65 6c 6f  6e 61 31 13 30 11 06 03   .Barcelona1.0...  
  0aa0:  55 04 07 0c 0a 42 65 6c  6c 61 74 65 72 72 61 31   U....Bellaterra1  
  0ab0:  1d 30 1b 06 03 55 04 0a  0c 14 41 70 70 6c 75 73   .0...U....Applus  
  0ac0:  2b 20 4c 61 62 6f 72 61  74 6f 72 69 65 73 31 0f   + Laboratories1.  
  0ad0:  30 0d 06 03 55 04 0b 0c  06 49 54 4c 61 62 73 31   0...U....ITLabs1  
  0ae0:  15 30 13 06 03 55 04 03  0c 0c 72 6f 6f 74 5f 43   .0...U....root_C  
  0af0:  41 2e 74 65 73 74 31 25  30 23 06 09 2a 86 48 86   A.test1%0#..*.H.  
  0b00:  f7 0d 01 09 01 16 16 65  6e 72 69 63 2e 6d 6f 72   .......enric.mor  
  0b10:  65 75 40 61 70 70 6c 75  73 2e 63 6f 6d 82 09 00   eu@applus.com...  
  0b20:  d8 0f 4e 17 ad 2e c6 90  30 0f 06 03 55 1d 13 01   ..N.....0...U...  
  0b30:  01 ff 04 05 30 03 01 01  ff 30 0e 06 03 55 1d 0f   ....0....0...U..  
  0b40:  01 01 ff 04 04 03 02 01  86 30 0d 06 09 2a 86 48   .........0...*.H  
  0b50:  86 f7 0d 01 01 0b 05 00  03 82 02 01 00 31 64 dd   .............1d.  
  0b60:  85 d5 61 6c d5 00 c4 06  c9 45 1f 9c 89 6c 80 36   ..al.....E...l.6  
  0b70:  a3 db be ca 25 03 a2 21  6e de 9c 72 48 32 c6 7c   ....%..!n..rH2.|  
  0b80:  4d d1 b5 28 92 12 a4 a6  fb 1e 53 da b0 2e eb 6a   M..(......S....j  
  0b90:  3f c2 06 e6 43 b0 cc 56  ed 18 41 9c 3a c4 67 ea   ?...C..V..A.:.g.  
  0ba0:  ea f8 c0 a2 85 b9 3f c8  62 5b 8d a8 c1 a6 82 b8   ......?.b[......  
  0bb0:  63 75 62 f4 46 7a 11 05  ec 7b 98 83 9c 1b 20 a7   cub.Fz...{.... .  
  0bc0:  41 17 0a 1b 1d d6 d0 e1  de e7 63 57 4b 9c b5 32   A.........cWK..2  
  0bd0:  2f e1 e9 18 5a 89 5c cc  0d 51 c8 18 c5 76 ec 8f   /...Z.\..Q...v..  
  0be0:  95 c5 1f f0 a2 dc e2 62  c0 fc f9 52 36 78 a1 c3   .......b...R6x..  
  0bf0:  2c 8e 6c 37 37 68 c6 26  02 65 1c 24 15 67 c1 0b   ,.l77h.&.e.$.g..  
  0c00:  d9 e7 5d 41 a1 fe cd 6d  c8 a2 91 87 48 f6 e2 df   ..]A...m....H...  
  0c10:  48 76 35 d1 82 80 92 23  fc 02 b4 85 ac 37 1c f5   Hv5....#.....7..  
  0c20:  3d c5 80 d7 3e 6d 39 73  19 6f 97 0a ec 6a 6a 0d   =...>m9s.o...jj.  
  0c30:  0c 4a 9f b8 d5 2d ac bc  30 8c 6e 60 55 51 59 24   .J...-..0.n`UQY$  
  0c40:  20 66 3c 8f 28 67 70 fd  19 48 65 4d 98 46 31 99    f<.(gp..HeM.F1.  
  0c50:  3a 4c f6 ed 86 e6 25 5a  24 37 69 1f 56 b3 d6 b3   :L....%Z$7i.V...  
  0c60:  4f 46 ad 77 15 03 2e d3  2e dd e8 8b 51 a3 ea c1   OF.w........Q...  
  0c70:  49 11 f4 e4 03 5b f0 2b  b4 d8 99 7f b9 7d e2 cb   I....[.+.....}..  
  0c80:  b9 ce bd 13 6d be 82 a6  d8 a6 5d f0 3e 5f c3 3a   ....m.....].>_.:  
  0c90:  94 f6 e3 b3 ab 3c 60 70  3b 8c b7 3a d6 36 42 ad   .....<`p;..:.6B.  
  0ca0:  fd ad ff ed 9c 1d f2 f1  b1 df fb ef 0e 8e 26 29   ..............&)  
  0cb0:  92 3d 85 49 89 60 70 89  2e 88 ed c4 25 02 31 38   .=.I.`p.....%.18  
  0cc0:  34 aa fb 09 dc 6c 85 60  db 5a a3 40 b8 93 34 79   4....l.`.Z.@..4y  
  0cd0:  37 cc 33 cf 57 fa 62 31  ef e1 e6 41 80 70 3e a4   7.3.W.b1...A.p>.  
  0ce0:  75 a6 58 7a b9 0e 8b 7c  3a 34 bf e7 da ad 23 9a   u.Xz...|:4....#.  
  0cf0:  6b 98 6e 8f 9e 01 4b c2  6d fc 9a 39 5a 59 14 c2   k.n...K.m..9ZY..  
  0d00:  df b4 53 4a a3 2e f9 92  28 c6 53 5b 86 1c e3 d8   ..SJ....(.S[....  
  0d10:  df 10 31 6d b3 e1 1f 03  25 65 09 52 39 46 57 f6   ..1m....%e.R9FW.  
  0d20:  90 69 3b 60 ab 66 48 2f  9e 86 9c 7a dd 6c 58 1c   .i;`.fH/...z.lX.  
  0d30:  74 2e 79 be e4 5f 4a f8  90 5d 4e 50 41 35 ec 56   t.y.._J..]NPA5.V  
  0d40:  e1 c1 bf be df 6b a8 a0  01 2e 81 f2 c3 55 12 10   .....k.......U..  
  0d50:  67 9a ab b9 b8 2a 60 df  08 8b ff d9 6b            g....*`.....k     
tls_read: want=5, got=5
  0000:  16 03 03 01 4d                                     ....M             
tls_read: want=333, got=333
  0000:  0c 00 01 49 03 00 17 41  04 d6 25 36 dd 6e 27 f0   ...I...A..%6.n'.  
  0010:  22 ff 1b 1d 5f 73 b9 9e  b5 32 d5 05 28 af 34 07   "..._s...2..(.4.  
  0020:  d7 66 ee af 07 7d a7 6e  df c0 42 b0 cb d1 6d 42   .f...}.n..B...mB  
  0030:  74 6f 45 39 53 45 c8 e6  88 d7 fa a2 99 af 1b c4   toE9SE..........  
  0040:  08 41 3c b5 49 3a b0 2e  6f 04 01 01 00 5e 41 5f   .A<.I:..o....^A_  
  0050:  a5 0e 46 a1 30 40 41 7f  21 e0 83 5d 21 4e fa 07   ..F.0@A.!..]!N..  
  0060:  35 15 0e ef 20 e3 37 bf  96 31 d0 97 ab 29 0c fe   5... .7..1...)..  
  0070:  e5 a2 6f 30 18 c0 7b dc  f4 30 cb 98 8a d6 14 c0   ..o0..{..0......  
  0080:  c7 af 3b 77 36 25 7a 92  4a 44 ce 5c 55 9c 7e 2e   ..;w6%z.JD.\U.~.  
  0090:  46 10 c8 e9 ee ff 55 f2  ab 01 19 2a 8d df 2a bb   F.....U....*..*.  
  00a0:  43 3d 13 0e ad 34 f9 5e  38 ac 27 61 e9 6f c7 7f   C=...4.^8.'a.o..  
  00b0:  e2 f0 b1 78 1b 9f c6 98  6c a0 37 3d 44 b6 08 6c   ...x....l.7=D..l  
  00c0:  2c 53 b6 4e a8 e7 41 09  0b 8e 72 a3 3d 7e e5 13   ,S.N..A...r.=~..  
  00d0:  3f a3 90 e6 9e 59 79 b3  c6 ab 93 cf f5 02 9a 77   ?....Yy........w  
  00e0:  1e 09 01 05 07 ef 67 fb  b4 54 f3 9b 47 24 3e b2   ......g..T..G$>.  
  00f0:  33 ee 66 bd 1c 71 d6 4a  4c 1d b0 39 89 0a 9a ab   3.f..q.JL..9....  
  0100:  0a 6e b1 03 a9 a3 c0 5e  b8 07 40 62 d8 c0 b9 4f   .n.....^..@b...O  
  0110:  9a b8 09 e0 53 0a e2 7e  4a 33 f1 7d 23 fe 53 1c   ....S..~J3.}#.S.  
  0120:  b2 1a 53 30 6e d4 6c e8  a6 5c 68 30 69 16 1d bf   ..S0n.l..\h0i...  
  0130:  df 0a ab 19 60 1e 97 89  ce 74 54 e8 85 ff 81 f1   ....`....tT.....  
  0140:  f2 a1 df cd 0e 71 94 0c  bc 52 6a d5 3e            .....q...Rj.>     
tls_read: want=5, got=5
  0000:  16 03 03 00 c1                                     .....             
tls_read: want=193, got=193
  0000:  0d 00 00 bd 03 01 02 40  00 0c 05 01 05 03 06 01   .......@........  
  0010:  06 03 04 01 04 03 00 a9  00 a7 30 81 a4 31 0b 30   ..........0..1.0  
  0020:  09 06 03 55 04 06 13 02  45 53 31 12 30 10 06 03   ...U....ES1.0...  
  0030:  55 04 08 0c 09 42 61 72  63 65 6c 6f 6e 61 31 13   U....Barcelona1.  
  0040:  30 11 06 03 55 04 07 0c  0a 42 65 6c 6c 61 74 65   0...U....Bellate  
  0050:  72 72 61 31 1d 30 1b 06  03 55 04 0a 0c 14 41 70   rra1.0...U....Ap  
  0060:  70 6c 75 73 2b 20 4c 61  62 6f 72 61 74 6f 72 69   plus+ Laboratori  
  0070:  65 73 31 0f 30 0d 06 03  55 04 0b 0c 06 49 54 4c   es1.0...U....ITL  
  0080:  61 62 73 31 15 30 13 06  03 55 04 03 0c 0c 72 6f   abs1.0...U....ro  
  0090:  6f 74 5f 43 41 2e 74 65  73 74 31 25 30 23 06 09   ot_CA.test1%0#..  
  00a0:  2a 86 48 86 f7 0d 01 09  01 16 16 65 6e 72 69 63   *.H........enric  
  00b0:  2e 6d 6f 72 65 75 40 61  70 70 6c 75 73 2e 63 6f   .moreu@applus.co  
  00c0:  6d                                                 m                 
tls_read: want=5, got=5
  0000:  16 03 03 00 04                                     .....             
tls_read: want=4, got=4
  0000:  0e 00 00 00                                        ....              
tls_write: want=12, written=12
  0000:  16 03 03 00 07 0b 00 00  03 00 00 00               ............      
tls_write: want=75, written=75
  0000:  16 03 03 00 46 10 00 00  42 41 04 ef 79 53 bf c6   ....F...BA..yS..  
  0010:  1a 16 e9 f4 f3 46 6d f2  3b 99 88 7d 95 31 df 3b   .....Fm.;..}.1.;  
  0020:  dd 02 3e 20 09 c9 5d 88  7f c9 1b 25 3e 29 9b 2b   ..> ..]....%>).+  
  0030:  43 02 61 f5 21 4a 58 d7  eb 6a 49 f2 5b b5 37 5d   C.a.!JX..jI.[.7]  
  0040:  b9 6e b4 65 94 0d 1a 70  17 4e d8                  .n.e...p.N.       
tls_write: want=6, written=6
  0000:  14 03 03 00 01 01                                  ......            
tls_write: want=45, written=45
  0000:  16 03 03 00 28 00 00 00  00 00 00 00 00 24 44 dd   ....(........$D.  
  0010:  ac fc 6f a6 11 ae 55 cc  26 8b d5 16 77 df a7 1c   ..o...U.&...w...  
  0020:  46 20 45 d2 07 23 5a 16  b4 65 f8 94 51            F E..#Z..e..Q     
tls_read: want=5, got=0

TLS: can't connect: The TLS connection was non-properly terminated..
ldap_err2string
ldap_start_tls: Connect error (-11)
    additional info: The TLS connection was non-properly terminated.
ldap_free_connection 1 1
ldap_send_unbind
ber_flush2: 7 bytes to sd 3
  0000:  30 05 02 01 02 42 00                               0....B.           
ldap_write: want=7, written=7
  0000:  30 05 02 01 02 42 00                               0....B.           
ldap_free_connection: actually freed ```

**What I am doing wrong?**
e-rice commented 6 years ago

Have you tried ldapsearch -H ldaps://localhost:636 ???

KangpingWANG commented 6 years ago

I have the same problem with the container generated cert.

KangpingWANG commented 6 years ago

@enric1994 , maybe it's caused by client cert. Should start container with --env LDAP_TLS_VERIFY_CLIENT=try

enric1994 commented 6 years ago

Tried @KangpingWANG's and @e-rice's comments but it's still not working properly.

koallen commented 6 years ago

@KangpingWANG 's suggestion solved my issue.