Skip to content

Commit

Permalink
Fix urgent amphora two-way auth security bug
Browse files Browse the repository at this point in the history
The value of gunicorn's option 'cert_reqs` for client-cert requirement
does not take a boolean, but rather `ssl.CERT_REQUIRED` which is `2`.

Story: 2006660
Task: 36916

SecurityImpact: CVE-2019-17134

Change-Id: I5619f5e40d7c9a2ee7741bf4664c0d2d08963992
(cherry picked from commit 2c9af84)
(cherry picked from commit 998163a)
  • Loading branch information
rm-you committed Oct 4, 2019
1 parent 5ecfa0a commit 1725517
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion octavia/cmd/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# make sure PYTHONPATH includes the home directory if you didn't install

import multiprocessing as multiproc
import ssl
import sys

import gunicorn.app.base
Expand Down Expand Up @@ -74,7 +75,7 @@ def main():
'timeout': CONF.amphora_agent.agent_request_read_timeout,
'certfile': CONF.amphora_agent.agent_server_cert,
'ca_certs': CONF.amphora_agent.agent_server_ca,
'cert_reqs': True,
'cert_reqs': ssl.CERT_REQUIRED,
'preload_app': True,
'accesslog': '/var/log/amphora-agent.log',
'errorlog': '/var/log/amphora-agent.log',
Expand Down
7 changes: 7 additions & 0 deletions octavia/tests/unit/cmd/test_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import ssl

import mock

Expand Down Expand Up @@ -36,5 +37,11 @@ def test_main(self, mock_service, mock_process, mock_server, mock_amp):

agent.main()

# Ensure gunicorn is initialized with the correct cert_reqs option.
# This option is what enforces use of a valid client certificate.
self.assertEqual(
ssl.CERT_REQUIRED,
mock_amp.call_args[0][1]['cert_reqs'])

mock_health_proc.start.assert_called_once_with()
mock_amp_instance.run.assert_called_once()
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
security:
- |
Correctly require two-way certificate authentication to connect to the
amphora agent API (CVE-2019-17134).

0 comments on commit 1725517

Please sign in to comment.