diff --git a/.gitignore b/.gitignore
index 5d7f2c6..98b95f2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,6 @@
_build
target
+target-aarch64-musl
+target-x86_64-musl
license.key
src/replication.rs
diff --git a/Cargo.lock b/Cargo.lock
index 3383c48..8980134 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -316,9 +316,9 @@ dependencies = [
[[package]]
name = "busrt"
-version = "0.4.7"
+version = "0.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "86a5ff051cf21c79116f5912c951d5bdee0e8bf53497f38bdce224509c2da5ff"
+checksum = "ee5f4261ec20cb308913175a3c988b2fbc885adf56a505d9b044499d5896d9f7"
dependencies = [
"async-channel",
"async-io",
@@ -1568,7 +1568,7 @@ dependencies = [
[[package]]
name = "psrt"
-version = "0.2.1"
+version = "0.2.2"
dependencies = [
"aes-gcm",
"async-channel",
@@ -1582,6 +1582,7 @@ dependencies = [
"clap_derive",
"colored",
"env_logger",
+ "eva-common",
"eva-sdk",
"fork",
"getch",
diff --git a/Cargo.toml b/Cargo.toml
index dd54d35..df4f59b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "psrt"
-version = "0.2.1"
+version = "0.2.2"
edition = "2021"
authors = ["Serhij S.
"]
license = "Apache-2.0"
@@ -77,6 +77,7 @@ parking_lot = "0.12.1"
async-trait = "0.1.74"
eva-sdk = "0.3.10"
once_cell = "1.18.0"
+eva-common = "0.3.17"
[features]
#default = ["server"]
@@ -87,5 +88,5 @@ cli = ["bma-benchmark", "byte-unit", "clap", "clap_derive", "env_logger",
server = ["base64", "bcrypt", "clap", "clap_derive", "colored", "chrono", "fork",
"hostname", "hyper", "serde_json", "syslog", "jemallocator", "submap/native-digest"]
crypto = ["aes-gcm", "rand"]
-openssl-vendored = ["openssl/vendored"]
+openssl-vendored = ["openssl/vendored", "eva-common/openssl-no-fips"]
std-alloc = []
diff --git a/Makefile b/Makefile
index e99207c..1062503 100644
--- a/Makefile
+++ b/Makefile
@@ -6,6 +6,7 @@ all:
clean:
rm -rf _build
cargo clean
+ rm -rf target*
tag:
git tag -a v${VERSION} -m v${VERSION}
@@ -30,17 +31,17 @@ pkg:
lsb_release -cs|grep ^focal$
rm -rf _build
mkdir -p _build
- cross build --target x86_64-unknown-linux-musl --release --features server,cli,openssl-vendored
- cross build --target aarch64-unknown-linux-musl --release --features server,cli,openssl-vendored
+ CARGO_TARGET_DIR=target-x86_64-musl cross build --target x86_64-unknown-linux-musl --release --features server,cli,openssl-vendored
+ CARGO_TARGET_DIR=target-aarch64-musl cross build --target aarch64-unknown-linux-musl --release --features server,cli,openssl-vendored
cargo build --release --features server,cli
- cd target/x86_64-unknown-linux-musl/release && tar czvf ../../../_build/psrt-${VERSION}-x86_64-musl.tar.gz psrtd psrt-cli
- cd target/aarch64-unknown-linux-musl/release && \
+ cd target-x86_64-musl/x86_64-unknown-linux-musl/release && tar czvf ../../../_build/psrt-${VERSION}-x86_64-musl.tar.gz psrtd psrt-cli
+ cd target-aarch64-musl/aarch64-unknown-linux-musl/release && \
aarch64-linux-gnu-strip psrtd && \
aarch64-linux-gnu-strip psrt-cli && \
tar czvf ../../../_build/psrt-${VERSION}-aarch64-musl.tar.gz psrtd psrt-cli
debian-pkg:
- cd make-deb && ./build.sh && mv psrt-${VERSION}-amd64.deb ../_build/
+ cd make-deb && TARGET_DIR=target-x86_64-musl ./build.sh && mv psrt-${VERSION}-amd64.deb ../_build/
cd make-deb && PACKAGE_SUFFIX=-ubuntu20.04 RUST_TARGET=. ./build.sh && \
mv psrt-${VERSION}-amd64-ubuntu20.04.deb ../_build/
@@ -55,7 +56,7 @@ release-enterprise:
DOCKER_OPTS="-v /opt/eva4-enterprise:/opt/eva4-enterprise" cross build --target x86_64-unknown-linux-musl --release --features cli,cluster,openssl-vendored
cargo build --release --features cluster,cli
cd make-deb && \
- ./build.sh enterprise && \
+ TARGET_DIR=target-x86_64-musl ./build.sh enterprise && \
PACKAGE_SUFFIX=-ubuntu20.04 RUST_TARGET=. ./build.sh enterprise && \
gsutil cp -a public-read psrt-enterprise-${VERSION}-amd64.deb gs://pub.bma.ai/psrt-enterprise/ && \
gsutil cp -a public-read psrt-enterprise-${VERSION}-amd64-ubuntu20.04.deb gs://pub.bma.ai/psrt-enterprise/
diff --git a/make-deb/build.sh b/make-deb/build.sh
index 374477f..344a9a4 100755
--- a/make-deb/build.sh
+++ b/make-deb/build.sh
@@ -14,18 +14,19 @@ fi
TARGET="${PACKAGE}-${VERSION}-amd64${PACKAGE_SUFFIX}"
[ -z "${RUST_TARGET}" ] && RUST_TARGET=x86_64-unknown-linux-musl
+[ -z "${TARGET_DIR}" ] && TARGET_DIR=target
rm -rf "./${TARGET}"
-mkdir -p ./${TARGET}/usr/bin
-mkdir -p ./${TARGET}/usr/sbin
-mkdir -p ./${TARGET}/lib/systemd/system
-mkdir -p ./${TARGET}/DEBIAN
-cp -vf ${PSRT}/target/${RUST_TARGET}/release/psrt-cli ./${TARGET}/usr/bin/
-cp -vf ${PSRT}/target/${RUST_TARGET}/release/psrtd ./${TARGET}/usr/sbin/
-cp -vf ${PSRT}/psrtd.service ./${TARGET}/lib/systemd/system/
-cp -rvf ./etc ./${TARGET}/
-strip ./${TARGET}/usr/bin/psrt-cli
-strip ./${TARGET}/usr/sbin/psrtd
+mkdir -p "./${TARGET}/usr/bin"
+mkdir -p "./${TARGET}/usr/sbin"
+mkdir -p "./${TARGET}/lib/systemd/system"
+mkdir -p "./${TARGET}/DEBIAN"
+cp -vf "${PSRT}/${TARGET_DIR}/${RUST_TARGET}/release/psrt-cli" "./${TARGET}/usr/bin/"
+cp -vf "${PSRT}/${TARGET_DIR}/${RUST_TARGET}/release/psrtd" "./${TARGET}/usr/sbin/"
+cp -vf "${PSRT}/psrtd.service" "./${TARGET}/lib/systemd/system/"
+cp -rvf ./etc "./${TARGET}/"
+strip "./${TARGET}/usr/bin/psrt-cli"
+strip "./${TARGET}/usr/sbin/psrtd"
(
cat << EOF
Package: ${PACKAGE}
@@ -36,6 +37,6 @@ Architecture: amd64
Maintainer: Serhij S.
Description: Industrial Pub-Sub server with minimal latency and MQTT-compatible logic
EOF
-) > ./${TARGET}/DEBIAN/control
-cp -vf ./debian/* ./${TARGET}/DEBIAN/
-dpkg-deb --build ./${TARGET}
+) > "./${TARGET}/DEBIAN/control"
+cp -vf ./debian/* "./${TARGET}/DEBIAN/"
+dpkg-deb --build "./${TARGET}"
diff --git a/src/server.rs b/src/server.rs
index 1843d34..1904afb 100644
--- a/src/server.rs
+++ b/src/server.rs
@@ -1544,8 +1544,12 @@ fn main() {
.expect("Unable to parse config path");
let config: Config = serde_yaml::from_str(&cfg).unwrap();
if config.proto.fips {
+ #[cfg(not(feature = "openssl-vendored"))]
openssl::fips::enable(true).expect("Can not enable OpenSSL FIPS 140");
+ #[cfg(not(feature = "openssl-vendored"))]
info!("OpenSSL FIPS 140 enabled");
+ #[cfg(feature = "openssl-vendored")]
+ panic!("FIPS can not be enabled, consider using a native OS distribution");
}
if opts.daemonize {
if let Ok(fork::Fork::Child) = fork::daemon(true, false) {