def main(): global Options from optparse import OptionParser usage = "usage: gtermhost [-h ... options] <hostname>" parser = OptionParser(usage=usage) parser.add_option("", "--server_addr", dest="server_addr", default="localhost", help="Server hostname (or IP address) (default: localhost)") parser.add_option("", "--server_port", dest="server_port", default=0, help="Server port (default: %d)" % gterm.DEFAULT_HOST_PORT, type="int") parser.add_option("", "--external_host", dest="external_host", default="", help="external host name (or IP address), if different from server_addr") parser.add_option("", "--remote_port", dest="remote_port", default=0, help="actual remote port, if different from server_port", type="int") parser.add_option("", "--auth_file", dest="auth_file", default="", help="Server auth file") parser.add_option("", "--oshell", dest="oshell", action="store_true", help="Activate otrace/oshell") parser.add_option("", "--oshell_input", dest="oshell_input", action="store_true", help="Allow stdin input otrace/oshell") parser.add_option("", "--internal_certfile", dest="internal_certfile", default="", help="Internal SSL certfile") parser.add_option("", "--logging", dest="logging", action="store_true", help="Log to ~/.graphterm/gtermhost.log") parser.add_option("", "--lterm_logfile", dest="lterm_logfile", default="", help="Lineterm logfile") parser.add_option("", "--daemon", dest="daemon", default="", help="daemon=start/stop/restart/status") (Options, args) = parser.parse_args() if len(args) != 1 and Options.daemon != "stop": print >> sys.stderr, usage sys.exit(1) if not args or not HOST_RE.match(args[0]): print >> sys.stderr, "Invalid/missing host name" sys.exit(1) gterm.setup_logging(logging.ERROR) if not Options.daemon: run_host(Options, args) else: from daemon import ServerDaemon host_name = args[0] pidfile = "/tmp/gtermhost."+host_name+".pid" daemon = ServerDaemon(pidfile, functools.partial(run_host, Options, args)) daemon.daemon_run(Options.daemon)
def main(): from optparse import OptionParser usage = "usage: gtermhost [-h ... options] <hostname>" parser = OptionParser(usage=usage) parser.add_option("", "--server_addr", dest="server_addr", default="localhost", help="Server hostname (or IP address) (default: localhost)") parser.add_option("", "--server_port", dest="server_port", default=0, help="Server port (default: %d)" % gterm.DEFAULT_HOST_PORT, type="int") parser.add_option("", "--auth_file", dest="auth_file", default="", help="Server auth file") parser.add_option("", "--shell_command", dest="shell_command", default=SHELL_CMD, help="Shell command (default: %s) % SHELL_CMD") parser.add_option("", "--oshell", dest="oshell", action="store_true", help="Activate otrace/oshell") parser.add_option("", "--oshell_input", dest="oshell_input", action="store_true", help="Allow stdin input otrace/oshell") parser.add_option("", "--https", dest="https", action="store_true", help="Use SSL (TLS) connections for security") parser.add_option("", "--widgets", dest="widgets", action="store_true", help="Activate widgets on port %d" % (gterm.DEFAULT_HTTP_PORT-2)) parser.add_option("", "--term_type", dest="term_type", default="", help="Terminal type (linux/screen/xterm)") parser.add_option("", "--term_encoding", dest="term_encoding", default="utf-8", help="Terminal character encoding (utf-8/latin-1/...)") parser.add_option("", "--daemon", dest="daemon", default="", help="daemon=start/stop/restart/status") (options, args) = parser.parse_args() if len(args) != 1 and options.daemon != "stop": print >> sys.stderr, usage sys.exit(1) if not args or not HOST_RE.match(args[0]): print >> sys.stderr, "Invalid/missing host name" sys.exit(1) if not options.daemon: run_host(options, args) else: from daemon import ServerDaemon host_name = args[0] pidfile = "/tmp/gtermhost."+host_name+".pid" daemon = ServerDaemon(pidfile, functools.partial(run_host, options, args)) daemon.daemon_run(options.daemon)
def main(): global Options from optparse import OptionParser usage = "usage: gtermhost [-h ... options] <hostname>" parser = OptionParser(usage=usage) parser.add_option( "", "--server_addr", dest="server_addr", default="localhost", help="Server hostname (or IP address) (default: localhost)") parser.add_option("", "--server_port", dest="server_port", default=0, help="Server port (default: %d)" % gterm.DEFAULT_HOST_PORT, type="int") parser.add_option( "", "--external_host", dest="external_host", default="", help="external host name (or IP address), if different from server_addr" ) parser.add_option("", "--remote_port", dest="remote_port", default=0, help="actual remote port, if different from server_port", type="int") parser.add_option("", "--auth_file", dest="auth_file", default="", help="Server auth file") parser.add_option("", "--oshell", dest="oshell", action="store_true", help="Activate otrace/oshell") parser.add_option("", "--oshell_input", dest="oshell_input", action="store_true", help="Allow stdin input otrace/oshell") parser.add_option("", "--internal_certfile", dest="internal_certfile", default="", help="Internal SSL certfile") parser.add_option("", "--logging", dest="logging", action="store_true", help="Log to ~/.graphterm/gtermhost.log") parser.add_option("", "--lterm_logfile", dest="lterm_logfile", default="", help="Lineterm logfile") parser.add_option("", "--daemon", dest="daemon", default="", help="daemon=start/stop/restart/status") (Options, args) = parser.parse_args() if len(args) != 1 and Options.daemon != "stop": print >> sys.stderr, usage sys.exit(1) if not args or not HOST_RE.match(args[0]): print >> sys.stderr, "Invalid/missing host name" sys.exit(1) gterm.setup_logging(logging.ERROR) if not Options.daemon: run_host(Options, args) else: from daemon import ServerDaemon host_name = args[0] pidfile = "/tmp/gtermhost." + host_name + ".pid" daemon = ServerDaemon(pidfile, functools.partial(run_host, Options, args)) daemon.daemon_run(Options.daemon)
def main(): from optparse import OptionParser usage = "usage: gtermserver [-h ... options]" parser = OptionParser(usage=usage) parser.add_option("", "--auth_code", dest="auth_code", default="", help="Authentication code (default: random value; specify 'none' for no auth)") parser.add_option("", "--auth_users", dest="auth_users", default="", help="Comma-separated list of authenticated user names") parser.add_option("", "--host", dest="host", default="localhost", help="Hostname (or IP address) (default: localhost)") parser.add_option("", "--port", dest="port", default=gtermhost.DEFAULT_HTTP_PORT, help="IP port (default: %d)" % gtermhost.DEFAULT_HTTP_PORT, type="int") parser.add_option("", "--server_secret", dest="server_secret", default="", help="Server secret (for host authentication)") parser.add_option("", "--terminal", dest="terminal", action="store_true", help="Open new terminal window") parser.add_option("", "--internal_host", dest="internal_host", default="", help="internal host name (or IP address) (default: external host name)") parser.add_option("", "--internal_port", dest="internal_port", default=0, help="internal port (default: PORT-1)", type="int") parser.add_option("", "--nolocal", dest="nolocal", action="store_true", help="Disable connection to localhost") parser.add_option("", "--shell_command", dest="shell_command", default="", help="Shell command") parser.add_option("", "--oshell", dest="oshell", action="store_true", help="Activate otrace/oshell") parser.add_option("", "--oshell_input", dest="oshell_input", action="store_true", help="Allow stdin input otrace/oshell") parser.add_option("", "--https", dest="https", action="store_true", help="Use SSL (TLS) connections for security") parser.add_option("", "--internal_https", dest="internal_https", action="store_true", help="Use https for internal connections") parser.add_option("", "--server_auth", dest="server_auth", action="store_true", help="Enable server authentication by gterm clients") parser.add_option("", "--client_cert", dest="client_cert", default="", help="Path to client CA cert (or '.')") parser.add_option("", "--term_type", dest="term_type", default="", help="Terminal type (linux/screen/xterm)") parser.add_option("", "--term_encoding", dest="term_encoding", default="utf-8", help="Terminal character encoding (utf-8/latin-1/...)") parser.add_option("", "--lterm_logfile", dest="lterm_logfile", default="", help="Lineterm logfile") parser.add_option("", "--widgets", dest="widgets", action="store_true", help="Activate widgets on port %d" % (gtermhost.DEFAULT_HTTP_PORT-2)) parser.add_option("", "--daemon", dest="daemon", default="", help="daemon=start/stop/restart/status") (options, args) = parser.parse_args() if not options.daemon: run_server(options, args) else: from daemon import ServerDaemon pidfile = "/tmp/gtermserver.pid" daemon = ServerDaemon(pidfile, functools.partial(run_server, options, args)) daemon.daemon_run(options.daemon)