Initial commit
This commit is contained in:
		
							
								
								
									
										6
									
								
								Dockerfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								Dockerfile
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,6 @@ | ||||
| FROM python:3-alpine | ||||
| RUN apk add --update --no-cache openvpn curl bash | ||||
| RUN pip install requests | ||||
| ADD helpers /helpers | ||||
| ADD entrypoint.sh /entrypoint.sh | ||||
| ENTRYPOINT /entrypoint.sh | ||||
							
								
								
									
										9
									
								
								entrypoint.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										9
									
								
								entrypoint.sh
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| #!/bin/bash | ||||
| set -e | ||||
| set -x | ||||
| CONFIG=/server-secrets/openvpn-$1.conf | ||||
| while [ ! -e $CONFIG ]; do | ||||
|   sleep 1 | ||||
| done | ||||
| curl -X DELETE http://127.0.0.1:2001/api/by-service/openvpn-$1 | ||||
| openvpn --config $CONFIG | ||||
							
								
								
									
										3
									
								
								helpers/client-connect.py
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										3
									
								
								helpers/client-connect.py
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,3 @@ | ||||
| #!/bin/sh | ||||
| set -e | ||||
| curl -f http://127.0.0.1:2001/api/by-serial/$tls_serial_0 | ||||
							
								
								
									
										20
									
								
								helpers/learn-address.py
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										20
									
								
								helpers/learn-address.py
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,20 @@ | ||||
| #!/usr/bin/env python | ||||
| import os | ||||
| import sys | ||||
| import requests | ||||
|  | ||||
| # TODO: Replace with curl based script | ||||
|  | ||||
| operation, addr = sys.argv[1:3] | ||||
| if operation == "delete": | ||||
|     pass | ||||
| else: | ||||
|     common_name = sys.argv[3] | ||||
|     requests.post("http://127.0.0.1:2001/api/by-serial/%d" % | ||||
|       int(os.environ["tls_serial_0"]), | ||||
|       data={ | ||||
|         "service": os.environ["service"], | ||||
|         "internal_addr": addr, | ||||
|         "remote_addr": os.environ["untrusted_ip"], | ||||
|         "remote_port": os.environ["untrusted_port"] | ||||
|     }) | ||||
		Reference in New Issue
	
	Block a user