0
0
mirror of https://github.com/OpenVPN/openvpn.git synced 2024-09-20 12:02:28 +02:00
openvpn/sample/sample-plugins/keying-material-exporter-demo/http-client.py
Daniel Kubec f7ef7522f5 sample-plugin: TLS Keying Material Exporter [RFC-5705] demonstration plug-in
A simple plug-in with a corresponding HTTP server and client which can authenticate
an HTTP user based on the authentication already done via an established OpenVPN
connection

[DS: Renamed the module at commit time from sso to keyingmaterialexporter to
     avoid confusion with other Single-Sign-On solutions.  Updated documentation
     and commits accordingly.  Added --pull to the client config]

Signed-off-by: Daniel Kubec <niel@rtfm.cz>
Signed-off-by: David Sommerseth <davids@redhat.com>
Acked-by: David Sommerseth <davids@redhat.com>
2015-10-10 00:03:07 +02:00

21 lines
420 B
Python
Executable File

#!/usr/bin/python
import sys
import os
import httplib
f = '/tmp/openvpn_sso_user'
with open (f, "r") as myfile:
session_key = myfile.read().replace('\n', '')
conn = httplib.HTTPConnection("10.8.0.1:8080")
conn.request("GET", "/" + session_key)
r1 = conn.getresponse()
if r1.status == 200:
body = r1.read().rstrip()
print body
elif r1.status == 404:
print "Authentication failed"
else:
print r1.status, r1.reason