aboutsummaryrefslogtreecommitdiff
path: root/rpki
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2014-07-03 19:21:31 +0000
committerRob Austein <sra@hactrn.net>2014-07-03 19:21:31 +0000
commit1fde024c07a0dc681a534a4197a18226737ebd19 (patch)
tree872843c4c0ed192e9ff824f8e0969cc295b915e8 /rpki
parentcd264895b35e5345dbbe14539614bb6e23bddc0e (diff)
Get rid of the <config/> element of the publication-control protocol, it's a historical relic.
Update example PDUs for publication and publication-control protocols. svn path=/branches/tk705/; revision=5883
Diffstat (limited to 'rpki')
-rw-r--r--rpki/irdb/zookeeper.py11
-rw-r--r--rpki/pubd.py6
-rw-r--r--rpki/publication_control.py68
-rw-r--r--rpki/relaxng.py59
-rw-r--r--rpki/sql_schemas.py8
5 files changed, 5 insertions, 147 deletions
diff --git a/rpki/irdb/zookeeper.py b/rpki/irdb/zookeeper.py
index 2c600ee5..49229463 100644
--- a/rpki/irdb/zookeeper.py
+++ b/rpki/irdb/zookeeper.py
@@ -536,11 +536,6 @@ class Zookeeper(object):
if self.run_pubd:
updates = []
- updates.append(
- rpki.publication_control.config_elt.make_pdu(
- action = "set",
- bpki_crl = self.server_ca.latest_crl))
-
updates.extend(
rpki.publication_control.client_elt.make_pdu(
action = "set",
@@ -1530,12 +1525,6 @@ class Zookeeper(object):
if not self.run_pubd:
return
- # Make sure that pubd's BPKI CRL is up to date.
-
- self.call_pubd(rpki.publication_control.config_elt.make_pdu(
- action = "set",
- bpki_crl = self.server_ca.latest_crl))
-
# See what pubd already has on file
pubd_reply = self.call_pubd(rpki.publication_control.client_elt.make_pdu(action = "list"))
diff --git a/rpki/pubd.py b/rpki/pubd.py
index e932f686..5d7c4911 100644
--- a/rpki/pubd.py
+++ b/rpki/pubd.py
@@ -97,6 +97,7 @@ class main(object):
self.irbe_cert = rpki.x509.X509(Auto_update = self.cfg.get("irbe-cert"))
self.pubd_cert = rpki.x509.X509(Auto_update = self.cfg.get("pubd-cert"))
self.pubd_key = rpki.x509.RSA( Auto_update = self.cfg.get("pubd-key"))
+ self.pubd_crl = rpki.x509.CRL( Auto_update = self.cfg.get("pubd-crl"))
self.http_server_host = self.cfg.get("server-host", "")
self.http_server_port = self.cfg.getint("server-port")
@@ -144,7 +145,7 @@ class main(object):
def done(r_msg):
self.sql.sweep()
cb(code = 200,
- body = rpki.publication.cms_msg().wrap(r_msg, self.pubd_key, self.pubd_cert, config.bpki_crl))
+ body = rpki.publication.cms_msg().wrap(r_msg, self.pubd_key, self.pubd_cert, self.pubd_crl))
try:
match = self.client_url_regexp.search(path)
@@ -154,9 +155,6 @@ class main(object):
client = rpki.publication_control.client_elt.sql_fetch_where1(self, "client_handle = %s", (client_handle,))
if client is None:
raise rpki.exceptions.ClientNotFound("Could not find client %s" % client_handle)
- config = rpki.publication_control.config_elt.fetch(self)
- if config is None or config.bpki_crl is None:
- raise rpki.exceptions.CMSCRLNotSet
q_cms = rpki.publication.cms_msg(DER = query)
q_msg = q_cms.unwrap((self.bpki_ta, client.bpki_cert, client.bpki_glue))
q_cms.check_replay_sql(client, client.client_handle)
diff --git a/rpki/publication_control.py b/rpki/publication_control.py
index bd6a8db2..101592fe 100644
--- a/rpki/publication_control.py
+++ b/rpki/publication_control.py
@@ -59,71 +59,7 @@ class publication_control_namespace(object):
nsmap = { None : xmlns }
-class control_elt(rpki.xml_utils.data_elt, rpki.sql.sql_persistent, publication_control_namespace):
- """
- Virtual class for control channel objects.
- """
-
- pass
-
-
-class config_elt(control_elt):
- """
- <config/> element. This is a little weird because there should
- never be more than one row in the SQL config table, but we have to
- put the BPKI CRL somewhere and SQL is the least bad place available.
-
- So we reuse a lot of the SQL machinery, but we nail config_id at 1,
- we don't expose it in the XML protocol, and we only support the get
- and set actions.
- """
-
- attributes = ("action", "tag")
- element_name = "config"
- elements = ("bpki_crl",)
-
- sql_template = rpki.sql.template(
- "config",
- "config_id",
- ("bpki_crl", rpki.x509.CRL))
-
- wired_in_config_id = 1
-
- def startElement(self, stack, name, attrs):
- """
- StartElement() handler for config object. This requires special
- handling because of the weird way we treat config_id.
- """
- control_elt.startElement(self, stack, name, attrs)
- self.config_id = self.wired_in_config_id
-
- @classmethod
- def fetch(cls, gctx):
- """
- Fetch the config object from SQL. This requires special handling
- because of the weird way we treat config_id.
- """
- return cls.sql_fetch(gctx, cls.wired_in_config_id)
-
- def serve_set(self, r_msg, cb, eb):
- """
- Handle a set action. This requires special handling because
- config doesn't support the create method.
- """
- if self.sql_fetch(self.gctx, self.config_id) is None:
- control_elt.serve_create(self, r_msg, cb, eb)
- else:
- control_elt.serve_set(self, r_msg, cb, eb)
-
- def serve_fetch_one_maybe(self):
- """
- Find the config object on which a get or set method should
- operate.
- """
- return self.sql_fetch(self.gctx, self.config_id)
-
-
-class client_elt(control_elt):
+class client_elt(rpki.xml_utils.data_elt, rpki.sql.sql_persistent, publication_control_namespace):
"""
<client/> element.
"""
@@ -240,7 +176,7 @@ class msg(rpki.xml_utils.msg, publication_control_namespace):
## @var pdus
# Dispatch table of PDUs for this protocol.
- pdus = dict((x.element_name, x) for x in (config_elt, client_elt, report_error_elt))
+ pdus = dict((x.element_name, x) for x in (client_elt, report_error_elt))
def serve_top_level(self, gctx, cb):
"""
diff --git a/rpki/relaxng.py b/rpki/relaxng.py
index 04f51b6c..3c81a144 100644
--- a/rpki/relaxng.py
+++ b/rpki/relaxng.py
@@ -1534,15 +1534,11 @@ publication_control = lxml.etree.RelaxNG(lxml.etree.fromstring(r'''<?xml version
</start>
<!-- PDUs allowed in a query -->
<define name="query_elt">
- <choice>
- <ref name="config_query"/>
- <ref name="client_query"/>
- </choice>
+ <ref name="client_query"/>
</define>
<!-- PDUs allowed in a reply -->
<define name="reply_elt">
<choice>
- <ref name="config_reply"/>
<ref name="client_reply"/>
<ref name="report_error_reply"/>
</choice>
@@ -1587,59 +1583,6 @@ publication_control = lxml.etree.RelaxNG(lxml.etree.fromstring(r'''<?xml version
<param name="pattern">[\-_A-Za-z0-9/]+</param>
</data>
</define>
- <!--
- <config/> element
- config_handle attribute, create, list, and destroy commands omitted deliberately, see code for details
- -->
- <define name="config_payload">
- <optional>
- <element name="bpki_crl">
- <ref name="base64"/>
- </element>
- </optional>
- </define>
- <define name="config_query" combine="choice">
- <element name="config">
- <attribute name="action">
- <value>set</value>
- </attribute>
- <optional>
- <ref name="tag"/>
- </optional>
- <ref name="config_payload"/>
- </element>
- </define>
- <define name="config_reply" combine="choice">
- <element name="config">
- <attribute name="action">
- <value>set</value>
- </attribute>
- <optional>
- <ref name="tag"/>
- </optional>
- </element>
- </define>
- <define name="config_query" combine="choice">
- <element name="config">
- <attribute name="action">
- <value>get</value>
- </attribute>
- <optional>
- <ref name="tag"/>
- </optional>
- </element>
- </define>
- <define name="config_reply" combine="choice">
- <element name="config">
- <attribute name="action">
- <value>get</value>
- </attribute>
- <optional>
- <ref name="tag"/>
- </optional>
- <ref name="config_payload"/>
- </element>
- </define>
<!-- <client/> element -->
<define name="client_handle">
<attribute name="client_handle">
diff --git a/rpki/sql_schemas.py b/rpki/sql_schemas.py
index d9ccb3e4..b85c3dd9 100644
--- a/rpki/sql_schemas.py
+++ b/rpki/sql_schemas.py
@@ -266,17 +266,9 @@ pubd = '''-- $Id: pubd.sql 5881 2014-07-03 16:55:02Z sra $
-- SQL objects needed by pubd.py.
--- The config table is weird because it only has one row.
-
DROP TABLE IF EXISTS client;
DROP TABLE IF EXISTS config;
-CREATE TABLE config (
- config_id SERIAL NOT NULL,
- bpki_crl LONGBLOB,
- PRIMARY KEY (config_id)
-) ENGINE=InnoDB;
-
CREATE TABLE client (
client_id SERIAL NOT NULL,
client_handle VARCHAR(255) NOT NULL,