20 Commits (af40662c7d61995c7769800112c98f74197f6cd2)

Author SHA1 Message Date
Jan Dittberner af40662c7d Refactor client protocol
- define protocols.ClientHandler interface as base for client implementations
- implement protocols.ClientHandler in clientsim's ClientHandler type
- move protocol state handling into protocols.ServerProtocol and
- move protocolState type into protocols.go
- reduce clientsim's TestCommandGenerator responsibility to test command
2 years ago
Jan Dittberner 9905d748d9 Improve signer robustness
- let client simulator send some garbage bytes before starting real commands
- handle EOF during reads
2 years ago
Jan Dittberner e5dcf7afa9 Refactor COBS wire protocol
Wire protocol handling has been moved to protocol.Framer and its
implementation protocol.COBSFramer
2 years ago
Jan Dittberner faaadbe5aa Move internal code to internal packages 2 years ago
Jan Dittberner f0d456dd13 Protocol improvements
- add a client generated command ID for tracing commands and responses
- define protocol delimiter in protocol.CobsDelimiter
- apply code simplifications suggested by golangci-lint
- add Makefile
- add compile time build information for signer binary
- make sure that dependencies for msgpackgen survive go mod tidy
- extract MsgPackHandler into its own file
- add CRL number to fetch CRL response
- remove port.Flush() to avoid removing written data before it reaches the
2 years ago
Jan Dittberner 8e443bd8b4 Implement protocol improvements
This commit implements a client and server side state machine
for the serial protocol.
2 years ago
Jan Dittberner 2de592d30c Implement command type handling
This commit changes the wire protocol to split between command
announcement and command payload to allow proper typing of sent and
received msgpack messages.

CRL fetching has been implemented as second command after the existing
health check command.
2 years ago
Jan Dittberner 472091b374 Switch to logrus for structured logging 2 years ago
Jan Dittberner 4c24e4692b Fix golangci-lint warnings 2 years ago
Jan Dittberner 64dd9429be Let the client send health checks periodically 2 years ago
Jan Dittberner 60be959c24 Implement health check infrastructure
This commit adds health check capabilities to the hsm.Access and health
response data to the messages returned by the health command.
2 years ago
Jan Dittberner 3107ad8abb Implement serial link and protocol handling infrastructure
This commit adds basic serial link and protocol support. None of the commands
from the docs/design.md document is implemented yet.

The following new packages have been added:

- seriallink containing the serial link handler including COBS decoding and
- protocol containing the protocol handler including msgpack unmarshalling
  and marshaling
- health containing a rudimentary health check implementation
- messages containing command and response types and generated msgpack
  marshaling code

A client simulation command has been added in cmd/clientsim.

README.md got instructions how to run the client simulator. The
docs/config.sample.yaml contains a new section for the serial connection
2 years ago
Jan Dittberner 0d69a9013d Refactor HSM setup
- create new type hsm.Access to encapsulate HSM operations
- make setup options operate on hsm.Access instances
- adapt tests and cmd/signer to work with hsm.Access
2 years ago
Jan Dittberner 5776723fa2 Fix typo (singer vs. signer) 2 years ago
Jan Dittberner 474e7717cc Fix Goland code inspection warnings 2 years ago
Jan Dittberner baf6d0f037 Configure and apply golangci-lint 2 years ago
Jan Dittberner 9fd40af603 Add -verbose flag, implement config options 2 years ago
Jan Dittberner 47d5b2afff Improve configuration, implement setup mode
- implement a dedicated setup mode for creating CA certificates that is
  triggered by the '-setup' command line flag
- switch to YAML configuration for comment support and more human
  readable syntax. Format documentation is in docs/config.sample.yaml
- move HSM related code to pkg/hsm
- improve consistency checks in pkg/config
2 years ago
Jan Dittberner de997913cf Implement configuration and CA hierarchy setup
This commit implements a mechanism to load CA configuration dynamically from
JSON files. Missing keys and certificates can be generated in a PKCS#11 HSM
or Smartcard. Certificates are stored as PEM encoded .crt files in the

The default PKCS#11 module (softhsm2) is now loaded from a platform specific
path using go:build comments.
2 years ago
Jan Dittberner 0a8b4896ba Add PKCS#11 test to generate root certificate
- add documentation how to initialize SoftHSM for testing
- add cmd/signer package to hold future signer command
- add test to use a private key from softhsm to create a root
2 years ago