Add signing configuration options to the agent

This commit is contained in:
Cédric Verstraeten
2025-06-02 13:50:48 +00:00
parent cde7dbb58a
commit 5310dd4550
3 changed files with 18 additions and 2 deletions

View File

@@ -257,8 +257,8 @@ Next to attaching the configuration file, it is also possible to override the co
| `AGENT_ENCRYPTION_FINGERPRINT` | The fingerprint of the keypair (public/private keys), so you know which one to use. | "" |
| `AGENT_ENCRYPTION_PRIVATE_KEY` | The private key (assymetric/RSA) to decrypt and sign requests send over MQTT. | "" |
| `AGENT_ENCRYPTION_SYMMETRIC_KEY` | The symmetric key (AES) to encrypt and decrypt requests sent over MQTT. | "" |
| `AGENT_SIGN` | Enable 'true' or disable 'false' for signing recordings. | "true" |
| `AGENT_SIGN_PUBLIC_KEY` | The public key (RSA) to sign the recordings fingerprint, to validate origin. | "" - uses default one if empty |
| `AGENT_SIGNING` | Enable 'true' or disable 'false' for signing recordings. | "true" |
| `AGENT_SIGNING_PUBLIC_KEY` | The public key (RSA) to sign the recordings fingerprint to validate origin. | "" - uses default one if empty |
## Encryption

View File

@@ -519,6 +519,15 @@ func OverrideWithEnvironmentVariables(configuration *models.Configuration) {
case "AGENT_ENCRYPTION_SYMMETRIC_KEY":
configuration.Config.Encryption.SymmetricKey = value
break
/* When signing is enabled */
case "AGENT_SIGNING":
configuration.Config.Signing.Enabled = value
break
case "AGENT_SIGNING_PUBLIC_KEY":
signingPublicKey := strings.ReplaceAll(value, "\\n", "\n")
configuration.Config.Signing.PublicKey = signingPublicKey
break
}
}
}

View File

@@ -46,6 +46,7 @@ type Config struct {
HubSite string `json:"hub_site" bson:"hub_site"`
ConditionURI string `json:"condition_uri" bson:"condition_uri"`
Encryption *Encryption `json:"encryption,omitempty" bson:"encryption,omitempty"`
Signing *Signing `json:"signing,omitempty" bson:"signing,omitempty"`
RealtimeProcessing string `json:"realtimeprocessing,omitempty" bson:"realtimeprocessing,omitempty"`
RealtimeProcessingTopic string `json:"realtimeprocessing_topic" bson:"realtimeprocessing_topic"`
}
@@ -179,3 +180,9 @@ type Encryption struct {
PrivateKey string `json:"private_key" bson:"private_key"`
SymmetricKey string `json:"symmetric_key" bson:"symmetric_key"`
}
// Signing
type Signing struct {
Enabled string `json:"enabled" bson:"enabled"`
PublicKey string `json:"public_key" bson:"public_key"`
}