diff options
-rw-r--r-- | buildtools/python-header | 3 | ||||
-rw-r--r-- | buildtools/pywrap-header | 3 | ||||
-rwxr-xr-x | configure | 56 | ||||
-rw-r--r-- | configure.ac | 33 | ||||
-rw-r--r-- | pow/Makefile | 6 | ||||
-rw-r--r-- | pow/pywrap/Makefile | 6 | ||||
-rw-r--r-- | pow/pywrap/build.py | 4 | ||||
-rw-r--r-- | pow/pywrap/pywrap.c (renamed from pow/pywrap/python.c) | 0 | ||||
-rw-r--r-- | rpkid/backup-sql.in | 56 | ||||
-rw-r--r-- | rpkid/irbe_cli.in | 339 | ||||
-rw-r--r-- | rpkid/irdbd.in | 24 | ||||
-rw-r--r-- | rpkid/myrpki.in | 24 | ||||
-rw-r--r-- | rpkid/pubd.in | 24 | ||||
-rw-r--r-- | rpkid/rootd.in | 24 | ||||
-rw-r--r-- | rpkid/rpkid.in | 24 | ||||
-rw-r--r-- | rpkid/sql-setup.in | 110 | ||||
-rw-r--r-- | rpkid/start-servers.in | 86 |
17 files changed, 74 insertions, 748 deletions
diff --git a/buildtools/python-header b/buildtools/python-header new file mode 100644 index 00000000..24120c9d --- /dev/null +++ b/buildtools/python-header @@ -0,0 +1,3 @@ +#!@PYTHON@ +# -*- Python-*- @configure_input@ + diff --git a/buildtools/pywrap-header b/buildtools/pywrap-header new file mode 100644 index 00000000..94fb51b1 --- /dev/null +++ b/buildtools/pywrap-header @@ -0,0 +1,3 @@ +#!@PYWRAP@ +# -*- Python-*- @configure_input@ + @@ -700,6 +700,7 @@ OPENSSL_CONFIG_COMMAND XSLTPROC AWK PYTHON +PYWRAP LIBOBJS LTLIBOBJS' ac_subst_files='' @@ -4531,25 +4532,40 @@ fi # If any of this fails, we need to tell the user and give useful hint # on what to do next (doc reference, whatever). +if test $build_pywrap = yes +then + # Eventually this should be the installation directory, but + # we're not there yet. + + PYWRAP=`pwd`/pow/pywrap/pywrap +else + PYWRAP=$PYTHON +fi + + if test $build_python = yes then - ac_config_files="$ac_config_files rpkid/backup-sql" - ac_config_files="$ac_config_files rpkid/irbe_cli" + # These are plain Python scripts, do not require pywrap + ac_config_files="$ac_config_files rpkid/backup-sql:buildtools/python-header:rpkid/backup-sql.py" - ac_config_files="$ac_config_files rpkid/irdbd" + ac_config_files="$ac_config_files rpkid/sql-setup:buildtools/python-header:rpkid/sql-setup.py" - ac_config_files="$ac_config_files rpkid/myrpki" + ac_config_files="$ac_config_files rpkid/start-servers:buildtools/python-header:rpkid/start-servers.py" - ac_config_files="$ac_config_files rpkid/pubd" - ac_config_files="$ac_config_files rpkid/rootd" + # These use POW, so may require pywrap + ac_config_files="$ac_config_files rpkid/irbe_cli:buildtools/pywrap-header:rpkid/irbe_cli.py" - ac_config_files="$ac_config_files rpkid/rpkid" + ac_config_files="$ac_config_files rpkid/irdbd:buildtools/pywrap-header:rpkid/irdbd.py" - ac_config_files="$ac_config_files rpkid/sql-setup" + ac_config_files="$ac_config_files rpkid/myrpki:buildtools/pywrap-header:rpkid/myrpki.py" - ac_config_files="$ac_config_files rpkid/start-servers" + ac_config_files="$ac_config_files rpkid/pubd:buildtools/pywrap-header:rpkid/pubd.py" + + ac_config_files="$ac_config_files rpkid/rootd:buildtools/pywrap-header:rpkid/rootd.py" + + ac_config_files="$ac_config_files rpkid/rpkid:buildtools/pywrap-header:rpkid/rpkid.py" fi @@ -5163,15 +5179,15 @@ for ac_config_target in $ac_config_targets do case $ac_config_target in "rcynic/show.sh") CONFIG_FILES="$CONFIG_FILES rcynic/show.sh" ;; - "rpkid/backup-sql") CONFIG_FILES="$CONFIG_FILES rpkid/backup-sql" ;; - "rpkid/irbe_cli") CONFIG_FILES="$CONFIG_FILES rpkid/irbe_cli" ;; - "rpkid/irdbd") CONFIG_FILES="$CONFIG_FILES rpkid/irdbd" ;; - "rpkid/myrpki") CONFIG_FILES="$CONFIG_FILES rpkid/myrpki" ;; - "rpkid/pubd") CONFIG_FILES="$CONFIG_FILES rpkid/pubd" ;; - "rpkid/rootd") CONFIG_FILES="$CONFIG_FILES rpkid/rootd" ;; - "rpkid/rpkid") CONFIG_FILES="$CONFIG_FILES rpkid/rpkid" ;; - "rpkid/sql-setup") CONFIG_FILES="$CONFIG_FILES rpkid/sql-setup" ;; - "rpkid/start-servers") CONFIG_FILES="$CONFIG_FILES rpkid/start-servers" ;; + "rpkid/backup-sql") CONFIG_FILES="$CONFIG_FILES rpkid/backup-sql:buildtools/python-header:rpkid/backup-sql.py" ;; + "rpkid/sql-setup") CONFIG_FILES="$CONFIG_FILES rpkid/sql-setup:buildtools/python-header:rpkid/sql-setup.py" ;; + "rpkid/start-servers") CONFIG_FILES="$CONFIG_FILES rpkid/start-servers:buildtools/python-header:rpkid/start-servers.py" ;; + "rpkid/irbe_cli") CONFIG_FILES="$CONFIG_FILES rpkid/irbe_cli:buildtools/pywrap-header:rpkid/irbe_cli.py" ;; + "rpkid/irdbd") CONFIG_FILES="$CONFIG_FILES rpkid/irdbd:buildtools/pywrap-header:rpkid/irdbd.py" ;; + "rpkid/myrpki") CONFIG_FILES="$CONFIG_FILES rpkid/myrpki:buildtools/pywrap-header:rpkid/myrpki.py" ;; + "rpkid/pubd") CONFIG_FILES="$CONFIG_FILES rpkid/pubd:buildtools/pywrap-header:rpkid/pubd.py" ;; + "rpkid/rootd") CONFIG_FILES="$CONFIG_FILES rpkid/rootd:buildtools/pywrap-header:rpkid/rootd.py" ;; + "rpkid/rpkid") CONFIG_FILES="$CONFIG_FILES rpkid/rpkid:buildtools/pywrap-header:rpkid/rpkid.py" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "openssl/Makefile") CONFIG_FILES="$CONFIG_FILES openssl/Makefile" ;; "rcynic/Makefile") CONFIG_FILES="$CONFIG_FILES rcynic/Makefile" ;; @@ -5641,14 +5657,14 @@ $as_echo "$as_me: error: could not create $ac_file" >&2;} case $ac_file$ac_mode in "rcynic/show.sh":F) chmod +x rcynic/show.sh ;; "rpkid/backup-sql":F) chmod +x rpkid/backup-sql ;; + "rpkid/sql-setup":F) chmod +x rpkid/sql-setup ;; + "rpkid/start-servers":F) chmod +x rpkid/start-servers ;; "rpkid/irbe_cli":F) chmod +x rpkid/irbe_cli ;; "rpkid/irdbd":F) chmod +x rpkid/irdbd ;; "rpkid/myrpki":F) chmod +x rpkid/myrpki ;; "rpkid/pubd":F) chmod +x rpkid/pubd ;; "rpkid/rootd":F) chmod +x rpkid/rootd ;; "rpkid/rpkid":F) chmod +x rpkid/rpkid ;; - "rpkid/sql-setup":F) chmod +x rpkid/sql-setup ;; - "rpkid/start-servers":F) chmod +x rpkid/start-servers ;; esac done # for ac_tag diff --git a/configure.ac b/configure.ac index 8cfb7ce5..6b0495ed 100644 --- a/configure.ac +++ b/configure.ac @@ -233,17 +233,32 @@ fi # If any of this fails, we need to tell the user and give useful hint # on what to do next (doc reference, whatever). +if test $build_pywrap = yes +then + # Eventually this should be the installation directory, but + # we're not there yet. + + PYWRAP=`pwd`/pow/pywrap/pywrap +else + PYWRAP=$PYTHON +fi +AC_SUBST(PYWRAP) + if test $build_python = yes then - AC_CONFIG_FILES([rpkid/backup-sql], [chmod +x rpkid/backup-sql]) - AC_CONFIG_FILES([rpkid/irbe_cli], [chmod +x rpkid/irbe_cli]) - AC_CONFIG_FILES([rpkid/irdbd], [chmod +x rpkid/irdbd]) - AC_CONFIG_FILES([rpkid/myrpki], [chmod +x rpkid/myrpki]) - AC_CONFIG_FILES([rpkid/pubd], [chmod +x rpkid/pubd]) - AC_CONFIG_FILES([rpkid/rootd], [chmod +x rpkid/rootd]) - AC_CONFIG_FILES([rpkid/rpkid], [chmod +x rpkid/rpkid]) - AC_CONFIG_FILES([rpkid/sql-setup], [chmod +x rpkid/sql-setup]) - AC_CONFIG_FILES([rpkid/start-servers], [chmod +x rpkid/start-servers]) + + # These are plain Python scripts, do not require pywrap + AC_CONFIG_FILES([rpkid/backup-sql:buildtools/python-header:rpkid/backup-sql.py], [chmod +x rpkid/backup-sql]) + AC_CONFIG_FILES([rpkid/sql-setup:buildtools/python-header:rpkid/sql-setup.py], [chmod +x rpkid/sql-setup]) + AC_CONFIG_FILES([rpkid/start-servers:buildtools/python-header:rpkid/start-servers.py], [chmod +x rpkid/start-servers]) + + # These use POW, so may require pywrap + AC_CONFIG_FILES([rpkid/irbe_cli:buildtools/pywrap-header:rpkid/irbe_cli.py], [chmod +x rpkid/irbe_cli]) + AC_CONFIG_FILES([rpkid/irdbd:buildtools/pywrap-header:rpkid/irdbd.py], [chmod +x rpkid/irdbd]) + AC_CONFIG_FILES([rpkid/myrpki:buildtools/pywrap-header:rpkid/myrpki.py], [chmod +x rpkid/myrpki]) + AC_CONFIG_FILES([rpkid/pubd:buildtools/pywrap-header:rpkid/pubd.py], [chmod +x rpkid/pubd]) + AC_CONFIG_FILES([rpkid/rootd:buildtools/pywrap-header:rpkid/rootd.py], [chmod +x rpkid/rootd]) + AC_CONFIG_FILES([rpkid/rpkid:buildtools/pywrap-header:rpkid/rpkid.py], [chmod +x rpkid/rpkid]) fi # This isn't the complete list of Makefiles (let alone setup.py, etc diff --git a/pow/Makefile b/pow/Makefile index df1ea9fb..c5d267d2 100644 --- a/pow/Makefile +++ b/pow/Makefile @@ -12,15 +12,15 @@ SOURCES = POW-${VERSION}/lib/__init__.py \ POW-${VERSION}/dumpasn1.cfg \ POW-${VERSION}/POW.c -all: ${STAMP} pywrap/python +all: ${STAMP} pywrap/pywrap ${STAMP}: ${SOURCES} cd POW-${VERSION}; python setup.py build ln -sf POW-${VERSION}/build/lib.* buildlib touch $@ -pywrap/python: - cd pywrap; ${MAKE} python +pywrap/pywrap: + cd pywrap; ${MAKE} pywrap clean: rm -rf POW-${VERSION}/build buildlib diff --git a/pow/pywrap/Makefile b/pow/pywrap/Makefile index e065bbe6..7c37faab 100644 --- a/pow/pywrap/Makefile +++ b/pow/pywrap/Makefile @@ -1,9 +1,9 @@ # $Id$ -all: python +all: pywrap -python: python.c +pywrap: pywrap.c python build.py clean: - rm -f *.o python + rm -f *.o pywrap diff --git a/pow/pywrap/build.py b/pow/pywrap/build.py index 0160918f..d514be91 100644 --- a/pow/pywrap/build.py +++ b/pow/pywrap/build.py @@ -30,8 +30,8 @@ openssl_dir = os.path.realpath(os.path.join(os.getcwd(), "../../openssl/openssl" cmd = getvar("CC").split() cmd.append("-o") -cmd.append("python") -cmd.append("python.c") +cmd.append("pywrap") +cmd.append("pywrap.c") cmd.append("-Wl,-rpath,%s" % openssl_dir) cmd.append("-L%s" % openssl_dir) diff --git a/pow/pywrap/python.c b/pow/pywrap/pywrap.c index 10638721..10638721 100644 --- a/pow/pywrap/python.c +++ b/pow/pywrap/pywrap.c diff --git a/rpkid/backup-sql.in b/rpkid/backup-sql.in deleted file mode 100644 index 80c3d69f..00000000 --- a/rpkid/backup-sql.in +++ /dev/null @@ -1,56 +0,0 @@ -#!@PYTHON@ -# -*- Python -*- - -""" -Back up data from SQL databases, looking at config file to figure out -which databases and what credentials to use with them. - -For the moment, this just writes all the SQL to stdout. - -$Id$ - -Copyright (C) 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. -""" - -import subprocess, os, getopt, sys, time, 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) - elif o in ("-c", "--config"): - cfg_file = a - -cfg = rpki.config.parser(cfg_file, "myrpki") - -def dump(section): - subprocess.check_call( - ("mysqldump", "--add-drop-database", - "-u", cfg.get("sql-username", section = section), - "-p" + cfg.get("sql-password", section = section), - "-B", cfg.get("sql-database", section = section))) - -if cfg.getboolean("run_rpkid", False): - dump("irdbd") - dump("rpkid") - -if cfg.getboolean("run_pubd", False): - dump("pubd") diff --git a/rpkid/irbe_cli.in b/rpkid/irbe_cli.in deleted file mode 100644 index 1c482e3a..00000000 --- a/rpkid/irbe_cli.in +++ /dev/null @@ -1,339 +0,0 @@ -#!@PYTHON@ -# -*- Python -*- - -""" -Command line IR back-end control program for rpkid and pubd. - -$Id$ - -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. - -Portions copyright (C) 2007--2008 American Registry for Internet Numbers ("ARIN") - -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 ARIN DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL ARIN 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 getopt, sys, textwrap -import rpki.left_right, rpki.http, rpki.x509, rpki.config, rpki.log -import rpki.publication, rpki.async - -pem_out = None - -class UsageWrapper(textwrap.TextWrapper): - """ - Call interface around Python textwrap.Textwrapper class. - """ - - def __call__(self, *args): - """ - Format arguments, with TextWrapper indentation. - """ - return self.fill(textwrap.dedent(" ".join(args))) - -usage_fill = UsageWrapper(subsequent_indent = " " * 4) - -class reply_elt_mixin(object): - """ - Protocol mix-in for printout of reply PDUs. - """ - - is_cmd = False - - def client_reply_decode(self): - pass - - def client_reply_show(self): - print self.element_name - for i in self.attributes + self.elements: - if getattr(self, i) is not None: - print " %s: %s" % (i, getattr(self, i)) - -class cmd_elt_mixin(reply_elt_mixin): - """ - Protocol mix-in for command line client element PDUs. - """ - - is_cmd = True - - ## @var excludes - # XML attributes and elements that should not be allowed as command - # line arguments. - excludes = () - - @classmethod - def usage(cls): - """ - Generate usage message for this PDU. - """ - args = " ".join("--" + x + "=" for x in cls.attributes + cls.elements if x not in cls.excludes) - bools = " ".join("--" + x for x in cls.booleans) - if args and bools: - return args + " " + bools - else: - return args or bools - - def client_getopt(self, argv): - """ - Parse options for this class. - """ - opts, argv = getopt.getopt(argv, "", [x + "=" for x in self.attributes + self.elements if x not in self.excludes] + list(self.booleans)) - for o, a in opts: - o = o[2:] - handler = getattr(self, "client_query_" + o, None) - if handler is not None: - handler(a) - elif o in self.booleans: - setattr(self, o, True) - else: - assert o in self.attributes - setattr(self, o, a) - return argv - - def client_query_bpki_cert(self, arg): - """ - Special handler for --bpki_cert option. - """ - self.bpki_cert = rpki.x509.X509(Auto_file = arg) - - def client_query_glue(self, arg): - """ - Special handler for --bpki_glue option. - """ - self.bpki_glue = rpki.x509.X509(Auto_file = arg) - - def client_query_bpki_cms_cert(self, arg): - """ - Special handler for --bpki_cms_cert option. - """ - self.bpki_cms_cert = rpki.x509.X509(Auto_file = arg) - - def client_query_cms_glue(self, arg): - """ - Special handler for --bpki_cms_glue option. - """ - self.bpki_cms_glue = rpki.x509.X509(Auto_file = arg) - -class cmd_msg_mixin(object): - """ - Protocol mix-in for command line client message PDUs. - """ - - @classmethod - def usage(cls): - """ - Generate usage message for this PDU. - """ - for k, v in cls.pdus.items(): - if v.is_cmd: - print usage_fill(k, v.usage()) - -# left-right protcol - -class self_elt(cmd_elt_mixin, rpki.left_right.self_elt): - pass - -class bsc_elt(cmd_elt_mixin, rpki.left_right.bsc_elt): - - excludes = ("pkcs10_request",) - - def client_query_signing_cert(self, arg): - """--signing_cert option.""" - self.signing_cert = rpki.x509.X509(Auto_file = arg) - - def client_query_signing_cert_crl(self, arg): - """--signing_cert_crl option.""" - self.signing_cert_crl = rpki.x509.CRL(Auto_file = arg) - - def client_reply_decode(self): - global pem_out - if pem_out is not None and self.pkcs10_request is not None: - if isinstance(pem_out, str): - pem_out = open(pem_out, "w") - pem_out.write(self.pkcs10_request.get_PEM()) - -class parent_elt(cmd_elt_mixin, rpki.left_right.parent_elt): - pass - -class child_elt(cmd_elt_mixin, rpki.left_right.child_elt): - pass - -class repository_elt(cmd_elt_mixin, rpki.left_right.repository_elt): - pass - -class list_published_objects_elt(cmd_elt_mixin, rpki.left_right.list_published_objects_elt): - excludes = ("uri",) - -class list_received_resources_elt(cmd_elt_mixin, rpki.left_right.list_received_resources_elt): - excludes = ("parent_handle", "notBefore", "notAfter", "uri", "sia_uri", "aia_uri", "asn", "ipv4", "ipv6") - -class report_error_elt(reply_elt_mixin, rpki.left_right.report_error_elt): - pass - -class left_right_msg(cmd_msg_mixin, rpki.left_right.msg): - pdus = dict((x.element_name, x) - for x in (self_elt, bsc_elt, parent_elt, child_elt, repository_elt, - list_published_objects_elt, list_received_resources_elt, report_error_elt)) - -class left_right_sax_handler(rpki.left_right.sax_handler): - pdu = left_right_msg - -class left_right_cms_msg(rpki.left_right.cms_msg): - saxify = left_right_sax_handler.saxify - -# Publication protocol - -class config_elt(cmd_elt_mixin, rpki.publication.config_elt): - - def client_query_bpki_crl(self, arg): - """ - Special handler for --bpki_crl option. - """ - self.bpki_crl = rpki.x509.CRL(Auto_file = arg) - -class client_elt(cmd_elt_mixin, rpki.publication.client_elt): - pass - -class certificate_elt(cmd_elt_mixin, rpki.publication.certificate_elt): - pass - -class crl_elt(cmd_elt_mixin, rpki.publication.crl_elt): - pass - -class manifest_elt(cmd_elt_mixin, rpki.publication.manifest_elt): - pass - -class roa_elt(cmd_elt_mixin, rpki.publication.roa_elt): - pass - -class report_error_elt(reply_elt_mixin, rpki.publication.report_error_elt): - pass - -class publication_msg(cmd_msg_mixin, rpki.publication.msg): - pdus = dict((x.element_name, x) - for x in (config_elt, client_elt, certificate_elt, crl_elt, manifest_elt, roa_elt, report_error_elt)) - -class publication_sax_handler(rpki.publication.sax_handler): - pdu = publication_msg - -class publication_cms_msg(rpki.publication.cms_msg): - saxify = publication_sax_handler.saxify - -# Usage - -top_opts = ["config=", "help", "pem_out=", "quiet", "verbose"] - -def usage(code = 1): - print __doc__.strip() - print - print "Usage:" - print - print "# Top-level options:" - print usage_fill(*["--" + x for x in top_opts]) - print - print "# left-right protocol:" - left_right_msg.usage() - print - print "# publication protocol:" - publication_msg.usage() - sys.exit(code) - -# Main program - -rpki.log.init("irbe_cli") - -argv = sys.argv[1:] - -if not argv: - usage(0) - -cfg_file = "irbe.conf" -verbose = True - -opts, argv = getopt.getopt(argv, "c:hpqv?", top_opts) -for o, a in opts: - if o in ("-?", "-h", "--help"): - usage(0) - elif o in ("-c", "--config"): - cfg_file = a - elif o in ("-p", "--pem_out"): - pem_out = a - elif o in ("-q", "--quiet"): - verbose = False - elif o in ("-v", "--verbose"): - verbose = True - -if not argv: - usage(1) - -cfg = rpki.config.parser(cfg_file, "irbe_cli") - -q_msg_left_right = [] -q_msg_publication = [] - -while argv: - if argv[0] in left_right_msg.pdus: - q_pdu = left_right_msg.pdus[argv[0]]() - q_msg = q_msg_left_right - elif argv[0] in publication_msg.pdus: - q_pdu = publication_msg.pdus[argv[0]]() - q_msg = q_msg_publication - else: - usage(1) - argv = q_pdu.client_getopt(argv[1:]) - q_msg.append(q_pdu) - -if q_msg_left_right: - - class left_right_proto(object): - cms_msg = left_right_cms_msg - msg = left_right_msg - - call_rpkid = rpki.async.sync_wrapper(rpki.http.caller( - proto = left_right_proto, - client_key = rpki.x509.RSA( Auto_file = cfg.get("rpkid-irbe-key")), - client_cert = rpki.x509.X509(Auto_file = cfg.get("rpkid-irbe-cert")), - server_ta = rpki.x509.X509(Auto_file = cfg.get("rpkid-bpki-ta")), - server_cert = rpki.x509.X509(Auto_file = cfg.get("rpkid-cert")), - url = cfg.get("rpkid-url"), - debug = verbose)) - - call_rpkid(*q_msg_left_right) - -if q_msg_publication: - - class publication_proto(object): - msg = publication_msg - cms_msg = publication_cms_msg - - call_pubd = rpki.async.sync_wrapper(rpki.http.caller( - proto = publication_proto, - client_key = rpki.x509.RSA( Auto_file = cfg.get("pubd-irbe-key")), - client_cert = rpki.x509.X509(Auto_file = cfg.get("pubd-irbe-cert")), - server_ta = rpki.x509.X509(Auto_file = cfg.get("pubd-bpki-ta")), - server_cert = rpki.x509.X509(Auto_file = cfg.get("pubd-cert")), - url = cfg.get("pubd-url")), - debug = verbose) - - call_pubd(*q_msg_publication) diff --git a/rpkid/irdbd.in b/rpkid/irdbd.in deleted file mode 100644 index 95ab6107..00000000 --- a/rpkid/irdbd.in +++ /dev/null @@ -1,24 +0,0 @@ -#!@PYTHON@ -# -*- Python -*- - -""" -$Id$ - -Copyright (C) 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. -""" - -if __name__ == "__main__": - import rpki.irdbd - rpki.irdbd.main() diff --git a/rpkid/myrpki.in b/rpkid/myrpki.in deleted file mode 100644 index f17564b2..00000000 --- a/rpkid/myrpki.in +++ /dev/null @@ -1,24 +0,0 @@ -#!@PYTHON@ -# -*- Python -*- - -""" -$Id$ - -Copyright (C) 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. -""" - -if __name__ == "__main__": - import rpki.myrpki - rpki.myrpki.main() diff --git a/rpkid/pubd.in b/rpkid/pubd.in deleted file mode 100644 index 32ee4196..00000000 --- a/rpkid/pubd.in +++ /dev/null @@ -1,24 +0,0 @@ -#!@PYTHON@ -# -*- Python -*- - -""" -$Id$ - -Copyright (C) 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. -""" - -if __name__ == "__main__": - import rpki.pubd - rpki.pubd.main() diff --git a/rpkid/rootd.in b/rpkid/rootd.in deleted file mode 100644 index d5038d77..00000000 --- a/rpkid/rootd.in +++ /dev/null @@ -1,24 +0,0 @@ -#!@PYTHON@ -# -*- Python -*- - -""" -$Id$ - -Copyright (C) 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. -""" - -if __name__ == "__main__": - import rpki.rootd - rpki.rootd.main() diff --git a/rpkid/rpkid.in b/rpkid/rpkid.in deleted file mode 100644 index 45659539..00000000 --- a/rpkid/rpkid.in +++ /dev/null @@ -1,24 +0,0 @@ -#!@PYTHON@ -# -*- Python -*- - -""" -$Id$ - -Copyright (C) 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. -""" - -if __name__ == "__main__": - import rpki.rpkid - rpki.rpkid.main() diff --git a/rpkid/sql-setup.in b/rpkid/sql-setup.in deleted file mode 100644 index 081441aa..00000000 --- a/rpkid/sql-setup.in +++ /dev/null @@ -1,110 +0,0 @@ -#!@PYTHON@ -# -*- Python -*- - -""" -Automated setup of all the pesky SQL stuff we need. Prompts for MySQL -root password, pulls other information from myrpki.conf. - -$Id$ - -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. -""" - -from __future__ import with_statement - -import os, getopt, sys, time, rpki.config, getpass, warnings - -# Silence warning while loading MySQLdb in Python 2.6, sigh -if hasattr(warnings, "catch_warnings"): - with warnings.catch_warnings(): - warnings.simplefilter("ignore", DeprecationWarning) - import MySQLdb -else: - import MySQLdb - -import _mysql_exceptions - -warnings.simplefilter("error", _mysql_exceptions.Warning) - -schema_dir = os.path.normpath(sys.path[0]) - -def read_schema(filename): - """ - Convert an SQL file into a list of SQL statements. - """ - lines = [] - f = open(filename) - for line in f: - line = " ".join(line.split()) - if line and not line.startswith("--"): - lines.append(line) - f.close() - return [statement.strip() for statement in " ".join(lines).rstrip(";").split(";")] - -def sql_setup(name): - """ - Create a new SQL database and construct all its tables. - """ - database = cfg.get("sql-database", section = name) - username = cfg.get("sql-username", section = name) - password = cfg.get("sql-password", section = name) - schema = read_schema(os.path.join(schema_dir, "%s.sql" % name)) - - print "Creating database", database - cur = rootdb.cursor() - try: - cur.execute("DROP DATABASE IF EXISTS %s" % database) - except: - pass - cur.execute("CREATE DATABASE %s" % database) - cur.execute("GRANT ALL ON %s.* TO %s@localhost IDENTIFIED BY %%s" % (database, username), (password,)) - rootdb.commit() - - db = MySQLdb.connect(db = database, user = username, passwd = password) - cur = db.cursor() - for statement in schema: - if statement.upper().startswith("DROP TABLE"): - continue - if verbose: - print "+", statement - cur.execute(statement) - db.commit() - db.close() - -cfg_file = "myrpki.conf" - -verbose = False - -opts, argv = getopt.getopt(sys.argv[1:], "c:hv?", ["config=", "help", "verbose"]) -for o, a in opts: - if o in ("-h", "--help", "-?"): - print __doc__ - sys.exit(0) - if o in ("-v", "--verbose"): - verbose = True - if o in ("-c", "--config"): - cfg_file = a - -cfg = rpki.config.parser(cfg_file, "myrpki") - -rootdb = MySQLdb.connect(db = "mysql", user = "root", passwd = getpass.getpass("Please enter your MySQL root password: ")) - -sql_setup("irdbd") -sql_setup("rpkid") - -if cfg.getboolean("run_pubd", False): - sql_setup("pubd") - -rootdb.close() diff --git a/rpkid/start-servers.in b/rpkid/start-servers.in deleted file mode 100644 index 50301060..00000000 --- a/rpkid/start-servers.in +++ /dev/null @@ -1,86 +0,0 @@ -#!@PYTHON@ -# -*- Python -*- - -""" -Start servers, logging to files, looking at config file to figure out -which servers the user wants started. - -$Id$ - -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. - -Portions copyright (C) 2007--2008 American Registry for Internet Numbers ("ARIN") - -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 ARIN DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL ARIN 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 subprocess, os, getopt, sys, time, rpki.config - -rpkid_dir = os.path.normpath(sys.path[0]) - -os.environ["TZ"] = "UTC" -time.tzset() - -cfg_file = "myrpki.conf" -debug = False -piddir = None - -opts, argv = getopt.getopt(sys.argv[1:], "c:dhp:?", ["config=", "debug" "help", "piddir="]) -for o, a in opts: - if o in ("-h", "--help", "-?"): - print __doc__ - sys.exit(0) - elif o in ("-c", "--config"): - cfg_file = a - elif o in ("-d", "--debug"): - debug = True - elif o in ("-p", "--piddir"): - piddir = a - -cfg = rpki.config.parser(cfg_file, "myrpki") - -def run(name): - cmd = (sys.executable, os.path.join(rpkid_dir, name + ".py"), "-c", cfg_file) - if debug: - proc = subprocess.Popen(cmd + ("-d",), stdout = open(name + ".log", "a"), stderr = subprocess.STDOUT) - else: - proc = subprocess.Popen(cmd) - if proc.poll() is None: - print "Started %r, pid %s" % (name, proc.pid) - if piddir is not None: - open(os.path.join(piddir, "%s.pid" % name), "w").write("%d\n" % proc.pid) - else: - print "Problem starting %r, pid %s" % (name, proc.pid) - -if cfg.getboolean("run_rpkid", False): - run("irdbd") - run("rpkid") - -if cfg.getboolean("run_pubd", False): - run("pubd") - -if cfg.getboolean("run_rootd", False): - run("rootd") |