-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
64 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
[DEAFULT] | ||
# 1 to 50. Default 20, debug 10, verbose 5 | ||
;log_level = 20 | ||
|
||
# OpenSSL cipher suite. See ciphers(1). | ||
;cipher = EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH | ||
|
||
# Path to pppd | ||
;pppd = /usr/bin/pppd | ||
|
||
[site1] | ||
# To start with [site1] config, execute: | ||
# sstpd -f /path/to/config.ini -s site1 | ||
# Config here will override items on [DEFAULT], | ||
# and cmdline args override the config file. | ||
|
||
listen = 0.0.0.0 | ||
port = 443 | ||
|
||
# PEM-format certificate with key. | ||
pem_cert = /path/to/cert.pem | ||
|
||
# Address of server side on ppp. | ||
local = 192.168.20.1 | ||
|
||
# If RADIUS is used to mangle IP pool, comment it out. | ||
remote = 192.168.20.0/24 | ||
|
||
# pppd config file path | ||
;pppd_config = /etc/ppp/options.sstpd | ||
|
||
[no-ssl] | ||
# Use plain HTTP instead of HTTPS. Useful when running behind proxy. | ||
no_ssl = yes | ||
|
||
listen = 127.0.0.1 | ||
port = 4433 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
import sys | ||
import logging | ||
import argparse | ||
from ConfigParser import SafeConfigParser, NoSectionError | ||
from twisted.internet.endpoints import SSL4ServerEndpoint | ||
from twisted.internet import reactor, ssl | ||
|
||
|
@@ -10,9 +11,31 @@ | |
|
||
|
||
def _getArgs(): | ||
parser = argparse.ArgumentParser(description='A Secure Socket Tunneling ' | ||
'Protocol (SSTP) server.', | ||
epilog='Author: Sorz <[email protected]>.') | ||
conf_parser = argparse.ArgumentParser( | ||
description='A Secure Socket Tunneling Protocol (SSTP) server.', | ||
epilog='Author: Sorz <[email protected]>.', | ||
add_help=False) | ||
conf_parser.add_argument("-f", "--conf-file", | ||
help="Specify config file.", metavar="FILE") | ||
conf_parser.add_argument("-s", "--conf-section", | ||
help="Specify section name on config file.", | ||
metavar="SITE", default="DEFAULT") | ||
|
||
args, remaining_argv = conf_parser.parse_known_args() | ||
defaults = {} | ||
if args.conf_file: | ||
config = SafeConfigParser() | ||
config.read(args.conf_file) | ||
try: | ||
defaults = dict(config.items(args.conf_section)) | ||
except NoSectionError as e: | ||
print('Error: section [%s] not found in config file.' % \ | ||
args.conf_section) | ||
sys.exit(1) | ||
return | ||
|
||
parser = argparse.ArgumentParser(parents=[conf_parser]) | ||
parser.set_defaults(**defaults) | ||
parser.add_argument('-l', '--listen', | ||
default='', | ||
metavar='ADDRESS', | ||
|