Skip to content

Conversation

oncilla
Copy link
Contributor

@oncilla oncilla commented Aug 27, 2019

This change allows generating prototype TRC payloads.
A prototype TRC will be signed and then combined to a signed TRC.
Signing and combining is left for a future PR.

For convenience, a 'gen' command will also be added in the future that
executes the three phases in a single call.

contributes to #2983


This change is Reviewable

@oncilla oncilla added c/tooling SCION network tools c/CPPKI SCION Control-plane PKI labels Aug 27, 2019
@oncilla oncilla added this to the Q3S3 milestone Aug 27, 2019
@oncilla oncilla requested a review from lukedirtwalker August 27, 2019 09:16
Copy link
Collaborator

@lukedirtwalker lukedirtwalker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 11 of 11 files at r1.
Reviewable status: all files reviewed, 7 unresolved discussions (waiting on @oncilla)

a discussion (no related file):
Commit description mentions wrong issue (2982 is about goconvey)


a discussion (no related file):
I think it would be great to have some end2end test for this tool. Basically have a set of input files for each subcommand and an expected set of output files, run the tool and check that the output matches the input files. If we use a golden file approach it should be easy to update even. (This should not be part of this PR)



go/tools/scion-pki/internal/pkicmn/pkicmn.go, line 152 at r1 (raw file):

	switch {
	case os.IsNotExist(err):
		if err := os.MkdirAll(dir, perm); err != nil {

Why Stat first an not directly os.MkdirAll? according to https://golang.org/pkg/os/#MkdirAll that should be good enough.


go/tools/scion-pki/internal/v2/trc/ases.go, line 28 at r1 (raw file):

)

// asCfg holds the AS configuration including the from file system loaded

this reads a bit weird. Wouldn't ...including the private keys loaded from file system. sound better?


go/tools/scion-pki/internal/v2/trc/ases.go, line 60 at r1 (raw file):

	primaryASes := make(map[addr.AS]*asCfg)
	for as, keys := range ases {
		if len(wl) != 0 && !pkicmn.Contains(wl, addr.IA{I: isd, A: as}) {

It would make the loop a bit less convoluted if the filtering would be done first in a separate function:

ases = filterASes(ases, wl)

func filterASes(isd addr.ISD, ases map[addr.AS][]trc.KeyType, wl[]addr.IA) ... {
      if len(wl) == 0 {
            return ases
     }
    for as := range ases {
          ...
    }
}

go/tools/scion-pki/internal/v2/trc/ases.go, line 100 at r1 (raw file):

		pkicmn.KeysDir, file), cfg.KeyTypeToAlgo(keyType))
	if err != nil {
		return nil, common.NewBasicError("unable to load key", err, "keyType", keyType)

having the path in the error might be helpful as well.


go/tools/scion-pki/internal/v2/trc/proto.go, line 1 at r1 (raw file):

// Copyright 2019 Anapaya Systems

proto reminds me of protobuf or capnproto whereas here it is probably prototype?

This change allows generating prototype TRC payloads.
A prototype TRC will be signed and then combined to a signed TRC.
Signing and combining is left for a future PR.

For convenience, a 'gen' command will also be added in the future that
executes the three phases in a single call.

contributes to scionproto#2982
@oncilla oncilla force-pushed the pub-spki-proto-trc branch from 7bd624e to 6d1cba6 Compare August 27, 2019 15:07
Copy link
Contributor Author

@oncilla oncilla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 6 unresolved discussions (waiting on @lukedirtwalker)

a discussion (no related file):

Previously, lukedirtwalker (Lukas Vogel) wrote…

I think it would be great to have some end2end test for this tool. Basically have a set of input files for each subcommand and an expected set of output files, run the tool and check that the output matches the input files. If we use a golden file approach it should be easy to update even. (This should not be part of this PR)

Agreed 👍


a discussion (no related file):

Previously, lukedirtwalker (Lukas Vogel) wrote…

Commit description mentions wrong issue (2982 is about goconvey)

off by one 😞



go/tools/scion-pki/internal/pkicmn/pkicmn.go, line 152 at r1 (raw file):

Previously, lukedirtwalker (Lukas Vogel) wrote…

Why Stat first an not directly os.MkdirAll? according to https://golang.org/pkg/os/#MkdirAll that should be good enough.

Done.


go/tools/scion-pki/internal/v2/trc/ases.go, line 28 at r1 (raw file):

Previously, lukedirtwalker (Lukas Vogel) wrote…

this reads a bit weird. Wouldn't ...including the private keys loaded from file system. sound better?

Done.


go/tools/scion-pki/internal/v2/trc/ases.go, line 60 at r1 (raw file):

Previously, lukedirtwalker (Lukas Vogel) wrote…

It would make the loop a bit less convoluted if the filtering would be done first in a separate function:

ases = filterASes(ases, wl)

func filterASes(isd addr.ISD, ases map[addr.AS][]trc.KeyType, wl[]addr.IA) ... {
      if len(wl) == 0 {
            return ases
     }
    for as := range ases {
          ...
    }
}

Done.


go/tools/scion-pki/internal/v2/trc/ases.go, line 100 at r1 (raw file):

Previously, lukedirtwalker (Lukas Vogel) wrote…

having the path in the error might be helpful as well.

Done.

Copy link
Collaborator

@lukedirtwalker lukedirtwalker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 5 of 5 files at r2.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@oncilla oncilla merged commit 64853dd into scionproto:master Aug 27, 2019
@oncilla oncilla deleted the pub-spki-proto-trc branch August 27, 2019 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c/CPPKI SCION Control-plane PKI c/tooling SCION network tools
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants