From e45c3728b9c06ffa14a5e628276900dc79e2fea6 Mon Sep 17 00:00:00 2001 From: Claudio Jeker Date: Wed, 1 Dec 2021 09:03:20 +0000 Subject: Add some RRDP specific regress tests. OK benno@ --- regress/usr.sbin/rpki-client/Makefile.inc | 35 ++- regress/usr.sbin/rpki-client/rrdp/billion_lol.xml | 17 ++ regress/usr.sbin/rpki-client/rrdp/delta.xml | 6 + regress/usr.sbin/rpki-client/rrdp/notification.xml | 104 +++++++ regress/usr.sbin/rpki-client/rrdp/rrdp-r1.out | 4 + regress/usr.sbin/rpki-client/rrdp/rrdp-r2.out | 104 +++++++ regress/usr.sbin/rpki-client/rrdp/rrdp-r3.out | 18 ++ regress/usr.sbin/rpki-client/rrdp/rrdp-r4.out | 13 + regress/usr.sbin/rpki-client/rrdp/rrdp-r5.out | 2 + regress/usr.sbin/rpki-client/rrdp/rrdp-r6.out | 2 + regress/usr.sbin/rpki-client/rrdp/snapshot.xml | 80 +++++ regress/usr.sbin/rpki-client/rrdp/xxe.xml | 4 + regress/usr.sbin/rpki-client/test-rrdp.c | 338 +++++++++++++++++++++ 13 files changed, 726 insertions(+), 1 deletion(-) create mode 100644 regress/usr.sbin/rpki-client/rrdp/billion_lol.xml create mode 100644 regress/usr.sbin/rpki-client/rrdp/delta.xml create mode 100644 regress/usr.sbin/rpki-client/rrdp/notification.xml create mode 100644 regress/usr.sbin/rpki-client/rrdp/rrdp-r1.out create mode 100644 regress/usr.sbin/rpki-client/rrdp/rrdp-r2.out create mode 100644 regress/usr.sbin/rpki-client/rrdp/rrdp-r3.out create mode 100644 regress/usr.sbin/rpki-client/rrdp/rrdp-r4.out create mode 100644 regress/usr.sbin/rpki-client/rrdp/rrdp-r5.out create mode 100644 regress/usr.sbin/rpki-client/rrdp/rrdp-r6.out create mode 100644 regress/usr.sbin/rpki-client/rrdp/snapshot.xml create mode 100644 regress/usr.sbin/rpki-client/rrdp/xxe.xml create mode 100644 regress/usr.sbin/rpki-client/test-rrdp.c (limited to 'regress/usr.sbin') diff --git a/regress/usr.sbin/rpki-client/Makefile.inc b/regress/usr.sbin/rpki-client/Makefile.inc index 3645310f4df..9244b11bf83 100644 --- a/regress/usr.sbin/rpki-client/Makefile.inc +++ b/regress/usr.sbin/rpki-client/Makefile.inc @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.inc,v 1.15 2021/10/24 17:54:28 claudio Exp $ +# $OpenBSD: Makefile.inc,v 1.16 2021/12/01 09:03:19 claudio Exp $ .PATH: ${.CURDIR}/../../../../usr.sbin/rpki-client @@ -8,6 +8,7 @@ PROGS += test-gbr PROGS += test-mft PROGS += test-roa PROGS += test-tal +PROGS += test-rrdp .for p in ${PROGS} REGRESS_TARGETS += run-regress-$p @@ -50,3 +51,35 @@ SRCS_test-tal+= test-tal.c tal.c ip.c io.c log.c validate.c \ encoding.c print.c dummy.c run-regress-test-tal: test-tal ./test-tal -v ${.CURDIR}/../tal/*.tal + +SRCS_test-rrdp+= test-rrdp.c rrdp_delta.c rrdp_notification.c \ + rrdp_snapshot.c rrdp_util.c \ + log.c encoding.c ip.c validate.c dummy.c +LDADD_test-rrdp+= -lexpat ${LDADD} +DPADD_test-rrdp+= ${LIBEXPAT} ${DPADD} +run-regress-test-rrdp: test-rrdp + ./test-rrdp \ + -n < ${.CURDIR}/../rrdp/notification.xml 2>&1 | tee rrdp-r1.out + cmp ${.CURDIR}/../rrdp/rrdp-r1.out rrdp-r1.out + + ./test-rrdp -S 8fe05c2e-047d-49e7-8398-cd4250a572b1 -N 50500 \ + -n < ${.CURDIR}/../rrdp/notification.xml 2>&1 | tee rrdp-r2.out + cmp ${.CURDIR}/../rrdp/rrdp-r2.out rrdp-r2.out + + ./test-rrdp -S 9b3f7e31-4979-ef8c-d818-73e4dadc3e6b -N 13755 \ + -H 27571e365a4c87b51a03731415ce2118cc268d686db3209ae752f01ba2d74bc5 \ + -d < ${.CURDIR}/../rrdp/delta.xml 2>&1 | tee rrdp-r3.out + cmp ${.CURDIR}/../rrdp/rrdp-r3.out rrdp-r3.out + + ./test-rrdp -S 7e7d2563-5bbb-40b0-8723-6a2e90c85d9e -N 28483 \ + -H 2a051bfd199150fe6bcdc777d09e70fe1acdf239fbf98ba378a793685e5adb21 \ + -s < ${.CURDIR}/../rrdp/snapshot.xml 2>&1 | tee rrdp-r4.out + cmp ${.CURDIR}/../rrdp/rrdp-r4.out rrdp-r4.out + + ./test-rrdp \ + -n < ${.CURDIR}/../rrdp/xxe.xml 2>&1 | tee rrdp-r5.out + cmp ${.CURDIR}/../rrdp/rrdp-r5.out rrdp-r5.out + + ./test-rrdp \ + -n < ${.CURDIR}/../rrdp/billion_lol.xml 2>&1 | tee rrdp-r6.out + cmp ${.CURDIR}/../rrdp/rrdp-r6.out rrdp-r6.out diff --git a/regress/usr.sbin/rpki-client/rrdp/billion_lol.xml b/regress/usr.sbin/rpki-client/rrdp/billion_lol.xml new file mode 100644 index 00000000000..dc79bdb08f9 --- /dev/null +++ b/regress/usr.sbin/rpki-client/rrdp/billion_lol.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + +]> + +&lol9; + diff --git a/regress/usr.sbin/rpki-client/rrdp/delta.xml b/regress/usr.sbin/rpki-client/rrdp/delta.xml new file mode 100644 index 00000000000..3a16409f8e1 --- /dev/null +++ b/regress/usr.sbin/rpki-client/rrdp/delta.xml @@ -0,0 +1,6 @@ + + +MIICDDCB9QIBATANBgkqhkiG9w0BAQsFADAzMTEwLwYDVQQDEyg5YzExMTM5YWU1NTNkNmRjNzMwNzg4N2Y0NjdlNDIwNzg4MDA0NWViFw0yMTExMjQxMjU4MzlaFw0yMTExMjUxMjU4MzlaMFwwFQIEAn7YkhcNMjExMTI0MTI1NzM4WjAVAgQFTTrHFw0yMTExMjQwMDIwMThaMBUCBAVOq8cXDTIxMTEyNDA4MjAyM1owFQIEBU7nwxcNMjExMTI0MTI1ODM5WqAwMC4wHwYDVR0jBBgwFoAUnBETmuVT1txzB4h/Rn5CB4gAReswCwYDVR0UBAQCAgbkMA0GCSq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XCbWEbvU7Ru5GCIGqHNbA09KPxgkE1Y7eVYBL13JRPGMgee8E7mAu71g5kBe3D173TCwgg6OBO2bStqDzDVXoe84KeofW978x/EiLaKOS7yblckZZlA5feNOVKz9Fw3IoGM4VuveuThQFQlgXbbwbXWptseJoBahVYX5U0oM6aBrJ2v4LisEXB/o9x8UA== + diff --git a/regress/usr.sbin/rpki-client/rrdp/notification.xml b/regress/usr.sbin/rpki-client/rrdp/notification.xml new file mode 100644 index 00000000000..c48dee34bf9 --- /dev/null +++ b/regress/usr.sbin/rpki-client/rrdp/notification.xml @@ -0,0 +1,104 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/regress/usr.sbin/rpki-client/rrdp/rrdp-r1.out b/regress/usr.sbin/rpki-client/rrdp/rrdp-r1.out new file mode 100644 index 00000000000..6498623c03f --- /dev/null +++ b/regress/usr.sbin/rpki-client/rrdp/rrdp-r1.out @@ -0,0 +1,4 @@ +test-rrdp: session_id: 8fe05c2e-047d-49e7-8398-cd4250a572b1, serial: 50550 +test-rrdp: snapshot_uri: https://rpki.example.com/8fe05c2e-047d-49e7-8398-cd4250a572b1/50550/snapshot.xml +test-rrdp: snapshot hash: AE52F78BCB1B258A1DA924122971B0FDDFCE4C01B2B2DBA59C9B28EF1D94C02B +OK diff --git a/regress/usr.sbin/rpki-client/rrdp/rrdp-r2.out b/regress/usr.sbin/rpki-client/rrdp/rrdp-r2.out new file mode 100644 index 00000000000..d5a3ef61bb5 --- /dev/null +++ b/regress/usr.sbin/rpki-client/rrdp/rrdp-r2.out @@ -0,0 +1,104 @@ +test-rrdp: session_id: 8fe05c2e-047d-49e7-8398-cd4250a572b1, serial: 50550 +test-rrdp: snapshot_uri: https://rpki.example.com/8fe05c2e-047d-49e7-8398-cd4250a572b1/50550/snapshot.xml +test-rrdp: snapshot hash: AE52F78BCB1B258A1DA924122971B0FDDFCE4C01B2B2DBA59C9B28EF1D94C02B +test-rrdp: delta serial 50501 uri: https://rpki.example.com/8fe05c2e-047d-49e7-8398-cd4250a572b1/50501/delta.xml +test-rrdp: delta hash: 40521FB9995ACA55D39360985C336619E08072A6AFFFCE97753E701A0D65D57B +test-rrdp: delta serial 50502 uri: https://rpki.example.com/8fe05c2e-047d-49e7-8398-cd4250a572b1/50502/delta.xml +test-rrdp: delta hash: 1036A71DF3129449E1403F3BEACFA427D59659FAC0B45C9E3DFFDBEBDB17D722 +test-rrdp: delta serial 50503 uri: https://rpki.example.com/8fe05c2e-047d-49e7-8398-cd4250a572b1/50503/delta.xml +test-rrdp: delta hash: E8DE1E10D05734BB9EFE65202B96023D3770F0B8FD457249676214612F4685B3 +test-rrdp: delta serial 50504 uri: https://rpki.example.com/8fe05c2e-047d-49e7-8398-cd4250a572b1/50504/delta.xml +test-rrdp: delta hash: CDCD746257A0F35BBCE0B1832C2DF4CF25751C281FDE23CAE8B17F607F1E82E1 +test-rrdp: delta serial 50505 uri: https://rpki.example.com/8fe05c2e-047d-49e7-8398-cd4250a572b1/50505/delta.xml +test-rrdp: delta hash: 50C95FF4B63C03836FE291AFCA61FDA25C96BC0D280E421DDDC307E591FE8F81 +test-rrdp: delta serial 50506 uri: https://rpki.example.com/8fe05c2e-047d-49e7-8398-cd4250a572b1/50506/delta.xml +test-rrdp: delta hash: 7C9C62DA4DD109E5151FCC0EA366DB343E35AB7F2A62D81D6C54EEE1E1FD72B1 +test-rrdp: delta serial 50507 uri: https://rpki.example.com/8fe05c2e-047d-49e7-8398-cd4250a572b1/50507/delta.xml +test-rrdp: delta hash: 20360D8B294E3A6E62DE2AF58955AFE601507231E6937B375DE0C047A69CD9C1 +test-rrdp: delta serial 50508 uri: https://rpki.example.com/8fe05c2e-047d-49e7-8398-cd4250a572b1/50508/delta.xml +test-rrdp: delta hash: B4AE54C1207EC9A12A5E20091004830FB3D146F62B2396A6C3DE2AB0795ED2E7 +test-rrdp: delta serial 50509 uri: https://rpki.example.com/8fe05c2e-047d-49e7-8398-cd4250a572b1/50509/delta.xml +test-rrdp: delta hash: FCD7FE3D59F4B8DAA40920C7B3C5C4D149660AFD35DFCA53EDE7671919802CFB +test-rrdp: delta serial 50510 uri: https://rpki.example.com/8fe05c2e-047d-49e7-8398-cd4250a572b1/50510/delta.xml +test-rrdp: delta hash: 6D8D296CA28CA390B761D25BDB69EAA0086242911A90965C7436D602B4190B66 +test-rrdp: delta serial 50511 uri: https://rpki.example.com/8fe05c2e-047d-49e7-8398-cd4250a572b1/50511/delta.xml +test-rrdp: delta hash: 9015620F5B20DBA3DEDC63F90C0CFAB5DD3816217976C6DCC4A68D5555649DC9 +test-rrdp: delta serial 50512 uri: https://rpki.example.com/8fe05c2e-047d-49e7-8398-cd4250a572b1/50512/delta.xml +test-rrdp: delta hash: 155C0F96DE414AC4CA7D60DE7B1ACBECDF5B192CCAE6AF3C78F06FFF212138F4 +test-rrdp: delta serial 50513 uri: https://rpki.example.com/8fe05c2e-047d-49e7-8398-cd4250a572b1/50513/delta.xml +test-rrdp: delta hash: 85DAF825C8335D8F59FD6B32B25F9B7152F89038B74ED3366A6EA59BD2F4E600 +test-rrdp: delta serial 50514 uri: https://rpki.example.com/8fe05c2e-047d-49e7-8398-cd4250a572b1/50514/delta.xml +test-rrdp: delta hash: 70D288EC67C4B47B6DC177BFB735DDD6542B2A9E484BAE770534A83FD515CE8B +test-rrdp: delta serial 50515 uri: https://rpki.example.com/8fe05c2e-047d-49e7-8398-cd4250a572b1/50515/delta.xml +test-rrdp: delta hash: BD258657DE4C220AD500CC0ECE87CFFCAD813ECD30A63DEFF28086A5F2DCBB5F +test-rrdp: delta serial 50516 uri: https://rpki.example.com/8fe05c2e-047d-49e7-8398-cd4250a572b1/50516/delta.xml +test-rrdp: delta hash: FADEE13B825F713E931EDADEDC79B1F86F4E501EF6C153C0F5FD4401C73B3065 +test-rrdp: delta serial 50517 uri: https://rpki.example.com/8fe05c2e-047d-49e7-8398-cd4250a572b1/50517/delta.xml +test-rrdp: delta hash: EAC5270A5109E95683EB73153E7F5E081F6DA473048782CE4E0E708AD2264B3A +test-rrdp: delta serial 50518 uri: https://rpki.example.com/8fe05c2e-047d-49e7-8398-cd4250a572b1/50518/delta.xml +test-rrdp: delta hash: 30A580DD74F8F5CF1BF83BC8643171A09482FB401E3F2F0443934EE675CA8107 +test-rrdp: delta serial 50519 uri: https://rpki.example.com/8fe05c2e-047d-49e7-8398-cd4250a572b1/50519/delta.xml +test-rrdp: delta hash: 0C07702BAEE536F54F5A35BC481C422C170974DCC2BD4F99E4F58028901B3A52 +test-rrdp: delta serial 50520 uri: https://rpki.example.com/8fe05c2e-047d-49e7-8398-cd4250a572b1/50520/delta.xml +test-rrdp: delta hash: AB32D797DFA4D0490888D129BA275F9C4A816F409B5D99DBA76C07AB14BA3A2B +test-rrdp: delta serial 50521 uri: https://rpki.example.com/8fe05c2e-047d-49e7-8398-cd4250a572b1/50521/delta.xml +test-rrdp: delta hash: 321D3C439DC175974842A52D936EC13FC6A73912F75E6AE66D99B9EAAC09E84D +test-rrdp: delta serial 50522 uri: https://rpki.example.com/8fe05c2e-047d-49e7-8398-cd4250a572b1/50522/delta.xml +test-rrdp: delta hash: AA249C432D2EAEFF266B3A875C1CBF721491C10776A28D62CD5CF0CCE891E834 +test-rrdp: delta serial 50523 uri: https://rpki.example.com/8fe05c2e-047d-49e7-8398-cd4250a572b1/50523/delta.xml +test-rrdp: delta hash: ABD00B8AEB0555A965F83EA89853E5A8179D5F00E341C7F958E95C3BD6DF8807 +test-rrdp: delta serial 50524 uri: https://rpki.example.com/8fe05c2e-047d-49e7-8398-cd4250a572b1/50524/delta.xml +test-rrdp: delta hash: 6BD5645CDA5490EB42737ED94F249C9166F626231B5315C1205C4E1D8E7FD409 +test-rrdp: delta serial 50525 uri: https://rpki.example.com/8fe05c2e-047d-49e7-8398-cd4250a572b1/50525/delta.xml +test-rrdp: delta hash: 2660598AAFB968737D8A81F823D490C7157F5A6EE72EF7F2DEF8176095CB96BE +test-rrdp: delta serial 50526 uri: https://rpki.example.com/8fe05c2e-047d-49e7-8398-cd4250a572b1/50526/delta.xml +test-rrdp: delta hash: E615ED42AC32529C7DFE7189F8DECA1E7EC7C4D79C03C50BD51488C7381610BB +test-rrdp: delta serial 50527 uri: https://rpki.example.com/8fe05c2e-047d-49e7-8398-cd4250a572b1/50527/delta.xml +test-rrdp: delta hash: FDC9EB4E70A5F55B310015936D65A3878665D9C03631DA4B66069F4F1D812D5F +test-rrdp: delta serial 50528 uri: https://rpki.example.com/8fe05c2e-047d-49e7-8398-cd4250a572b1/50528/delta.xml +test-rrdp: delta hash: 7CA7B7BBEAF412C492B4781D23F3CF3DE1CE333EF569377B57719C58195CBA6F +test-rrdp: delta serial 50529 uri: https://rpki.example.com/8fe05c2e-047d-49e7-8398-cd4250a572b1/50529/delta.xml +test-rrdp: delta hash: AFBE35FAC90ED1F9FFBC9C00EF9F264E52C3CE5A963CB71D8493FEC0970C6ADE +test-rrdp: delta serial 50530 uri: https://rpki.example.com/8fe05c2e-047d-49e7-8398-cd4250a572b1/50530/delta.xml +test-rrdp: delta hash: 99D665BC23A27A011684985A3F986C4A8D99EF2C5AA700DDCCA48C32D68D1DA1 +test-rrdp: delta serial 50531 uri: https://rpki.example.com/8fe05c2e-047d-49e7-8398-cd4250a572b1/50531/delta.xml +test-rrdp: delta hash: 8E18D6C89B7129C2450EFB4A36FEE9085EE5ABD02F0A9AADBCC2A6F4AFD1369E +test-rrdp: delta serial 50532 uri: https://rpki.example.com/8fe05c2e-047d-49e7-8398-cd4250a572b1/50532/delta.xml +test-rrdp: delta hash: 26CB2AF7EF8EF4A6568832FEECCF45193503E2D5AA60EDC36F04928A91448228 +test-rrdp: delta serial 50533 uri: https://rpki.example.com/8fe05c2e-047d-49e7-8398-cd4250a572b1/50533/delta.xml +test-rrdp: delta hash: E45DCDAB3AC49D0F6AF740B6C42B2C48FAF539BB1BCBE6AC0EAC9E95028D1D7D +test-rrdp: delta serial 50534 uri: https://rpki.example.com/8fe05c2e-047d-49e7-8398-cd4250a572b1/50534/delta.xml +test-rrdp: delta hash: 19EFF9063C421788FFA4859842CF05366862A78C9DD40D926091A6E9E6F9BB1B +test-rrdp: delta serial 50535 uri: https://rpki.example.com/8fe05c2e-047d-49e7-8398-cd4250a572b1/50535/delta.xml +test-rrdp: delta hash: A749FF4E39B607F65B7D2D2B4BAABABA0198C47EA02C9EF8A8FC36529102BC3C +test-rrdp: delta serial 50536 uri: https://rpki.example.com/8fe05c2e-047d-49e7-8398-cd4250a572b1/50536/delta.xml +test-rrdp: delta hash: 59FBB6D36742C51219CD1A4EF064D6A54531B82CB8DB592A4FAD9D89E867353F +test-rrdp: delta serial 50537 uri: https://rpki.example.com/8fe05c2e-047d-49e7-8398-cd4250a572b1/50537/delta.xml +test-rrdp: delta hash: 13BE78BA673B89D9D8004A1C39E82F667219610371F4ECD64C3C318636419608 +test-rrdp: delta serial 50538 uri: https://rpki.example.com/8fe05c2e-047d-49e7-8398-cd4250a572b1/50538/delta.xml +test-rrdp: delta hash: F5B6E9E253597F0FA8C023278D9D77E75B220E1CEBAE597E906A7D6B0AB07398 +test-rrdp: delta serial 50539 uri: https://rpki.example.com/8fe05c2e-047d-49e7-8398-cd4250a572b1/50539/delta.xml +test-rrdp: delta hash: 397264BFBD7D466F9BDDEFE5139BA9CE392FAFE24C95F80BE00F27F40246919B +test-rrdp: delta serial 50540 uri: https://rpki.example.com/8fe05c2e-047d-49e7-8398-cd4250a572b1/50540/delta.xml +test-rrdp: delta hash: A64882D43F76933BFBBA07E96A3982A6B1B15BD261F4F78FFBF19AD4C9FAFDED +test-rrdp: delta serial 50541 uri: https://rpki.example.com/8fe05c2e-047d-49e7-8398-cd4250a572b1/50541/delta.xml +test-rrdp: delta hash: D9622F90E5850F38CF2ECBCD5714A9F5F699D8D0BA509F41DAA56DFEEF83CD85 +test-rrdp: delta serial 50542 uri: https://rpki.example.com/8fe05c2e-047d-49e7-8398-cd4250a572b1/50542/delta.xml +test-rrdp: delta hash: BEE7A540AA6FFF7C2C00D559B7E9DE6973D52FFA7121030BA534DB5F18A23FA6 +test-rrdp: delta serial 50543 uri: https://rpki.example.com/8fe05c2e-047d-49e7-8398-cd4250a572b1/50543/delta.xml +test-rrdp: delta hash: 7626BD5FE4528B3810806EEDE9698F0C835657024717C116024B010D0239AE58 +test-rrdp: delta serial 50544 uri: https://rpki.example.com/8fe05c2e-047d-49e7-8398-cd4250a572b1/50544/delta.xml +test-rrdp: delta hash: B4B36D43E649CA7B919AD5754C745A8B50A594F0250E4617C7756B9AE008EAD0 +test-rrdp: delta serial 50545 uri: https://rpki.example.com/8fe05c2e-047d-49e7-8398-cd4250a572b1/50545/delta.xml +test-rrdp: delta hash: 12985397A67DAED8F64EE8B653A60A02B121632169247BB95A9D3BEB0F897CA1 +test-rrdp: delta serial 50546 uri: https://rpki.example.com/8fe05c2e-047d-49e7-8398-cd4250a572b1/50546/delta.xml +test-rrdp: delta hash: 67DCB6751E0E31586603244CD90FC2F8A3E7EA8132AF13D95962C59898F11B24 +test-rrdp: delta serial 50547 uri: https://rpki.example.com/8fe05c2e-047d-49e7-8398-cd4250a572b1/50547/delta.xml +test-rrdp: delta hash: FB94B545FC52CC7CA91A42BC09AE5F89DCF7BCD758FE4BDED47F565CF991DD64 +test-rrdp: delta serial 50548 uri: https://rpki.example.com/8fe05c2e-047d-49e7-8398-cd4250a572b1/50548/delta.xml +test-rrdp: delta hash: 8F022550ECEE3CD13EE209C1A8FCD5E99E449295AE9D53ADCA1BA3231718B36C +test-rrdp: delta serial 50549 uri: https://rpki.example.com/8fe05c2e-047d-49e7-8398-cd4250a572b1/50549/delta.xml +test-rrdp: delta hash: 0F7808520C7D54E6F0CBD37BBF391E9028FDC62BDC0F2E90D986479B3B11F8AA +test-rrdp: delta serial 50550 uri: https://rpki.example.com/8fe05c2e-047d-49e7-8398-cd4250a572b1/50550/delta.xml +test-rrdp: delta hash: E99CC80CB36259E73EC1FFED5A0CFBAF27D345800DA18147DBDF8316B28E027C +OK diff --git a/regress/usr.sbin/rpki-client/rrdp/rrdp-r3.out b/regress/usr.sbin/rpki-client/rrdp/rrdp-r3.out new file mode 100644 index 00000000000..8faf2d724cb --- /dev/null +++ b/regress/usr.sbin/rpki-client/rrdp/rrdp-r3.out @@ -0,0 +1,18 @@ +test-rrdp: type: delete +test-rrdp: uri: rsync://rpki.example.com/repository/DEFAULT/95/d58727-d970-44d9-abdc-93b3ad12d2f3/1/gSk6an-JyWyxV5LYX0AB2BOJb7I.roa +test-rrdp: data: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 +test-rrdp: hash: 6F19C7760D83B12E259F35924F40BE76C6A9C963DB23A692CE192C2FAEF94271 +test-rrdp: type: update +test-rrdp: uri: rsync://rpki.example.com/repository/DEFAULT/95/d58727-d970-44d9-abdc-93b3ad12d2f3/1/nBETmuVT1txzB4h_Rn5CB4gARes.crl +test-rrdp: data: 27b240ccb4adefc4438a0b0c94cf995fed9e1a227987e31b7fde9b67209e04c7 +test-rrdp: hash: 9AAF87B277EFB7E47AB00A4A86CAD1CD132D8A06A782D9B54202C4BFFEDE347B +test-rrdp: type: update +test-rrdp: uri: rsync://rpki.example.com/repository/DEFAULT/95/d58727-d970-44d9-abdc-93b3ad12d2f3/1/nBETmuVT1txzB4h_Rn5CB4gARes.mft +test-rrdp: data: 9148c46222a49fc9b18607474d549ec126d2f4dbf4fa4fe2007588b9a958d29d +test-rrdp: hash: B45FA2DAAEEDA2B37BFF1A039ADA2C299DC6ACE28CA16DBC22664E3D89B8D556 +test-rrdp: type: add +test-rrdp: uri: rsync://rpki.example.com/repository/DEFAULT/95/d58727-d970-44d9-abdc-93b3ad12d2f3/1/x7OkhL6fs-x6CQ4Kqd5jOkkB4pY.roa +test-rrdp: data: 28b761092849ea963824de57bd8b0bef1de6f467b91af51c2d847fa5ae90c6dc +test-rrdp: version: 1 +test-rrdp: session_id: 9b3f7e31-4979-ef8c-d818-73e4dadc3e6b serial: 13755 +OK diff --git a/regress/usr.sbin/rpki-client/rrdp/rrdp-r4.out b/regress/usr.sbin/rpki-client/rrdp/rrdp-r4.out new file mode 100644 index 00000000000..0ab7eb798ed --- /dev/null +++ b/regress/usr.sbin/rpki-client/rrdp/rrdp-r4.out @@ -0,0 +1,13 @@ +test-rrdp: type: add +test-rrdp: uri: rsync://rpki.example.com/rpki/TA/XUJQ4tgdREjYop786R0p_wdeyeI.cer +test-rrdp: data: 9dbea4222e3b687772763b21da1118d858b1271c989f10adb3b2611945609dbc +test-rrdp: type: add +test-rrdp: uri: rsync://rpki.example.com/rpki/Sobornost-RIPE/Sobornost-OP/fxYnc2Mg1Fnou14i_Qm39uMR1bA.crl +test-rrdp: data: 831c1b054aaff13240df899e5048b67c227689d5e5ecdf7d38f9a8e4603beb4b +test-rrdp: type: add +test-rrdp: uri: rsync://rpki.example.com/rpki/uplift/IBfMWA0nPFS6MGTNLNavObgEuIc.mft +test-rrdp: data: 61bbdc519a39a870f2169d474d957713e611662c44daa7f0b9e3d922f93b0312 +test-rrdp: scope: 3 +test-rrdp: version: 1 +test-rrdp: session_id: 7e7d2563-5bbb-40b0-8723-6a2e90c85d9e serial: 28483 +OK diff --git a/regress/usr.sbin/rpki-client/rrdp/rrdp-r5.out b/regress/usr.sbin/rpki-client/rrdp/rrdp-r5.out new file mode 100644 index 00000000000..cf91479013f --- /dev/null +++ b/regress/usr.sbin/rpki-client/rrdp/rrdp-r5.out @@ -0,0 +1,2 @@ +test-rrdp: parse failed - DOCTYPE not allowed +test-rrdp: stdin: parse error at line 2: parsing aborted diff --git a/regress/usr.sbin/rpki-client/rrdp/rrdp-r6.out b/regress/usr.sbin/rpki-client/rrdp/rrdp-r6.out new file mode 100644 index 00000000000..cf91479013f --- /dev/null +++ b/regress/usr.sbin/rpki-client/rrdp/rrdp-r6.out @@ -0,0 +1,2 @@ +test-rrdp: parse failed - DOCTYPE not allowed +test-rrdp: stdin: parse error at line 2: parsing aborted diff --git a/regress/usr.sbin/rpki-client/rrdp/snapshot.xml b/regress/usr.sbin/rpki-client/rrdp/snapshot.xml new file mode 100644 index 00000000000..a04dbc0f94f --- /dev/null +++ b/regress/usr.sbin/rpki-client/rrdp/snapshot.xml @@ -0,0 +1,80 @@ + + +MIIDaDCCAlCgAwIBAgICBa8wDQYJKoZIhvcNAQELBQAwMzExMC8GA1UEAxMoNkFF +NTA5NDE3OTBDMTQwN0FCMzdBQ0Y4NzNCQTFCNzA1NDMyMTQwRDAeFw0yMTEwMTEy +MDQxMzFaFw0yMjEwMTEyMDQxMzFaMC0xGDAWBgNVBAMTD1JPVVRFUi0wMDAwM2Nj +YTERMA8GA1UEBRMIMDAwMDAwMDEwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAASA +VyND+D/8sBB6sAfYymn4a5ygMAYFuEioPffA0+xfGcAZv6a1ntdCtU70NDpSUBKG +2KDn5B8QqlO0WCKp+IAVo4IBVTCCAVEwHQYDVR0OBBYEFF1CUOLYHURI2KKe/Okd +Kf8HXsniMB8GA1UdIwQYMBaAFGrlCUF5DBQHqzes+HO6G3BUMhQNMBgGA1UdIAEB +/wQOMAwwCgYIKwYBBQUHDgIwVAYDVR0fBE0wSzBJoEegRYZDcnN5bmM6Ly9jaGxv +ZS5zb2Jvcm5vc3QubmV0L3Jwa2kvVEEvYXVVSlFYa01GQWVyTjZ6NGM3b2JjRlF5 +RkEwLmNybDBfBggrBgEFBQcBAQRTMFEwTwYIKwYBBQUHMAKGQ3JzeW5jOi8vY2hs +b2Uuc29ib3Jub3N0Lm5ldC9ycGtpL1RBL2F1VUpRWGtNRkFlck42ejRjN29iY0ZR +eUZBMC5jZXIwDgYDVR0PAQH/BAQDAgeAMBkGCCsGAQUFBwEIAQH/BAowCKAGMAQC +AjzKMBMGA1UdJQQMMAoGCCsGAQUFBwMeMA0GCSqGSIb3DQEBCwUAA4IBAQBEMMvm +OwAmPw081LOBQk5Qvpx6jKQumbdErbyz+UM86wuUpriZv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EwMTIxMlowLwYJKoZIhvcNAQkEMSIE +IJeKYLhddBj4+sfXo9frzQq8hi7d0FXA+3WR7AAsv2OuMA0GCSqGSIb3DQEBAQUA +BIIBAJAgvliloHtLKq1cBGWgsxY/sIfjB06P14Ic8nDQkYtZWVXeewXUOxbbPpIG +PlHMOe2rYV6AaeupErXOepC0DT+gFlKcDPEv+MW8mOU9gxV7i1dq6PHLOiYiKzoh +R8/CQhKRHgCZHCm3CaaLIdZmQvDOQaXEAIJf2vguGMPqHG7AzVkHOQsWrQsoFWJs +w5J/PtrCFJMMAc6/5dxKhEUy5yhZdBiJ0TmmyVeHYA2gYZ8UD3p0YyVKB/UZp4wc +KmpiFkpRuvQmscZDqmOU5C6aDitOkHj3EwEoULx0qMGnBB7VaDhxPDGcL2oFn4bM +kj4IN2Oc7BuCKj9ruDmULONsAGo= + + diff --git a/regress/usr.sbin/rpki-client/rrdp/xxe.xml b/regress/usr.sbin/rpki-client/rrdp/xxe.xml new file mode 100644 index 00000000000..ce04df939c4 --- /dev/null +++ b/regress/usr.sbin/rpki-client/rrdp/xxe.xml @@ -0,0 +1,4 @@ + + +]>&xxe; diff --git a/regress/usr.sbin/rpki-client/test-rrdp.c b/regress/usr.sbin/rpki-client/test-rrdp.c new file mode 100644 index 00000000000..04d14ccf600 --- /dev/null +++ b/regress/usr.sbin/rpki-client/test-rrdp.c @@ -0,0 +1,338 @@ +/* $OpenBSD: test-rrdp.c,v 1.1 2021/12/01 09:03:19 claudio Exp $ */ +/* + * Copyright (c) 2020 Nils Fisher + * Copyright (c) 2021 Claudio Jeker + * + * 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 THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR 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. + */ +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "extern.h" +#include "rrdp.h" + +#define REGRESS_NOTIFY_URI "https://rpki.example.com/notify.xml" + +#define MAX_SESSIONS 12 +#define READ_BUF_SIZE (32 * 1024) + +#define RRDP_STATE_REQ 0x01 +#define RRDP_STATE_WAIT 0x02 +#define RRDP_STATE_PARSE 0x04 +#define RRDP_STATE_PARSE_ERROR 0x08 +#define RRDP_STATE_PARSE_DONE 0x10 +#define RRDP_STATE_HTTP_DONE 0x20 +#define RRDP_STATE_DONE (RRDP_STATE_PARSE_DONE | RRDP_STATE_HTTP_DONE) + +struct rrdp { + TAILQ_ENTRY(rrdp) entry; + size_t id; + char *notifyuri; + char *local; + char *last_mod; + + struct pollfd *pfd; + int infd; + int state; + unsigned int file_pending; + unsigned int file_failed; + enum http_result res; + enum rrdp_task task; + + char hash[SHA256_DIGEST_LENGTH]; + SHA256_CTX ctx; + + struct rrdp_session repository; + struct rrdp_session current; + XML_Parser parser; + struct notification_xml *nxml; + struct snapshot_xml *sxml; + struct delta_xml *dxml; +}; + +void +logx(const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + vwarnx(fmt, ap); + va_end(ap); +} + +char * +xstrdup(const char *s) +{ + char *r; + if ((r = strdup(s)) == NULL) + err(1, "strdup"); + return r; +} + +/* + * Send a blob of data to the main process to store it in the repository. + */ +void +rrdp_publish_file(struct rrdp *s, struct publish_xml *pxml, + unsigned char *data, size_t datasz) +{ + char buf[SHA256_DIGEST_STRING_LENGTH]; + char *hash = NULL; + + switch (pxml->type) { + case PUB_ADD: + logx("type: %s", "add"); + break; + case PUB_UPD: + logx("type: %s", "update"); + hash = hex_encode(pxml->hash, sizeof(pxml->hash)); + break; + case PUB_DEL: + logx("type: %s", "delete"); + hash = hex_encode(pxml->hash, sizeof(pxml->hash)); + break; + default: + errx(1, "unknown publish type"); + } + logx("uri: %s", pxml->uri); + SHA256Data(data, datasz, buf); + logx("data: %s", buf); + + if (hash) + logx("hash: %s", hash); + free(hash); +} + +static struct rrdp * +rrdp_new(size_t id, char *local, char *notify, char *session_id, + long long serial, char *last_mod) +{ + struct rrdp *s; + + if ((s = calloc(1, sizeof(*s))) == NULL) + err(1, NULL); + + s->infd = 0; /* stdin */ + s->id = id; + s->local = local; + s->notifyuri = notify; + s->repository.session_id = session_id; + s->repository.serial = serial; + s->repository.last_mod = last_mod; + + s->state = RRDP_STATE_REQ; + if ((s->parser = XML_ParserCreate("US-ASCII")) == NULL) + err(1, "XML_ParserCreate"); + + return s; +} + +static void +rrdp_free(struct rrdp *s) +{ + if (s == NULL) + return; + + free_notification_xml(s->nxml); + free_snapshot_xml(s->sxml); + free_delta_xml(s->dxml); + + if (s->parser) + XML_ParserFree(s->parser); + if (s->infd != -1) + close(s->infd); + free(s->notifyuri); + free(s->local); + free(s->last_mod); + free(s->repository.last_mod); + free(s->repository.session_id); + free(s->current.last_mod); + free(s->current.session_id); + + free(s); +} + +static void +rrdp_finished(struct rrdp *s) +{ + XML_Parser p = s->parser; + size_t id = s->id; + + if (s->state & RRDP_STATE_PARSE_ERROR) + return; + + /* + * Finalize parsing on success to be sure that + * all of the XML is correct. Needs to be done here + * since the call would most probably fail for non + * successful data fetches. + */ + if (XML_Parse(p, NULL, 0, 1) != XML_STATUS_OK) { + warnx("%s: XML error at line %llu: %s", s->local, + (unsigned long long)XML_GetCurrentLineNumber(p), + XML_ErrorString(XML_GetErrorCode(p))); + return; + } + + switch (s->task) { + case NOTIFICATION: + log_notification_xml(s->nxml); + break; + case SNAPSHOT: + log_snapshot_xml(s->sxml); + break; + case DELTA: + log_delta_xml(s->dxml); + break; + } +} + +static void +rrdp_data_handler(struct rrdp *s) +{ + char buf[READ_BUF_SIZE]; + XML_Parser p = s->parser; + ssize_t len; + + len = read(s->infd, buf, sizeof(buf)); + if (len == -1) { + s->state |= RRDP_STATE_PARSE_ERROR; + warn("%s: read failure", s->local); + return; + } + if ((s->state & RRDP_STATE_PARSE) == 0) + errx(1, "%s: bad parser state", s->local); + if (len == 0) { + /* parser stage finished */ + close(s->infd); + s->infd = -1; + + if (s->task != NOTIFICATION) { + char h[SHA256_DIGEST_LENGTH]; + + SHA256_Final(h, &s->ctx); + if (memcmp(s->hash, h, sizeof(s->hash)) != 0) { + s->state |= RRDP_STATE_PARSE_ERROR; + warnx("%s: bad message digest", s->local); + } + } + + s->state |= RRDP_STATE_PARSE_DONE; + rrdp_finished(s); + return; + } + + /* parse and maybe hash the bytes just read */ + if (s->task != NOTIFICATION) + SHA256_Update(&s->ctx, buf, len); + if ((s->state & RRDP_STATE_PARSE_ERROR) == 0 && + XML_Parse(p, buf, len, 0) != XML_STATUS_OK) { + warnx("%s: parse error at line %llu: %s", s->local, + (unsigned long long)XML_GetCurrentLineNumber(p), + XML_ErrorString(XML_GetErrorCode(p))); + s->state |= RRDP_STATE_PARSE_ERROR; + } +} + +int +main(int argc, char **argv) +{ + struct rrdp *s = NULL; + const char *e; + char *session_id = NULL; + char hash[SHA256_DIGEST_LENGTH]; + long long serial = 0; + int c; + + + while ((c = getopt(argc, argv, "dH:N:nS:s")) != -1) + switch (c) { + case 'd': + if (s) + goto usage; + s = rrdp_new(0, "stdin", REGRESS_NOTIFY_URI, + session_id, serial, NULL); + s->dxml = new_delta_xml(s->parser, + &s->repository, s); + s->task = DELTA; + SHA256_Init(&s->ctx); + memcpy(s->hash, hash, sizeof(s->hash)); + break; + case 'H': + if (hex_decode(optarg, hash, sizeof(hash)) == -1) + errx(1, "bad hash"); + break; + case 'N': + serial = strtonum(optarg, LLONG_MIN, LLONG_MAX, &e); + if (e != NULL) + errx(1, "serial is %s: %s", e, optarg); + break; + case 'n': + if (s) + goto usage; + s = rrdp_new(0, "stdin", REGRESS_NOTIFY_URI, + session_id, serial, NULL); + s->nxml = new_notification_xml(s->parser, + &s->repository, &s->current, s->notifyuri); + s->task = NOTIFICATION; + break; + case 'S': + session_id = optarg; + break; + case 's': + if (s) + goto usage; + s = rrdp_new(0, "stdin", REGRESS_NOTIFY_URI, + session_id, serial, NULL); + s->sxml = new_snapshot_xml(s->parser, + &s->repository, s); + s->task = SNAPSHOT; + SHA256_Init(&s->ctx); + memcpy(s->hash, hash, sizeof(s->hash)); + break; + default: + goto usage; + } + + s->state = RRDP_STATE_PARSE; + + while (!(s->state & RRDP_STATE_PARSE_DONE)) { + rrdp_data_handler(s); + } + + if ((s->state & RRDP_STATE_PARSE_ERROR) == 0) { + printf("OK\n"); + return 0; + } else { + return 1; + } + +usage: + fprintf(stderr, "usage: %s [-S session_id] [-N serial] [-H hash] " + "-d | -n | -s\n", "test-rrdp"); + exit(1); +} -- cgit v1.2.3