Allow custom certificates when connecting to BN (#2703)

## Issue Addressed

Resolves #2262 

## Proposed Changes

Add a new CLI flag `--beacon-nodes-tls-certs` which allows the user to specify a path to a certificate file (or a list of files, separated by commas). The VC will then use these certificates (in addition to the existing certificates in the OS trust store) when connecting to a beacon node over HTTPS.

## Additional Info

This only supports certificates in PEM format.
This commit is contained in:
Mac L
2021-10-15 00:07:11 +00:00
parent 05040e68ec
commit 7c23e2142a
5 changed files with 80 additions and 3 deletions

View File

@@ -202,6 +202,33 @@ fn use_long_timeouts_flag() {
.with_config(|config| assert!(config.use_long_timeouts));
}
#[test]
fn beacon_nodes_tls_certs_flag() {
let dir = TempDir::new().expect("Unable to create temporary directory");
CommandLineTest::new()
.flag(
"beacon-nodes-tls-certs",
Some(
vec![
dir.path().join("certificate.crt").to_str().unwrap(),
dir.path().join("certificate2.crt").to_str().unwrap(),
]
.join(",")
.as_str(),
),
)
.run()
.with_config(|config| {
assert_eq!(
config.beacon_nodes_tls_certs,
Some(vec![
dir.path().join("certificate.crt"),
dir.path().join("certificate2.crt")
])
)
});
}
// Tests for Graffiti flags.
#[test]
fn graffiti_flag() {