bau-sec/ansible-openvpn-hardened

Downloading openvpn public key is failed, cose of "ansible http user agent is absent"

Closed this issue · 3 comments

ansible 2.2.2.0

TASK [openvpn : OpenVPN | package | Add the official OpenVPN APT key] **********
fatal: [188.226.143.209]: FAILED! => {"changed": false, "failed": true, "msg": "Failed to download key at https://swupdate.openvpn.net/repos/repo-public.gpg: HTTP Error 403: Forbidden"}

Solves by adding http_agent

diff /usr/lib/python2.7/dist-packages/ansible/module_utils/urls.py /usr/lib/python2.7/dist-packages/ansible/module_utils/urls.py.bak 
981c981
<     http_agent = module.params.get('http_agent', 'Ansible/2.2')
---
>     http_agent = module.params.get('http_agent', None)

Thanks for this fix. Would you like to make a pull request or have me make the change?

Sorry, I misread this initially. So Ansible's source code doesn't provide a user-agent which the server hosting the OpenVPN APT key doesn't like? So we need a workaround in the openvpn task. Maybe use curl or another tool to download the key and add it locally?

Here's the upstream issue in ansible: ansible/ansible#22647