Skip to content

Commit f95669e

Browse files
author
Tim Bruijnzeels
authored
Merge pull request #169 from NLnetLabs/v0.4.2-pre
V0.4.2 pre
2 parents ab7a152 + 8d85dba commit f95669e

33 files changed

+587
-356
lines changed

.dockerignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/target
2+
.git

Cargo.toml

+2-9
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
[package]
22
name = "krill"
3-
version = "0.4.2-pre"
3+
version = "0.4.2"
44
authors = [ "The NLnet Labs RPKI team <[email protected]>" ]
55
description = "Resource Public Key Infrastructure (RPKI) daemon"
66
license = "MPL-2.0"
77

88
[dependencies]
9-
actix-identity = "0.1.0"
109
actix-web = { version = "1.0.3", features = ["ssl"] }
11-
actix-session = "0.1.0"
12-
actix-service = "0.4.0"
1310
base64 = "^0.10"
1411
bcder = "0.4.0"
1512
bytes = "^0.4"
@@ -26,7 +23,7 @@ openssl = { version = "^0.10", features = ["v110"] }
2623
pretty = "0.5.2"
2724
rand = "^0.5"
2825
reqwest = "^0.9.17"
29-
rpki = "0.8.2"
26+
rpki = "0.8.3"
3027
serde = { version = "^1.0", features = ["derive"] }
3128
serde_json = "^1.0"
3229
syslog = "^4.0"
@@ -45,7 +42,3 @@ ignore = "^0.4"
4542
[features]
4643
default = []
4744
extra-debug = [ "rpki/extra-debug" ]
48-
49-
# Used when depending on development branches of rpki-rs or bcder
50-
#[patch.crates-io]
51-
#rpki = { git = "https://github.com/NLnetLabs/rpki-rs.git", branch = "resource-set-fix" }

Changelog.md

+15-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
11
# Change Log
22

33
Please see [here](https://github.com/NLnetLabs/krill/projects?query=is%3Aopen+sort%3Aname-asc)
4-
for planned releases.
4+
for planned releases.
5+
6+
## 0.4.2 'Finer Things'
7+
8+
This release fixes a bug, and introduces minor usability improvements:
9+
* Certain adjacent resources were encoded incorrectly (#161)
10+
* Let users explicitly specify a repository before adding a parent (#160)
11+
* Allow timezone to be set on the Docker container (#156)
12+
* Improve error messaging when failing to start Krill (#155)
13+
* Improve readability for CLI error responses (#162)
14+
* Introduce configurable size limits for data submitted to Krill (#158)
15+
16+
Note that contrary to previous versions a new CA is set up without a default repository. For most
17+
users we recommend that a remote (RFC 8181) repository is used, e.g. provided by their RIR or NIR.
18+
A repository MUST be configured before a parent can be added to a CA.
519

620
## 0.4.1 'Fogo de Krill'
721

@@ -82,7 +96,6 @@ Known issues:
8296
Work for the next release has already started. [Release 0.3](https://github.com/NLnetLabs/krill/projects/6)
8397
will focus on (remote) publication, and will also solve the out-of-sync issue.
8498

85-
8699
## 0.1.0 'A View to a Krill'
87100

88101
This is the first version of Krill that we are testing in the real world. Please note that the

defaults/krill.conf

+19-1
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,22 @@
9393
#
9494
# Defaults to 10 minutes
9595
#
96-
#ca_refresh = 600
96+
#ca_refresh = 600
97+
98+
# Restrict size of messages sent to the API
99+
#
100+
# Default 256 kB
101+
#
102+
# post_limit_api = 262144
103+
104+
# Restrict size of messages sent to the RFC 8181 publication protocol
105+
#
106+
# Default 32MB (enough for a keyroll with about 8000 issued certificates)
107+
#
108+
# post_limit_rfc8181 = 33554432
109+
110+
# Restrict size of messages sent to the RFC 6492 up-down protocol
111+
#
112+
# Default 1MB (enough for a keyroll with certs of ~400kb, the biggest known cert is 220kB)
113+
#
114+
# post_limit_rfc6492 = 1048576

doc/openapi.yaml

+52-2
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,9 @@ paths:
593593
will be used. In principle CAs can also use this to talk to a local
594594
parent CA in the same krill server, but this is inefficient. Therefore
595595
it is also possible to add an 'embedded' parent in this case.
596+
597+
Note that you MUST specify a repository for your CA before you are
598+
allowed to add a parent to it.
596599
parameters:
597600
- $ref: '#/components/parameters/ca_handle'
598601
requestBody:
@@ -607,7 +610,14 @@ paths:
607610
'403':
608611
$ref: '#/components/responses/Forbidden'
609612
'400':
610-
$ref: '#/components/schemas/ParentWithHandleExists'
613+
description: Bad request parameters.
614+
content:
615+
application/json:
616+
schema:
617+
oneOf:
618+
- $ref: '#/components/schemas/ParentWithHandleExists'
619+
- $ref: '#/components/responses/ParentNoResponse'
620+
- $ref: '#/components/schemas/NoRepositoryConfiguredYetForCA'
611621
'404':
612622
$ref: '#/components/responses/UnknownCA'
613623
'500':
@@ -655,7 +665,13 @@ paths:
655665
'200':
656666
$ref: '#/components/responses/Success'
657667
'400':
658-
$ref: '#/components/responses/UnknownParent'
668+
description: Bad request parameters.
669+
content:
670+
application/json:
671+
schema:
672+
oneOf:
673+
- $ref: '#/components/responses/UnknownParent'
674+
- $ref: '#/components/responses/ParentNoResponse'
659675
'403':
660676
$ref: '#/components/responses/Forbidden'
661677
'404':
@@ -719,8 +735,12 @@ paths:
719735
- Request new certificates with SIA entries pointing to the new
720736
locations.
721737
- (best effort) Clean up of the old repository.
738+
722739
The new repository can be embedded, or remote. To use a remote
723740
repository, the RFC 8181 Repository Response must be encoded into JSON.
741+
742+
Note: for most users it's better to use a remote repository, e.g. provided
743+
by your RIR or NIR.
724744
parameters:
725745
- $ref: '#/components/parameters/ca_handle'
726746
requestBody:
@@ -1436,6 +1456,18 @@ components:
14361456
msg:
14371457
type: string
14381458
example: Parent with handle exists.
1459+
ParentNoResponse:
1460+
type: object
1461+
required:
1462+
- code
1463+
- msg
1464+
properties:
1465+
code:
1466+
type: integer
1467+
enum: [2308]
1468+
msg:
1469+
type: string
1470+
example: No response from parent.
14391471
UnknownChild:
14401472
type: object
14411473
required:
@@ -1460,6 +1492,18 @@ components:
14601492
msg:
14611493
type: string
14621494
example: No known parent for handle.
1495+
NoRepositoryConfiguredYetForCA:
1496+
type: object
1497+
required:
1498+
- code
1499+
- msg
1500+
properties:
1501+
code:
1502+
type: integer
1503+
enum: [2307]
1504+
msg:
1505+
type: string
1506+
example: No repository configured yet for CA.
14631507
InvalidROADeltaAddingDefinitionAlreadyPresent:
14641508
type: object
14651509
required:
@@ -1588,6 +1632,12 @@ components:
15881632
application/json:
15891633
schema:
15901634
$ref: '#/components/schemas/UnknownParent'
1635+
ParentNoResponse:
1636+
description: No response from parent.
1637+
content:
1638+
application/json:
1639+
schema:
1640+
$ref: '#/components/schemas/ParentNoResponse'
15911641
GeneralPublicationServerError:
15921642
description: General Publication Server error.
15931643
content:

docker/entrypoint.sh

+2-3
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ if [ "$1" == "krill" ]; then
6161
# RSYNC and RRDP endpoints to the correct FQDN. We cannot know know the
6262
# FQDN which clients use to reach us so the operator must inform this
6363
# script via a "-e KRILL_FQDN=some.domain.name" argument to
64-
# "docker run". If KRILL_FQDN is not set assume that the user is
65-
# managing the Krill configuration themselves.
64+
# "docker run".
6665
cat << EOF >> ${KRILL_CONF}
6766
rsync_base = "rsync://${KRILL_FQDN}/repo/" ${MAGIC}
6867
service_uri = "https://${KRILL_FQDN}/" ${MAGIC}
@@ -81,4 +80,4 @@ fi
8180
# to ensure krill runs as PID 1 as required by Docker for proper signal
8281
# handling. This also allows this Docker image to be used to run krill_admin
8382
# instead of krill.
84-
exec "$@"
83+
exec "$@"

src/bin/krill.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,14 @@ use krill::daemon::http::server;
55

66
fn main() {
77
match Config::create() {
8-
Ok(config) => server::start(&config).unwrap(),
8+
Ok(config) => {
9+
if let Err(e) = server::start(&config) {
10+
eprintln!("Krill failed to start: {}", e);
11+
::std::process::exit(1);
12+
}
13+
}
914
Err(e) => {
10-
eprintln!("{}", e);
15+
eprintln!("Krill failed to start: {}", e);
1116
::std::process::exit(1);
1217
}
1318
}

src/bin/krillc.rs

+17-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ extern crate krill;
22

33
use krill::cli::options::Options;
44
use krill::cli::report::ReportFormat;
5-
use krill::cli::KrillClient;
5+
use krill::cli::{Error, KrillClient};
6+
use krill::commons::util::httpclient;
67

78
fn main() {
89
match Options::from_args() {
@@ -12,7 +13,21 @@ fn main() {
1213
Ok(()) => {} //,
1314
Err(e) => {
1415
if format != ReportFormat::None {
15-
eprintln!("{}", e);
16+
match &e {
17+
Error::HttpClientError(httpclient::Error::ErrorWithJson(
18+
_code,
19+
res,
20+
)) => {
21+
if format == ReportFormat::Json {
22+
eprintln!("{}", e);
23+
} else {
24+
eprintln!("Error {}: {}", res.code(), res.msg());
25+
}
26+
}
27+
_ => {
28+
eprintln!("{}", e);
29+
}
30+
}
1631
}
1732
::std::process::exit(1);
1833
}

src/cli/report.rs

+12-7
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ use std::str::{from_utf8_unchecked, FromStr};
22

33
use crate::commons::api::{
44
CaRepoDetails, CertAuthHistory, CertAuthInfo, CertAuthList, ChildCaInfo, CurrentObjects,
5-
ParentCaContact, PublisherDetails, PublisherList, RepositoryContact, RoaDefinition,
5+
CurrentRepoState, ParentCaContact, PublisherDetails, PublisherList, RepositoryContact,
6+
RoaDefinition,
67
};
78
use crate::commons::remote::api::ClientInfo;
89
use crate::commons::remote::rfc8183;
9-
use commons::api::CurrentRepoState;
1010

1111
//------------ ApiResponse ---------------------------------------------------
1212

@@ -148,14 +148,19 @@ impl Report for CertAuthInfo {
148148
ReportFormat::Text => {
149149
let mut res = String::new();
150150

151-
let base_uri = self.repo_repo().base_uri();
152-
let rrdp_uri = self.repo_repo().rpki_notify();
153-
154151
res.push_str(&format!("Name: {}\n", self.handle()));
155152
res.push_str("\n");
156-
res.push_str(&format!("Base uri: {}\n", base_uri));
157-
res.push_str(&format!("RRDP uri: {}\n", rrdp_uri));
153+
154+
if let Some(repo_info) = self.repo_info() {
155+
let base_uri = repo_info.base_uri();
156+
let rrdp_uri = repo_info.rpki_notify();
157+
res.push_str(&format!("Base uri: {}\n", base_uri));
158+
res.push_str(&format!("RRDP uri: {}\n", rrdp_uri));
159+
} else {
160+
res.push_str("No repository configured.")
161+
}
158162
res.push_str("\n");
163+
159164
res.push_str(&format!("ID cert PEM:\n{}\n", self.id_cert().pem()));
160165
res.push_str(&format!("Hash: {}\n", self.id_cert().hash()));
161166
res.push_str("\n");

src/commons/api/admin.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ impl fmt::Display for RepositoryContact {
373373
/// This type defines all parent ca details needed to add a parent to a CA
374374
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
375375
pub struct ParentCaReq {
376-
handle: Handle, // the local name the child gave to the parent
376+
handle: ParentHandle, // the local name the child gave to the parent
377377
contact: ParentCaContact, // where the parent can be contacted
378378
}
379379

@@ -382,6 +382,14 @@ impl ParentCaReq {
382382
ParentCaReq { handle, contact }
383383
}
384384

385+
pub fn handle(&self) -> &ParentHandle {
386+
&self.handle
387+
}
388+
389+
pub fn contact(&self) -> &ParentCaContact {
390+
&self.contact
391+
}
392+
385393
pub fn unwrap(self) -> (Handle, ParentCaContact) {
386394
(self.handle, self.contact)
387395
}

src/commons/api/ca.rs

+13-9
Original file line numberDiff line numberDiff line change
@@ -1473,7 +1473,7 @@ impl fmt::Display for ParentInfo {
14731473
pub struct CertAuthInfo {
14741474
handle: Handle,
14751475
id_cert: IdCertPem,
1476-
repo_info: RepoInfo,
1476+
repo_info: Option<RepoInfo>,
14771477
parents: Vec<ParentInfo>,
14781478
resources: ResourceSet,
14791479
resource_classes: HashMap<ResourceClassName, ResourceClassInfo>,
@@ -1484,7 +1484,7 @@ impl CertAuthInfo {
14841484
pub fn new(
14851485
handle: Handle,
14861486
id_cert: IdCertPem,
1487-
repo_info: RepoInfo,
1487+
repo_info: Option<RepoInfo>,
14881488
parents: HashMap<ParentHandle, ParentCaContact>,
14891489
resource_classes: HashMap<ResourceClassName, ResourceClassInfo>,
14901490
children: Vec<ChildHandle>,
@@ -1521,8 +1521,8 @@ impl CertAuthInfo {
15211521
&self.id_cert
15221522
}
15231523

1524-
pub fn repo_repo(&self) -> &RepoInfo {
1525-
&self.repo_info
1524+
pub fn repo_info(&self) -> Option<&RepoInfo> {
1525+
self.repo_info.as_ref()
15261526
}
15271527

15281528
pub fn parents(&self) -> &Vec<ParentInfo> {
@@ -1543,10 +1543,14 @@ impl CertAuthInfo {
15431543

15441544
pub fn published_objects(&self) -> Vec<Publish> {
15451545
let mut res = vec![];
1546-
for (_rc_name, rc) in self.resource_classes.iter() {
1547-
let name_space = rc.name_space();
1548-
res.append(&mut rc.current_objects().publish(self.repo_repo(), name_space));
1546+
1547+
if let Some(repo_info) = &self.repo_info {
1548+
for (_rc_name, rc) in self.resource_classes.iter() {
1549+
let name_space = rc.name_space();
1550+
res.append(&mut rc.current_objects().publish(repo_info, name_space));
1551+
}
15491552
}
1553+
15501554
res
15511555
}
15521556
}
@@ -1958,9 +1962,9 @@ mod test {
19581962

19591963
let parent_resources_json =
19601964
include_str!("../../../test-resources/resources/parent_resources.json");
1961-
let parent_resouces: ResourceSet = serde_json::from_str(parent_resources_json).unwrap();
1965+
let parent_resources: ResourceSet = serde_json::from_str(parent_resources_json).unwrap();
19621966

1963-
let intersection = parent_resouces.intersection(&child_resources);
1967+
let intersection = parent_resources.intersection(&child_resources);
19641968

19651969
assert_eq!(intersection, child_resources);
19661970
}

0 commit comments

Comments
 (0)