Skip to content
This repository has been archived by the owner on Sep 23, 2020. It is now read-only.

Commit

Permalink
Support for web listening on other than localhost
Browse files Browse the repository at this point in the history
  • Loading branch information
labisso committed Mar 9, 2010
1 parent c4cd294 commit f4511c1
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
6 changes: 5 additions & 1 deletion web/bin/run-standalone-ssl.sh
Expand Up @@ -60,6 +60,10 @@ PORT=`$PYTHON_EXE $NIMBUS_PYSRC/nimbusweb/setup/setup.py --printport --conf $NIM
if [ $? -ne 0 ]; then
exit 5
fi
HOST=`$PYTHON_EXE $NIMBUS_PYSRC/nimbusweb/setup/setup.py --printhost --conf $NIMBUS_WEBCONF --basedir $NIMBUS_WEBDIR`
if [ $? -ne 0 ]; then
exit 5
fi
CERTPATH=`$PYTHON_EXE $NIMBUS_PYSRC/nimbusweb/setup/setup.py --printcertpath --conf $NIMBUS_WEBCONF --basedir $NIMBUS_WEBDIR`
if [ $? -ne 0 ]; then
exit 5
Expand All @@ -79,7 +83,7 @@ echo -e "\nUse CTRL-C to stop the server (you can get it to daemonize later)"
echo -e "\n*****************************************************************"
echo -e "*****************************************************************\n"

exec $PYTHON_EXE $NIMBUS_PYSRC/nimbusweb/portal/manage.py runcpserver "port=$PORT" "workdir=$NIMBUS_PYSRC/nimbusweb/portal/" "ssl_certificate=$CERTPATH" "ssl_private_key=$KEYPATH"
exec $PYTHON_EXE $NIMBUS_PYSRC/nimbusweb/portal/manage.py runcpserver "host=$HOST" "port=$PORT" "workdir=$NIMBUS_PYSRC/nimbusweb/portal/" "ssl_certificate=$CERTPATH" "ssl_private_key=$KEYPATH"


# Available options:
Expand Down
3 changes: 3 additions & 0 deletions web/nimbusweb.conf
Expand Up @@ -20,6 +20,9 @@ ca.dir: var/ca

webserver.port: 1443

# Host to run the standalone webserver on.
# IP address or hostname, use 0.0.0.0 to listen on all interfaces
webserver.host: 0.0.0.0

# Print URL
# When full URLs are printed where the context is for outside use (for example
Expand Down
19 changes: 17 additions & 2 deletions web/src/python/nimbusweb/setup/setup.py
Expand Up @@ -124,6 +124,10 @@ class ARGS:
PRINTPORT="-t"
PRINTPORT_HELP="Print configured port # to stdout"

PRINTHOST_LONG="--printhost"
PRINTHOST="-l"
PRINTHOST_HELP="Print configured host interface to stdout"

PRINTCERTPATH_LONG="--printcertpath"
PRINTCERTPATH="-i"
PRINTCERTPATH_HELP="Print configured cert path to stdout and exit"
Expand All @@ -140,7 +144,8 @@ class ARGS:
def validateargs(opts):

actions = [opts.checkssl, opts.forcenewssl, opts.newconf,
opts.printport, opts.printcertpath, opts.printkeypath]
opts.printport, opts.printcertpath, opts.printkeypath,
opts.printhost]

count = 0
for action in actions:
Expand Down Expand Up @@ -211,6 +216,10 @@ def parsersetup():
action="store_true", dest="printport", default=False,
help=ARGS.PRINTPORT_HELP)

group.add_option(ARGS.PRINTHOST, ARGS.PRINTHOST_LONG,
action="store_true", dest="printhost", default=False,
help=ARGS.PRINTHOST_HELP)

group.add_option(ARGS.PRINTCERTPATH, ARGS.PRINTCERTPATH_LONG,
action="store_true", dest="printcertpath", default=False,
help=ARGS.PRINTCERTPATH_HELP)
Expand Down Expand Up @@ -310,6 +319,7 @@ def main(argv=None):
cadir = config_from_key(config, "ca.dir")
timezone = config_from_key(config, "timezone")
port = config_from_key(config, "webserver.port")
host = config_from_key(config, "webserver.host")
printurl = config_from_key(config, "print.url")
accountprompt = config_from_key(config, "account.prompt")
expire_hours = config_from_key(config, "token.expire_hours")
Expand Down Expand Up @@ -341,7 +351,12 @@ def main(argv=None):
except:
raise IncompatibleEnvironment("'webserver.port' configuration is not an integer?")
print port


if opts.printhost:
if not host:
raise IncompatibleEnvironment("There is no 'webserver.host' configuration")
print host

if opts.printcertpath:
if not certconf:
raise IncompatibleEnvironment("There is no 'ssl.cert' configuration")
Expand Down

0 comments on commit f4511c1

Please sign in to comment.