Skip to content

Commit d8927d4

Browse files
committed
Update systemd unit file with new hierarchy
Signed-off-by: Hugues de Valon <[email protected]>
1 parent 599be48 commit d8927d4

File tree

22 files changed

+104
-78
lines changed

22 files changed

+104
-78
lines changed

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ features = ["pkcs11-provider", "tpm-provider", "tss-esapi/docs", "mbed-crypto-pr
5252

5353
[features]
5454
default = []
55-
no-parsec-user-and-clients-group = []
5655
mbed-crypto-provider = ["psa-crypto"]
5756
pkcs11-provider = ["pkcs11", "picky-asn1-der", "picky-asn1", "picky-asn1-x509", "psa-crypto", "rand"]
5857
tpm-provider = ["tss-esapi", "picky-asn1-der", "picky-asn1", "picky-asn1-x509", "hex"]

ci.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ while [ "$#" -gt 0 ]; do
6767
PROVIDER_NAME=$1
6868
cp $(pwd)/e2e_tests/provider_cfg/$1/config.toml $CONFIG_PATH
6969
if [ "$PROVIDER_NAME" = "all" ]; then
70-
FEATURES="--features=all-providers,no-parsec-user-and-clients-group"
70+
FEATURES="--features=all-providers"
7171
TEST_FEATURES="--features=all-providers"
7272
else
73-
FEATURES="--features=$1-provider,no-parsec-user-and-clients-group"
73+
FEATURES="--features=$1-provider"
7474
TEST_FEATURES="--features=$1-provider"
7575
fi
7676
;;

config.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ listener_type = "DomainSocket"
4444
# timeout expires, the connection is dropped.
4545
timeout = 200 # in milliseconds
4646

47+
# Specify the Unix Domain Socket path. The path is fixed and should always be the default one for
48+
# clients to connect. However, it is useful to change it for tests.
49+
# WARNING: If a file already exists at that path, the service will remove it before creating the
50+
# socket file.
51+
#socket_path = "/run/parsec/parsec.sock"
52+
4753
# (Required) Configuration for the components managing key info for providers.
4854
# Defined as an array of tables: https://github.com/toml-lang/toml#user-content-array-of-tables
4955
[[key_manager]]
@@ -54,7 +60,7 @@ name = "on-disk-manager"
5460
manager_type = "OnDisk"
5561

5662
# Path to the location where the mapping will be persisted (in this case, the filesystem path)
57-
#store_path = "./mappings"
63+
#store_path = "/var/lib/parsec/mappings"
5864

5965
# (Required) Provider configurations.
6066
# Defined as an array of tables: https://github.com/toml-lang/toml#user-content-array-of-tables

e2e_tests/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ parsec-client = { version = "0.9.0", features = ["testing"] }
1818
log = "0.4.11"
1919
rand = "0.7.3"
2020

21+
[patch.crates-io]
22+
# Just to make the CI pass, update with the newest version
23+
parsec-client = { git = 'https://github.com/hug-dev/parsec-client-rust', branch = 'new-socket-path' }
24+
2125
[dev-dependencies]
2226
ring = "0.16.15"
2327
env_logger = "0.7.1"

e2e_tests/provider_cfg/all/config.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ allow_root = true
1010
[listener]
1111
listener_type = "DomainSocket"
1212
timeout = 200 # in milliseconds
13+
socket_path = "/tmp/parsec.sock"
1314

1415
[[key_manager]]
1516
name = "on-disk-manager"
1617
manager_type = "OnDisk"
18+
store_path = "./mappings"
1719

1820
[[provider]]
1921
provider_type = "MbedCrypto"

e2e_tests/provider_cfg/mbed-crypto/config.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@ listener_type = "DomainSocket"
1212
# The timeout needs to be smaller than the test client timeout (five seconds) as it is testing
1313
# that the service does not hang for very big values of body or authentication length.
1414
timeout = 3000 # in milliseconds
15+
socket_path = "/tmp/parsec.sock"
1516

1617
[[key_manager]]
1718
name = "on-disk-manager"
1819
manager_type = "OnDisk"
20+
store_path = "./mappings"
1921

2022
[[provider]]
2123
provider_type = "MbedCrypto"

e2e_tests/provider_cfg/pkcs11/config.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@ listener_type = "DomainSocket"
1212
# The timeout needs to be smaller than the test client timeout (five seconds) as it is testing
1313
# that the service does not hang for very big values of body or authentication length.
1414
timeout = 3000 # in milliseconds
15+
socket_path = "/tmp/parsec.sock"
1516

1617
[[key_manager]]
1718
name = "on-disk-manager"
1819
manager_type = "OnDisk"
20+
store_path = "./mappings"
1921

2022
[[provider]]
2123
provider_type = "Pkcs11"

e2e_tests/provider_cfg/tpm/config.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@ listener_type = "DomainSocket"
1212
# The timeout needs to be smaller than the test client timeout (five seconds) as it is testing
1313
# that the service does not hang for very big values of body or authentication length.
1414
timeout = 3000 # in milliseconds
15+
socket_path = "/tmp/parsec.sock"
1516

1617
[[key_manager]]
1718
name = "on-disk-manager"
1819
manager_type = "OnDisk"
20+
store_path = "./mappings"
1921

2022
[[provider]]
2123
provider_type = "Tpm"

e2e_tests/src/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,15 @@ use parsec_client::core::interface::operations::psa_key_attributes::{
2222
Attributes, EccFamily, Lifetime, Policy, Type, UsageFlags,
2323
};
2424
use parsec_client::core::interface::requests::{Opcode, ProviderID, ResponseStatus, Result};
25+
use parsec_client::core::ipc_handler::unix_socket;
2526
use parsec_client::core::secrecy::{ExposeSecret, Secret};
2627
use parsec_client::error::Error;
2728
use std::collections::HashSet;
2829
use std::time::Duration;
2930

31+
const TEST_SOCKET_PATH: &str = "/tmp/parsec.sock";
32+
const TEST_TIMEOUT: Duration = Duration::from_secs(1);
33+
3034
/// Client structure automatically choosing a provider and high-level operation functions.
3135
#[derive(Debug)]
3236
pub struct TestClient {
@@ -58,6 +62,9 @@ impl TestClient {
5862
created_keys: Some(HashSet::new()),
5963
};
6064

65+
let ipc_handler = unix_socket::Handler::new(TEST_SOCKET_PATH.into(), Some(TEST_TIMEOUT));
66+
client.basic_client.set_ipc_handler(Box::from(ipc_handler));
67+
6168
let crypto_provider = client.find_crypto_provider();
6269
client.set_provider(crypto_provider);
6370
client

e2e_tests/src/raw_request.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const MAX_BODY_SIZE: usize = 1 << 31;
1313
#[derive(Copy, Clone, Debug)]
1414
pub struct RawRequestClient;
1515

16-
static SOCKET_PATH: &str = "/run/parsec/parsec.sock";
16+
static SOCKET_PATH: &str = "/tmp/parsec.sock";
1717
const TIMEOUT: Duration = Duration::from_secs(5);
1818

1919
#[allow(clippy::new_without_default)]

0 commit comments

Comments
 (0)