Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 927928

Summary: stunnel first connection fails
Product: Red Hat Enterprise Linux 6 Reporter: Jiri Pospisil <jpospisi>
Component: stunnelAssignee: Tomas Mraz <tmraz>
Status: CLOSED ERRATA QA Contact: Stefan Kremen <skremen>
Severity: low Docs Contact:
Priority: low    
Version: 6.4CC: ebenes, eparis, ksrot, mkosek, skremen, tmraz
Target Milestone: rcKeywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: stunnel-4.29-5.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-05-11 00:40:15 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
stunnel log none

Description Jiri Pospisil 2013-03-26 14:20:29 UTC
Created attachment 716539 [details]
stunnel log

Description of problem:
When running the stunnel as daemon with config read from stdin file descriptor, the first connection always fails. This happens if stunnel is used on either server or client side.

Version-Release number of selected component (if applicable):
stunnel-4.29-2.el6.x86_64

How reproducible:
always

Steps to Reproduce:
1. SERVER="debug = 7
cert = $PWD/server.crt
key = $PWD/server.key
verify = 0
pid = $PWD/server.pid
output = $PWD/server.log
[server]
accept = 10001
connect = 10000
"
2. create server SSL certificate (server.crt) and key (server.key) in current working directory
3. echo foo > file.txt
4. stunnel -fd 0 <<< "$SERVER"
5. python -m SimpleHTTPServer 10000 &
6. curl -k https://localhost:10001/file.txt
7. curl -k https://localhost:10001/file.txt
  
Actual results:
first curl (6.) prints:
---
curl: (35) SSL connect error
---
second curl (7.) prints:
---
localhost.localdomain - - [26/Mar/2013 14:58:23] "GET /file.txt HTTP/1.1" 200 -
foo
---

Expected results:
Both curl runs are successful.

Additional info:
I. stunnel log attached. The timescale is:
2013.03.26 15:06:49 - startup
2013.03.26 15:06:55 - first (failing) curl connection
2013.03.26 15:07:01 - second (working) curl connection
2013.03.26 15:07:06 - exit

II. If the same config is loaded from a file, the first connection works well. This can be achieved by modifying stunnel execution (4.) as follows:
printf "$SERVER" > server.conf; stunnel server.conf

III. This bug appears to be already fixed upstream, as it is no longer an issue in the current upstream version (4.56)

Comment 1 Jiri Pospisil 2013-03-26 14:28:17 UTC
Sorry, I mixed it up a little. The working curl connection prints just "foo" (i.e. file.txt contents). The "GET /file.txt HTTP/1.1" line was printed by the python's SimpleHTTPServer running in background.

Comment 6 Tomas Mraz 2015-12-18 12:58:20 UTC
I have patch for this.

Comment 11 errata-xmlrpc 2016-05-11 00:40:15 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-0922.html