mirror of
https://github.com/OpenVPN/openvpn.git
synced 2026-05-28 04:03:29 -04:00
Merge 01c26e2f72 into 2b8afc6c68
This commit is contained in:
commit
b6af2c1e9a
2 changed files with 9 additions and 9 deletions
|
|
@ -1,20 +1,20 @@
|
|||
#!/usr/bin/python
|
||||
import sys
|
||||
import os
|
||||
import httplib
|
||||
import http.client
|
||||
|
||||
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 = http.client.HTTPConnection("10.8.0.1:8080")
|
||||
conn.request("GET", "/" + session_key)
|
||||
r1 = conn.getresponse()
|
||||
|
||||
if r1.status == 200:
|
||||
body = r1.read().rstrip()
|
||||
print body
|
||||
print(body)
|
||||
elif r1.status == 404:
|
||||
print "Authentication failed"
|
||||
print("Authentication failed")
|
||||
else:
|
||||
print r1.status, r1.reason
|
||||
print(r1.status, r1.reason)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/python
|
||||
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
|
||||
from http.server import BaseHTTPRequestHandler, HTTPServer
|
||||
import os
|
||||
|
||||
class ExampleHTTPRequestHandler(BaseHTTPRequestHandler):
|
||||
|
|
@ -7,7 +7,7 @@ class ExampleHTTPRequestHandler(BaseHTTPRequestHandler):
|
|||
def do_GET(self):
|
||||
session_key = os.path.basename(self.path)
|
||||
file = '/tmp/openvpn_sso_' + session_key
|
||||
print 'session file: ' + file
|
||||
print('session file: ' + file)
|
||||
try:
|
||||
f = open(file)
|
||||
#send code 200 response
|
||||
|
|
@ -17,8 +17,8 @@ class ExampleHTTPRequestHandler(BaseHTTPRequestHandler):
|
|||
self.end_headers()
|
||||
#send file content to client
|
||||
user = f.read().rstrip()
|
||||
print 'session user: ' + user
|
||||
print 'session key: ' + session_key
|
||||
print('session user: ' + user)
|
||||
print('session key: ' + session_key)
|
||||
self.wfile.write('<html><body><h1>Greetings ' + user \
|
||||
+ '. You are authorized' \
|
||||
'</h1>' \
|
||||
|
|
|
|||
Loading…
Reference in a new issue