diff options
-rw-r--r-- | myrpki.rototill/arin-rootcert.py | 2 | ||||
-rw-r--r-- | myrpki.rototill/children-to-pubclients.py | 42 | ||||
-rw-r--r-- | myrpki.rototill/myrpki.rnc | 16 | ||||
-rw-r--r-- | myrpki.rototill/myrpki.rng | 16 | ||||
-rw-r--r-- | myrpki.rototill/sql-cleaner.py | 21 | ||||
-rw-r--r-- | myrpki.rototill/sql-dumper.py | 15 | ||||
-rw-r--r-- | myrpki.rototill/sql-setup.py | 2 | ||||
-rw-r--r-- | myrpki.rototill/start-servers.py | 2 | ||||
-rw-r--r-- | myrpki.rototill/xml-parse-test.py | 2 | ||||
-rw-r--r-- | myrpki.rototill/yamltest.py | 95 |
10 files changed, 83 insertions, 130 deletions
diff --git a/myrpki.rototill/arin-rootcert.py b/myrpki.rototill/arin-rootcert.py index 09180af6..e2e6050e 100644 --- a/myrpki.rototill/arin-rootcert.py +++ b/myrpki.rototill/arin-rootcert.py @@ -7,7 +7,7 @@ the fly rather than having to pull the entire database into memory. $Id$ -Copyright (C) 2009 Internet Systems Consortium ("ISC") +Copyright (C) 2009-2010 Internet Systems Consortium ("ISC") Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above diff --git a/myrpki.rototill/children-to-pubclients.py b/myrpki.rototill/children-to-pubclients.py deleted file mode 100644 index 025d3d42..00000000 --- a/myrpki.rototill/children-to-pubclients.py +++ /dev/null @@ -1,42 +0,0 @@ -""" -Convert children.csv to (initial) pubclients.csv. You may wish to -play sort/join/etc games with the output of this to avoid overwriting -other publication clients you've configured. - -$Id$ - -Copyright (C) 2009 Internet Systems Consortium ("ISC") - -Permission to use, copy, modify, and distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -""" - -import sys, csv, myrpki, getopt, time, os, rpki.config - -os.environ["TZ"] = "UTC" -time.tzset() - -cfg_file = "myrpki.conf" - -opts, argv = getopt.getopt(sys.argv[1:], "c:h?", ["config=", "help"]) -for o, a in opts: - if o in ("-h", "--help", "-?"): - print __doc__ - sys.exit(0) - if o in ("-c", "--config"): - cfg_file = a - -base = rpki.config.parser(cfg_file, "myirbe").get("rsync_base") - -csv.writer(sys.stdout, dialect = myrpki.csv_dialect).writerows( - (handle, cert, "%s/children/%s/" % (base.rstrip("/"), handle)) - for handle, expiration, cert in myrpki.csv_open("children.csv")) diff --git a/myrpki.rototill/myrpki.rnc b/myrpki.rototill/myrpki.rnc index ab5a541d..f1cfe249 100644 --- a/myrpki.rototill/myrpki.rnc +++ b/myrpki.rototill/myrpki.rnc @@ -1,9 +1,23 @@ # $Id$ # -# RelaxNG Schema for MyRPKI XML messages +# RelaxNG Schema for MyRPKI XML messages. # # libxml2 (including xmllint) only groks the XML syntax of RelaxNG, so # run the compact syntax through trang to get XML syntax. +# +# Copyright (C) 2009-2010 Internet Systems Consortium ("ISC") +# +# Permission to use, copy, modify, and distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH +# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, +# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +# PERFORMANCE OF THIS SOFTWARE. default namespace = "http://www.hactrn.net/uris/rpki/myrpki/" diff --git a/myrpki.rototill/myrpki.rng b/myrpki.rototill/myrpki.rng index f869e091..11cf7c06 100644 --- a/myrpki.rototill/myrpki.rng +++ b/myrpki.rototill/myrpki.rng @@ -2,10 +2,24 @@ <!-- $Id: myrpki.rnc 3094 2010-03-15 06:14:15Z sra $ - RelaxNG Schema for MyRPKI XML messages + RelaxNG Schema for MyRPKI XML messages. libxml2 (including xmllint) only groks the XML syntax of RelaxNG, so run the compact syntax through trang to get XML syntax. + + Copyright (C) 2009-2010 Internet Systems Consortium ("ISC") + + Permission to use, copy, modify, and distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH + REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, + INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + PERFORMANCE OF THIS SOFTWARE. --> <grammar ns="http://www.hactrn.net/uris/rpki/myrpki/" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> <define name="version"> diff --git a/myrpki.rototill/sql-cleaner.py b/myrpki.rototill/sql-cleaner.py index 8f5f946a..bf2c6302 100644 --- a/myrpki.rototill/sql-cleaner.py +++ b/myrpki.rototill/sql-cleaner.py @@ -3,7 +3,7 @@ $Id$ -Copyright (C) 2009 Internet Systems Consortium ("ISC") +Copyright (C) 2009-2010 Internet Systems Consortium ("ISC") Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above @@ -18,21 +18,18 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. """ -import subprocess, ConfigParser +import subprocess, rpki.config -cfg = ConfigParser.RawConfigParser() -cfg.read("yamltest.conf") +cfg = rpki.config.parser("yamltest.conf", "yamltest") for name in ("rpkid", "irdbd", "pubd"): - try: - passwd = cfg.get("yamltest", "%s_db_pass" % name) - except: - passwd = "fnord" + username = cfg.get("%s_sql_username" % name, name[:4]) + password = cfg.get("%s_sql_password" % name, "fnord") - dbs = [name[:4]] - dbs.extend("%s%d" % (name[:4], i) for i in xrange(12)) + databases = [name[:4]] + databases.extend("%s%d" % (name[:4], i) for i in xrange(12)) - for db in dbs: - subprocess.check_call(("mysql", "-u", name[:4], "-p" + passwd, db), + for db in databases: + subprocess.check_call(("mysql", "-u", username, "-p" + password, db), stdin = open("../rpkid/%s.sql" % name)) diff --git a/myrpki.rototill/sql-dumper.py b/myrpki.rototill/sql-dumper.py index 849d0eb1..4437d858 100644 --- a/myrpki.rototill/sql-dumper.py +++ b/myrpki.rototill/sql-dumper.py @@ -3,7 +3,7 @@ Dump backup copies of SQL tables used by these programs. $Id$ -Copyright (C) 2009 Internet Systems Consortium ("ISC") +Copyright (C) 2009-2010 Internet Systems Consortium ("ISC") Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above @@ -18,18 +18,15 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. """ -import subprocess, ConfigParser +import subprocess, rpki.config -cfg = ConfigParser.RawConfigParser() -cfg.read("yamltest.conf") +cfg = rpki.config.parser("yamltest.conf", "yamltest") for name in ("rpkid", "irdbd", "pubd"): - try: - passwd = cfg.get("yamltest", "%s_db_pass" % name) - except: - passwd = "fnord" + username = cfg.get("%s_sql_username" % name, name[:4]) + password = cfg.get("%s_sql_password" % name, "fnord") - cmd = ["mysqldump", "-u", name[:4], "-p" + passwd, "--databases", name[:4]] + cmd = ["mysqldump", "-u", username, "-p" + password, "--databases", name[:4]] cmd.extend("%s%d" % (name[:4], i) for i in xrange(12)) subprocess.check_call(cmd, stdout = open("backup.%s.sql" % name, "w")) diff --git a/myrpki.rototill/sql-setup.py b/myrpki.rototill/sql-setup.py index eeddcff4..78907321 100644 --- a/myrpki.rototill/sql-setup.py +++ b/myrpki.rototill/sql-setup.py @@ -4,7 +4,7 @@ root password, pulls other information from myrpki.conf. $Id$ -Copyright (C) 2009 Internet Systems Consortium ("ISC") +Copyright (C) 2009-2010 Internet Systems Consortium ("ISC") Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above diff --git a/myrpki.rototill/start-servers.py b/myrpki.rototill/start-servers.py index 4de8f1a9..da958812 100644 --- a/myrpki.rototill/start-servers.py +++ b/myrpki.rototill/start-servers.py @@ -4,7 +4,7 @@ which servers the user wants started. $Id$ -Copyright (C) 2009 Internet Systems Consortium ("ISC") +Copyright (C) 2009-2010 Internet Systems Consortium ("ISC") Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above diff --git a/myrpki.rototill/xml-parse-test.py b/myrpki.rototill/xml-parse-test.py index e32241ed..17b1884b 100644 --- a/myrpki.rototill/xml-parse-test.py +++ b/myrpki.rototill/xml-parse-test.py @@ -3,7 +3,7 @@ Test parser and display tool for myrpki.xml files. $Id$ -Copyright (C) 2009 Internet Systems Consortium ("ISC") +Copyright (C) 2009-2010 Internet Systems Consortium ("ISC") Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above diff --git a/myrpki.rototill/yamltest.py b/myrpki.rototill/yamltest.py index 3342d11d..851ea34d 100644 --- a/myrpki.rototill/yamltest.py +++ b/myrpki.rototill/yamltest.py @@ -15,7 +15,7 @@ Still to do: $Id$ -Copyright (C) 2009 Internet Systems Consortium ("ISC") +Copyright (C) 2009-2010 Internet Systems Consortium ("ISC") Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above @@ -157,11 +157,11 @@ class allocation(object): of rpkid, irdbd, and pubd, so they also need myirbe services. """ - parent = None - crl_interval = None - regen_margin = None - - base_port = 4400 + base_port = 4400 + parent = None + crl_interval = None + regen_margin = None + rootd_port = None @classmethod def allocate_port(cls): @@ -377,44 +377,25 @@ class allocation(object): Write configuration file for OpenSSL and RPKI tools. """ - host = self.hosted_by if self.is_hosted() else self - - r = { "handle" : self.name, - "run_pubd" : str(self.runs_pubd()), - "run_rootd" : str(self.is_root()), - "openssl" : prog_openssl } - - if not self.is_hosted(): - r["irdbd_sql_database"] = "irdb%d" % self.engine - r["rpkid_sql_database"] = "rpki%d" % self.engine - r["rpkid_server_host"] = "localhost" - r["rpkid_server_port"] = str(self.rpkid_port) - r["irdbd_server_host"] = "localhost" - r["irdbd_server_port"] = str(self.irdbd_port) - - if self.is_root(): - r["rootd_server_port"] = str(self.rootd_port) - - if self.runs_pubd(): - r["pubd_sql_database"] = "pubd%d" % self.engine - s = self.find_pubd() - r["pubd_server_host"] = "localhost" - r["pubd_server_port"] = str(s.pubd_port) - r["publication_rsync_server"] = "localhost:%s" % s.rsync_port - - if rpkid_password: - r["rpkid_sql_password"] = rpkid_password - if rpkid_username: - r["rpkid_sql_username"] = rpkid_username - if irdbd_password: - r["irdbd_sql_password"] = irdbd_password - if irdbd_username: - r["irdbd_sql_username"] = irdbd_username - if pubd_password: - r["pubd_sql_password"] = pubd_password - if pubd_username: - r["pubd_sql_username"] = pubd_username + + r = { "handle" : self.name, + "run_pubd" : str(self.runs_pubd()), + "run_rootd" : str(self.is_root()), + "openssl" : prog_openssl, + "irdbd_sql_database" : "irdb%d" % self.engine, + "rpkid_sql_database" : "rpki%d" % self.engine, + "rpkid_server_host" : "localhost", + "rpkid_server_port" : str(self.rpkid_port), + "irdbd_server_host" : "localhost", + "irdbd_server_port" : str(self.irdbd_port), + "rootd_server_port" : str(self.rootd_port), + "pubd_sql_database" : "pubd%d" % self.engine, + "pubd_server_host" : "localhost", + "pubd_server_port" : str(s.pubd_port), + "publication_rsync_server" : "localhost:%s" % s.rsync_port } + + r.update(config_overrides) f = open(self.path(fn), "w") f.write("# Automatically generated, do not edit\n") @@ -567,24 +548,16 @@ try: # passwords: this is mostly so that I can show a complete working # example without publishing my own server's passwords. - try: - cfg = rpki.config.parser(cfg_file, "yamltest") - rpkid_password = cfg.get("rpkid_db_pass") - irdbd_password = cfg.get("irdbd_db_pass") - pubd_password = cfg.get("pubd_db_pass") - rpkid_username = cfg.get("rpkid_db_user") - irdbd_username = cfg.get("irdbd_db_user") - pubd_username = cfg.get("pubd_db_user") - only_one_pubd = cfg.getboolean("only_one_pubd", True) - prog_openssl = cfg.get("openssl", prog_openssl) - except: - rpkid_username = None - irdbd_username = None - pubd_username = None - rpkid_password = None - irdbd_password = None - pubd_password = None - only_one_pubd = True + cfg = rpki.config.parser(cfg_file, "yamltest", allow_missing = True) + + only_one_pubd = cfg.getboolean("only_one_pubd", True) + prog_openssl = cfg.get("openssl", prog_openssl) + + config_overrides = dict( + (k, cfg.get(k)) + for k in ("rpkid_sql_password", "irdbd_sql_password", "pubd_sql_password", + "rpkid_sql_username", "irdbd_sql_username", "pubd_sql_username") + if cfg.has_option(k)) # Start clean |