Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InvalidURL when getting redirected to active leader #56

Closed
j-lowry opened this issue Jun 1, 2016 · 4 comments
Closed

InvalidURL when getting redirected to active leader #56

j-lowry opened this issue Jun 1, 2016 · 4 comments
Labels

Comments

@j-lowry
Copy link

j-lowry commented Jun 1, 2016

Not sure if it is something I am doing wrong or if hvac is having some issue with redirecting:

$ vault status
Sealed: false
Key Shares: 5
Key Threshold: 3
Unseal Progress: 0

High-Availability Enabled: true
    Mode: standby
    Leader: https://vault-server2:8200
$ pip freeze | grep hvac
hvac==0.2.13
$ python
>>> import hvac
>>> client=hvac.Client(url='https://vault-server3:8200', verify='/etc/ssl/certs/internal-ca.cert')
>>> client.auth_github('<github_token>')
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connection.py:303: SubjectAltNameWarning: Certificate for vault-server3.datascience.com has no `subjectAltName`, falling back to check for a `commonName` for now. This feature is being removed by major browsers and deprecated by RFC 2818. (See https://github.com/shazow/urllib3/issues/497 for details.)
  SubjectAltNameWarning
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/hvac/v1/__init__.py", line 544, in auth_github
    return self.auth('/v1/auth/{0}/login'.format(mount_point), json=params, use_token=use_token)
  File "/usr/local/lib/python2.7/dist-packages/hvac/v1/__init__.py", line 547, in auth
    response = self._post(url, **kwargs).json()
  File "/usr/local/lib/python2.7/dist-packages/hvac/v1/__init__.py", line 590, in _post
    return self.__request('post', url, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/hvac/v1/__init__.py", line 617, in __request
    allow_redirects=False, **_kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 461, in request
    prep = self.prepare_request(req)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 394, in prepare_request
    hooks=merge_hooks(request.hooks, self.hooks),
  File "/usr/local/lib/python2.7/dist-packages/requests/models.py", line 295, in prepare
    self.prepare_url(url, params)
  File "/usr/local/lib/python2.7/dist-packages/requests/models.py", line 349, in prepare_url
    raise InvalidURL(*e.args)
requests.exceptions.InvalidURL: Failed to parse: vault-server3:8200https:

If I set the url to the vault leader is works without errors:

>>> client=hvac.Client(url='https://vault-server2:8200', verify='/etc/ssl/certs/internal-ca.cert')
>>> client.auth_github('<github_token>')
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connection.py:303: SubjectAltNameWarning: Certificate for vault-server2 has no `subjectAltName`, falling back to check for a `commonName` for now. This feature is being removed by major browsers and deprecated by RFC 2818. (See https://github.com/shazow/urllib3/issues/497 for details.)
  SubjectAltNameWarning
{u'lease_id': u'', u'warnings': None, u'auth': {u'lease_duration': 2592000, u'policies': [u'all-customers-read-only', u'default', u'default-user', u'systems', u'vault-testers', u'vault-user-rw'], u'client_token': u'<token>', u'accessor': u'bea40842-1acc-c7bc-a732-44eb6b1a4724', u'renewable': True, u'metadata': {u'username': u'j-lowry', u'org': u'datascienceinc'}}, u'lease_duration': 0, u'data': None, u'renewable': False}
@ianunruh
Copy link
Member

ianunruh commented Jun 1, 2016

Thanks for the report. This issue has been solved in master. I can cut a release today since I imagine other people will be facing this issue.

@ianunruh ianunruh added the bug label Jun 1, 2016
@j-lowry
Copy link
Author

j-lowry commented Jun 2, 2016

Yeah, a new release would be awesome. I now have multiple users running into this.

@ianunruh
Copy link
Member

ianunruh commented Jun 2, 2016

I have released v0.2.14 with the bug fix for this issue.

https://github.com/ianunruh/hvac/releases/tag/v0.2.14
https://pypi.python.org/pypi/hvac/

@ianunruh ianunruh closed this as completed Jun 2, 2016
@jvoorhis
Copy link

jvoorhis commented Jun 2, 2016

I can confirm 0.2.14 fixes the bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants