diff options
author | Rob Austein <sra@hactrn.net> | 2008-01-09 15:15:36 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2008-01-09 15:15:36 +0000 |
commit | df4fd57fe409c4642dd98f202c9493bab02bd856 (patch) | |
tree | 4ba13eb03d8e3fde84f00bd4ca3688d673fc59e2 /scripts/Old | |
parent | a7b93e9f09a428c4d5d90353ddd79044e304686e (diff) |
Renaming http-client.py to cronjob.py is easier than explaining why
the name is wrong.
svn path=/scripts/Old/http-client.py; revision=1453
Diffstat (limited to 'scripts/Old')
-rw-r--r-- | scripts/Old/http-client.py | 36 | ||||
-rw-r--r-- | scripts/Old/http-demo.conf | 19 | ||||
-rw-r--r-- | scripts/Old/http-server.py | 15 |
3 files changed, 70 insertions, 0 deletions
diff --git a/scripts/Old/http-client.py b/scripts/Old/http-client.py new file mode 100644 index 00000000..5829ac4b --- /dev/null +++ b/scripts/Old/http-client.py @@ -0,0 +1,36 @@ +# $Id$ + +""" +Usage: python http-client [ { -c | --config } configfile ] + [ { -h | --help } ] + [ { -m | --msg } message ] + +Default configuration file is http-demo.conf, override with --config option. +""" + +import rpki.config, rpki.https, getopt, sys + +msg = "This is a test. This is only a test. Had this been real you would now be really confused.\n" + +cfg_file = "http-demo.conf" + +opts,argv = getopt.getopt(sys.argv[1:], "c:hm:?", ["config=", "help", "msg="]) +for o,a in opts: + if o in ("-h", "--help", "-?"): + print __doc__ + sys.exit(0) + elif o in ("-m", "--msg"): + msg = a + elif o in ("-c", "--config"): + cfg_file = a +if argv: + print __doc__ + raise RuntimeError, "Unexpected arguments %s" % argv + +cfg = rpki.config.parser(cfg_file, "client") + +print rpki.https.client(privateKey = rpki.x509.RSA(Auto_file = cfg.get("https-key")), + certChain = rpki.x509.X509_chain(Auto_files = cfg.multiget("https-cert")), + x509TrustList = rpki.x509.X509_chain(Auto_files = cfg.multiget("https-ta")), + url = cfg.get("https-url"), + msg = msg) diff --git a/scripts/Old/http-demo.conf b/scripts/Old/http-demo.conf new file mode 100644 index 00000000..3fbd9a91 --- /dev/null +++ b/scripts/Old/http-demo.conf @@ -0,0 +1,19 @@ +[server] +https-key = biz-certs/Carol-EE.key +https-cert.0 = biz-certs/Carol-EE.cer +https-cert.1 = biz-certs/Carol-CA.cer +https-ta = biz-certs/Dave-Root.cer + +[client] +https-key = biz-certs/Dave-EE.key +https-cert.0 = biz-certs/Dave-EE.cer +https-cert.1 = biz-certs/Dave-CA.cer +https-ta.0 = biz-certs/Alice-Root.cer +https-ta.1 = biz-certs/Bob-Root.cer +https-ta.2 = biz-certs/Carol-Root.cer +https-ta.3 = biz-certs/Elena-Root.cer +https-ta.4 = biz-certs/Frank-Root.cer +https-ta.5 = biz-certs/Ginny-Root.cer +https-ta.6 = biz-certs/Harry-Root.cer + +https-url = https://localhost:4433/cronjob diff --git a/scripts/Old/http-server.py b/scripts/Old/http-server.py new file mode 100644 index 00000000..a966f6fa --- /dev/null +++ b/scripts/Old/http-server.py @@ -0,0 +1,15 @@ +# $Id$ + +import rpki.https, tlslite.api, rpki.config + +cfg = rpki.config.parser("http-demo.conf", "server") + +privateKey = rpki.x509.RSA(PEM_file = cfg.get("https-key")) + +certChain = rpki.x509.X509_chain() +certChain.load_from_PEM(cfg.multiget("https-cert")) + +def handler(query, path): + return 200, "Path: %s\nQuery: %s" % (path, query) + +rpki.https.server(privateKey = privateKey, certChain = certChain, handlers = handler) |