From 60e14f866ebbd99e210c6b9e066b17636ab1edc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20H=C3=A4ggblad?= Date: Wed, 10 Jan 2024 15:36:46 +0100 Subject: [PATCH 01/22] Add openssl to cargo deny ban --- deny.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/deny.toml b/deny.toml index 94bd758e59..812b1e6e1d 100644 --- a/deny.toml +++ b/deny.toml @@ -217,6 +217,7 @@ deny = [ # Wrapper crates can optionally be specified to allow the crate when it # is a direct dependency of the otherwise banned crate #{ name = "ansi_term", version = "=0.11.0", wrappers = [] }, + { name = "openssl"}, ] # List of features to allow/deny From 05957c366f7ed00edc40a0b7283ebe019ba26076 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20H=C3=A4ggblad?= Date: Thu, 18 Jan 2024 10:19:18 +0100 Subject: [PATCH 02/22] Switch reqwest to rustls --- Cargo.lock | 17 +---------------- Cargo.toml | 2 +- ephemera/Cargo.toml | 2 +- 3 files changed, 3 insertions(+), 18 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e4fc250373..24fc0458c0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3981,19 +3981,6 @@ dependencies = [ "tokio-io-timeout", ] -[[package]] -name = "hyper-tls" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" -dependencies = [ - "bytes", - "hyper", - "native-tls", - "tokio", - "tokio-native-tls", -] - [[package]] name = "iana-time-zone" version = "0.1.58" @@ -9191,12 +9178,10 @@ dependencies = [ "http-body", "hyper", "hyper-rustls", - "hyper-tls", "ipnet", "js-sys", "log", "mime", - "native-tls", "once_cell", "percent-encoding", "pin-project-lite 0.2.13", @@ -9208,7 +9193,6 @@ dependencies = [ "serde_urlencoded", "system-configuration", "tokio", - "tokio-native-tls", "tokio-rustls 0.24.1", "tokio-socks", "tokio-util", @@ -9218,6 +9202,7 @@ dependencies = [ "wasm-bindgen-futures", "wasm-streams", "web-sys", + "webpki-roots 0.25.2", "winreg", ] diff --git a/Cargo.toml b/Cargo.toml index bedb046d5b..3a328ad5f1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -158,7 +158,7 @@ log = "0.4" once_cell = "1.7.2" parking_lot = "0.12.1" rand = "0.8.5" -reqwest = "0.11.22" +reqwest = { version = "0.11.22", default_features = false, features = ["rustls-tls"] } schemars = "0.8.1" serde = "1.0.152" serde_json = "1.0.91" diff --git a/ephemera/Cargo.toml b/ephemera/Cargo.toml index 6221421aab..f8e963f5b7 100644 --- a/ephemera/Cargo.toml +++ b/ephemera/Cargo.toml @@ -37,7 +37,7 @@ nym-config = { path = "../common/config" } nym-ephemera-common = { path = "../common/cosmwasm-smart-contracts/ephemera" } pretty_env_logger = "0.4" refinery = { version = "0.8.7", features = ["rusqlite"], optional = true } -reqwest = { version = "0.11.22", features = ["json"] } +reqwest = { version = "0.11.22", default_features = false, features = ["rustls-tls", "json"] } # Rocksdb kills compilation times and we're not currently using it. The reason # we comment it out is that rust-analyzer runs with --all-features #rocksdb = { version = "0.21.0", optional = true } From 4353bab636b7547a3f05015ded449682efa8146a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20H=C3=A4ggblad?= Date: Thu, 18 Jan 2024 10:19:42 +0100 Subject: [PATCH 03/22] Remove explicit openssl dependency --- Cargo.lock | 12 ------------ common/client-libs/validator-client/Cargo.toml | 3 +-- sdk/lib/socks5-listener/Cargo.toml | 1 - 3 files changed, 1 insertion(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 24fc0458c0..b1e3f3ed26 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7294,7 +7294,6 @@ dependencies = [ "nym-credential-storage", "nym-crypto", "nym-socks5-client-core", - "openssl", "rand 0.7.3", "safer-ffi", "serde", @@ -7626,7 +7625,6 @@ dependencies = [ "nym-network-defaults", "nym-service-provider-directory-common", "nym-vesting-contract-common", - "openssl", "prost 0.12.1", "reqwest", "serde", @@ -7888,15 +7886,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" -[[package]] -name = "openssl-src" -version = "300.1.5+3.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "559068e4c12950d7dcaa1857a61725c0d38d4fc03ff8e070ab31a75d6e316491" -dependencies = [ - "cc", -] - [[package]] name = "openssl-sys" version = "0.9.98" @@ -7905,7 +7894,6 @@ checksum = "c1665caf8ab2dc9aef43d1c0023bd904633a6a05cb30b0ad59bec2ae986e57a7" dependencies = [ "cc", "libc", - "openssl-src", "pkg-config", "vcpkg", ] diff --git a/common/client-libs/validator-client/Cargo.toml b/common/client-libs/validator-client/Cargo.toml index 5e778b4cb2..5325428da2 100644 --- a/common/client-libs/validator-client/Cargo.toml +++ b/common/client-libs/validator-client/Cargo.toml @@ -31,7 +31,6 @@ log = { workspace = true } url = { workspace = true, features = ["serde"] } tokio = { workspace = true, features = ["sync", "time"] } futures = { workspace = true } -openssl = { version = "^0.10.55", features = ["vendored"], optional = true } nym-coconut-interface = { path = "../../coconut-interface" } nym-network-defaults = { path = "../../network-defaults" } @@ -90,7 +89,7 @@ required-features = ["http-client"] [features] default = ["http-client"] -http-client = ["cosmrs/rpc", "openssl"] +http-client = ["cosmrs/rpc"] generate-ts = [] contract-testing = ["nym-mixnet-contract-common/contract-testing"] diff --git a/sdk/lib/socks5-listener/Cargo.toml b/sdk/lib/socks5-listener/Cargo.toml index a3355fe3c6..425154a5cb 100644 --- a/sdk/lib/socks5-listener/Cargo.toml +++ b/sdk/lib/socks5-listener/Cargo.toml @@ -23,7 +23,6 @@ nym-config-common = { path = "../../../common/config", package = "nym-config" } nym-credential-storage = { path = "../../../common/credential-storage" } nym-crypto = { path = "../../../common/crypto" } nym-socks5-client-core = { path = "../../../common/socks5-client-core", default-features = false } -openssl = { version = "^0.10.55", features = ["vendored"] } serde = { workspace = true } tokio = { workspace = true, features = ["sync", "time"] } log = "0.4.17" From 588839740fa9962924fbd250333e2ea2e54b41a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20H=C3=A4ggblad?= Date: Thu, 18 Jan 2024 10:20:10 +0100 Subject: [PATCH 04/22] Switch tungstenite to rustls --- Cargo.lock | 14 +------------- Cargo.toml | 4 ++-- common/client-libs/gateway-client/Cargo.toml | 2 +- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b1e3f3ed26..7615865120 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -11010,16 +11010,6 @@ dependencies = [ "syn 2.0.38", ] -[[package]] -name = "tokio-native-tls" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" -dependencies = [ - "native-tls", - "tokio", -] - [[package]] name = "tokio-rustls" version = "0.23.4" @@ -11098,9 +11088,8 @@ checksum = "212d5dcb2a1ce06d81107c3d0ffa3121fe974b73f068c8282cb1c32328113b6c" dependencies = [ "futures-util", "log", - "native-tls", + "rustls 0.21.7", "tokio", - "tokio-native-tls", "tungstenite", ] @@ -11553,7 +11542,6 @@ dependencies = [ "http", "httparse", "log", - "native-tls", "rand 0.8.5", "rustls 0.21.7", "sha1", diff --git a/Cargo.toml b/Cargo.toml index 3a328ad5f1..0cd172bdef 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -168,9 +168,9 @@ time = "0.3.30" thiserror = "1.0.48" tokio = "1.33.0" tokio-util = "0.7.10" -tokio-tungstenite = "0.20.1" +tokio-tungstenite = { version = "0.20.1", features = ["rustls"] } tracing = "0.1.37" -tungstenite = { version = "0.20.1", default-features = false } +tungstenite = { version = "0.20.1", default-features = false, features = ["rustls"] } ts-rs = "7.0.0" utoipa = "3.5.0" utoipa-swagger-ui = "3.1.5" diff --git a/common/client-libs/gateway-client/Cargo.toml b/common/client-libs/gateway-client/Cargo.toml index 75f56fd7c0..67297687e4 100644 --- a/common/client-libs/gateway-client/Cargo.toml +++ b/common/client-libs/gateway-client/Cargo.toml @@ -48,7 +48,7 @@ features = ["net", "sync", "time"] workspace = true # the choice of this particular tls feature was arbitrary; # if you reckon a different one would be more appropriate, feel free to change it -features = ["native-tls"] +# features = ["native-tls"] # wasm-only dependencies [target."cfg(target_arch = \"wasm32\")".dependencies.wasm-bindgen] From 9b44674f43db7ce268ae38c24973ea19e136083e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20H=C3=A4ggblad?= Date: Mon, 5 Feb 2024 10:05:55 +0100 Subject: [PATCH 05/22] Remove sdk-version-bump from main workspace temporarily In the upcoming cargo-edit version then the dependency on ureq is dropped and also the implicit dependency on openssl --- Cargo.lock | 370 +---------------------------------------------------- Cargo.toml | 2 +- 2 files changed, 5 insertions(+), 367 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7615865120..813f304de4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1110,69 +1110,6 @@ dependencies = [ "bytes", ] -[[package]] -name = "camino" -version = "1.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c59e92b5a388f549b863a7bea62612c09f24c8393560709a54558a9abdfb3b9c" -dependencies = [ - "serde", -] - -[[package]] -name = "cargo-edit" -version = "0.11.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f769ab9e8c1652d78dd0b3ec59cdaa1e2bcb3b6b39f6681b256abcdbe101cc14" -dependencies = [ - "anyhow", - "cargo_metadata", - "clap 4.4.7", - "concolor-control", - "crates-index", - "dirs-next", - "dunce", - "env_proxy", - "git2", - "hex", - "indexmap 1.9.3", - "native-tls", - "pathdiff", - "regex", - "semver 1.0.20", - "serde", - "serde_derive", - "serde_json", - "subprocess", - "termcolor", - "toml_edit 0.16.2", - "ureq", - "url", -] - -[[package]] -name = "cargo-platform" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12024c4645c97566567129c204f65d5815a8c9aecf30fcbe682b2fe034996d36" -dependencies = [ - "serde", -] - -[[package]] -name = "cargo_metadata" -version = "0.15.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eee4243f1f26fc7a42710e7439c149e2b10b05472f88090acce52632f231a73a" -dependencies = [ - "camino", - "cargo-platform", - "semver 1.0.20", - "serde", - "serde_json", - "thiserror", -] - [[package]] name = "cast" version = "0.3.0" @@ -1380,7 +1317,6 @@ dependencies = [ "anstyle", "clap_lex 0.6.0", "strsim", - "terminal_size", ] [[package]] @@ -1477,23 +1413,6 @@ dependencies = [ "unicode-width", ] -[[package]] -name = "concolor-control" -version = "0.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7104119c2f80d887239879d0c50e033cd40eac9a3f3561e0684ba7d5d654f4da" -dependencies = [ - "atty", - "bitflags 1.3.2", - "concolor-query", -] - -[[package]] -name = "concolor-query" -version = "0.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad159cc964ac8f9d407cbc0aa44b02436c054b541f2b4b5f06972e1efdc54bc7" - [[package]] name = "concurrent-queue" version = "2.3.0" @@ -1798,27 +1717,6 @@ dependencies = [ "libc", ] -[[package]] -name = "crates-index" -version = "0.18.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "599f67b56f40863598cb30450427049935d05de2e36c61d33c050f04d7ec8cf2" -dependencies = [ - "git2", - "hex", - "home", - "memchr", - "num_cpus", - "rayon", - "rustc-hash", - "semver 1.0.20", - "serde", - "serde_derive", - "serde_json", - "smartstring", - "toml 0.5.11", -] - [[package]] name = "crc" version = "3.0.1" @@ -2632,16 +2530,6 @@ dependencies = [ "dirs-sys 0.4.1", ] -[[package]] -name = "dirs-next" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" -dependencies = [ - "cfg-if", - "dirs-sys-next", -] - [[package]] name = "dirs-sys" version = "0.3.7" @@ -2665,17 +2553,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "dirs-sys-next" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" -dependencies = [ - "libc", - "redox_users", - "winapi", -] - [[package]] name = "displaydoc" version = "0.2.4" @@ -2705,12 +2582,6 @@ version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcbb2bf8e87535c23f7a8a321e364ce21462d0ff10cb6407820e8e96dfff6653" -[[package]] -name = "dunce" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" - [[package]] name = "dyn-clone" version = "1.0.14" @@ -2911,16 +2782,6 @@ dependencies = [ "regex", ] -[[package]] -name = "env_proxy" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a5019be18538406a43b5419a5501461f0c8b49ea7dfda0cfc32f4e51fc44be1" -dependencies = [ - "log", - "url", -] - [[package]] name = "ephemera" version = "0.1.0" @@ -3223,21 +3084,6 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - [[package]] name = "form_urlencoded" version = "1.2.0" @@ -3522,21 +3368,6 @@ version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" -[[package]] -name = "git2" -version = "0.14.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0155506aab710a86160ddb504a480d2964d7ab5b9e62419be69e0032bc5931c" -dependencies = [ - "bitflags 1.3.2", - "libc", - "libgit2-sys", - "log", - "openssl-probe", - "openssl-sys", - "url", -] - [[package]] name = "glob" version = "0.3.1" @@ -3756,9 +3587,6 @@ name = "hex" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" -dependencies = [ - "serde", -] [[package]] name = "hex-literal" @@ -4440,15 +4268,6 @@ dependencies = [ "libc", ] -[[package]] -name = "kstring" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec3066350882a1cd6d950d055997f379ac37fd39f81cd4d8ed186032eb3c5747" -dependencies = [ - "static_assertions", -] - [[package]] name = "language-tags" version = "0.3.2" @@ -4515,20 +4334,6 @@ version = "0.2.149" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" -[[package]] -name = "libgit2-sys" -version = "0.13.5+1.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51e5ea06c26926f1002dd553fded6cfcdc9784c1f60feeb58368b4d9b07b6dba" -dependencies = [ - "cc", - "libc", - "libssh2-sys", - "libz-sys", - "openssl-sys", - "pkg-config", -] - [[package]] name = "libm" version = "0.2.8" @@ -5284,20 +5089,6 @@ dependencies = [ "vcpkg", ] -[[package]] -name = "libssh2-sys" -version = "0.2.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b094a36eb4b8b8c8a7b4b8ae43b2944502be3e59cd87687595cf6b0a71b3f4ca" -dependencies = [ - "cc", - "libc", - "libz-sys", - "openssl-sys", - "pkg-config", - "vcpkg", -] - [[package]] name = "libz-sys" version = "1.1.12" @@ -5701,24 +5492,6 @@ dependencies = [ "unsigned-varint", ] -[[package]] -name = "native-tls" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" -dependencies = [ - "lazy_static", - "libc", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework", - "security-framework-sys", - "tempfile", -] - [[package]] name = "netlink-packet-core" version = "0.4.2" @@ -5891,15 +5664,6 @@ dependencies = [ "minimal-lexical", ] -[[package]] -name = "nom8" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae01545c9c7fc4486ab7debaf2aad7003ac19431791868fb2e8066df97fad2f8" -dependencies = [ - "memchr", -] - [[package]] name = "notify" version = "5.2.0" @@ -7854,32 +7618,6 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" -[[package]] -name = "openssl" -version = "0.10.62" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cde4d2d9200ad5909f8dac647e29482e07c3a35de8a13fce7c9c7747ad9f671" -dependencies = [ - "bitflags 2.4.1", - "cfg-if", - "foreign-types", - "libc", - "once_cell", - "openssl-macros", - "openssl-sys", -] - -[[package]] -name = "openssl-macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.38", -] - [[package]] name = "openssl-probe" version = "0.1.5" @@ -9752,18 +9490,6 @@ dependencies = [ "untrusted 0.7.1", ] -[[package]] -name = "sdk-version-bump" -version = "0.1.0" -dependencies = [ - "anyhow", - "cargo-edit", - "clap 4.4.7", - "semver 1.0.20", - "serde", - "serde_json", -] - [[package]] name = "sdp" version = "0.5.3" @@ -9850,9 +9576,6 @@ name = "semver" version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" -dependencies = [ - "serde", -] [[package]] name = "semver-parser" @@ -10198,18 +9921,6 @@ version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" -[[package]] -name = "smartstring" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fb72c633efbaa2dd666986505016c32c3044395ceaf881518399d2f4127ee29" -dependencies = [ - "autocfg 1.1.0", - "serde", - "static_assertions", - "version_check", -] - [[package]] name = "snafu" version = "0.7.5" @@ -10269,17 +9980,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "socks" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0c3dbbd9ae980613c6dd8e28a9407b50509d3803b57624d5dfe8315218cd58b" -dependencies = [ - "byteorder", - "libc", - "winapi", -] - [[package]] name = "soketto" version = "0.7.1" @@ -10587,16 +10287,6 @@ dependencies = [ "webrtc-util", ] -[[package]] -name = "subprocess" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c2e86926081dda636c546d8c5e641661049d7562a68f5488be4a1f7f66f6086" -dependencies = [ - "libc", - "winapi", -] - [[package]] name = "substring" version = "1.4.5" @@ -10844,16 +10534,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "terminal_size" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7" -dependencies = [ - "rustix 0.38.19", - "windows-sys 0.48.0", -] - [[package]] name = "textwrap" version = "0.16.0" @@ -11128,7 +10808,7 @@ checksum = "dd79e69d3b627db300ff956027cc6c3798cef26d22526befdfcd12feeb6d2257" dependencies = [ "serde", "serde_spanned", - "toml_datetime 0.6.3", + "toml_datetime", "toml_edit 0.19.15", ] @@ -11140,19 +10820,10 @@ checksum = "185d8ab0dfbb35cf1399a6344d8484209c088f75f8f68230da55d48d95d43e3d" dependencies = [ "serde", "serde_spanned", - "toml_datetime 0.6.3", + "toml_datetime", "toml_edit 0.20.2", ] -[[package]] -name = "toml_datetime" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4553f467ac8e3d374bc9a177a26801e5d0f9b211aa1673fb137a403afd1c9cf5" -dependencies = [ - "serde", -] - [[package]] name = "toml_datetime" version = "0.6.3" @@ -11162,20 +10833,6 @@ dependencies = [ "serde", ] -[[package]] -name = "toml_edit" -version = "0.16.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd30deba9a1cd7153c22aecf93e86df639e7b81c622b0af8d9255e989991a7b7" -dependencies = [ - "indexmap 1.9.3", - "itertools 0.10.5", - "kstring", - "nom8", - "serde", - "toml_datetime 0.5.1", -] - [[package]] name = "toml_edit" version = "0.19.15" @@ -11185,7 +10842,7 @@ dependencies = [ "indexmap 2.0.2", "serde", "serde_spanned", - "toml_datetime 0.6.3", + "toml_datetime", "winnow", ] @@ -11198,7 +10855,7 @@ dependencies = [ "indexmap 2.0.2", "serde", "serde_spanned", - "toml_datetime 0.6.3", + "toml_datetime", "winnow", ] @@ -11739,25 +11396,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0976c77def3f1f75c4ef892a292c31c0bbe9e3d0702c63044d7c76db298171a3" -[[package]] -name = "ureq" -version = "2.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5ccd538d4a604753ebc2f17cd9946e89b77bf87f6a8e2309667c6f2e87855e3" -dependencies = [ - "base64 0.21.4", - "log", - "native-tls", - "once_cell", - "rustls 0.21.7", - "rustls-webpki", - "serde", - "serde_json", - "socks", - "url", - "webpki-roots 0.25.2", -] - [[package]] name = "url" version = "2.4.1" diff --git a/Cargo.toml b/Cargo.toml index 0cd172bdef..8292cdf6d9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -104,7 +104,7 @@ members = [ "nym-outfox", "nym-validator-rewarder", "tools/internal/ssl-inject", - "tools/internal/sdk-version-bump", + # "tools/internal/sdk-version-bump", "tools/nym-cli", "tools/nym-nr-query", "tools/nymvisor", From 3771cb9188451977f650da5e628d99bde34668b3 Mon Sep 17 00:00:00 2001 From: benedettadavico Date: Wed, 14 Feb 2024 11:55:30 +0100 Subject: [PATCH 06/22] Update changelog and bump versions --- CHANGELOG.md | 17 ++++++++++++ clients/native/Cargo.toml | 2 +- clients/socks5/Cargo.toml | 2 +- explorer-api/Cargo.toml | 2 +- gateway/Cargo.toml | 2 +- mixnode/Cargo.toml | 2 +- nym-api/Cargo.toml | 2 +- nym-wallet/Cargo.lock | 26 +++++++++++-------- nym-wallet/package.json | 2 +- nym-wallet/src-tauri/Cargo.toml | 2 +- nym-wallet/src-tauri/tauri.conf.json | 2 +- .../network-requester/Cargo.toml | 2 +- .../network-statistics/Cargo.toml | 2 +- tools/nym-cli/Cargo.toml | 4 +-- 14 files changed, 45 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f5a720221c..34fa8c9398 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,23 @@ Post 1.0.0 release, the changelog format is based on [Keep a Changelog](https:// ## [Unreleased] +## [2024.1-marabou] (2024-02-15) + +**New Features:** +- Introduced nymvisor support for nym-api, gateway, and mixnode binaries ([#4158]) +- Revamped nym-api execution with the addition of init and run commands ([#4225]) + +**Enhancements:** +- Implemented internal improvements for gateways to optimize internal packet routing +- Improved routing score calculation + +**Bug Fixes:** +- Resolved various bugs to enhance overall stability + +[#4158]: https://github.com/nymtech/nym/pull/4158 +[#4225]: https://github.com/nymtech/nym/pull/4225 + + ## [2023.5-rolo] (2023-11-28) - Gateway won't open websocket listener until embedded Network Requester becomes available ([#4166]) diff --git a/clients/native/Cargo.toml b/clients/native/Cargo.toml index 0c5d4b5fd1..f9875095e5 100644 --- a/clients/native/Cargo.toml +++ b/clients/native/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nym-client" -version = "1.1.32" +version = "1.1.33" authors = ["Dave Hrycyszyn ", "Jędrzej Stuczyński "] description = "Implementation of the Nym Client" edition = "2021" diff --git a/clients/socks5/Cargo.toml b/clients/socks5/Cargo.toml index 72a94c4c2d..141f7de00d 100644 --- a/clients/socks5/Cargo.toml +++ b/clients/socks5/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nym-socks5-client" -version = "1.1.32" +version = "1.1.33" authors = ["Dave Hrycyszyn "] description = "A SOCKS5 localhost proxy that converts incoming messages to Sphinx and sends them to a Nym address" edition = "2021" diff --git a/explorer-api/Cargo.toml b/explorer-api/Cargo.toml index f4d132d92a..bbc8ff468f 100644 --- a/explorer-api/Cargo.toml +++ b/explorer-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "explorer-api" -version = "1.1.32" +version = "1.1.33" edition = "2021" license.workspace = true diff --git a/gateway/Cargo.toml b/gateway/Cargo.toml index a845ba908b..e65496a5bd 100644 --- a/gateway/Cargo.toml +++ b/gateway/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "nym-gateway" license = "GPL-3.0" -version = "1.1.32" +version = "1.1.33" authors = [ "Dave Hrycyszyn ", "Jędrzej Stuczyński ", diff --git a/mixnode/Cargo.toml b/mixnode/Cargo.toml index 9ad7c5081f..5282dcf712 100644 --- a/mixnode/Cargo.toml +++ b/mixnode/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "nym-mixnode" license = "GPL-3.0" -version = "1.1.34" +version = "1.1.35" authors = [ "Dave Hrycyszyn ", "Jędrzej Stuczyński ", diff --git a/nym-api/Cargo.toml b/nym-api/Cargo.toml index 308afb7736..adad75cae6 100644 --- a/nym-api/Cargo.toml +++ b/nym-api/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "nym-api" license = "GPL-3.0" -version = "1.1.34" +version = "1.1.35" authors = [ "Dave Hrycyszyn ", "Jędrzej Stuczyński ", diff --git a/nym-wallet/Cargo.lock b/nym-wallet/Cargo.lock index 2209e5d647..a197456fb9 100644 --- a/nym-wallet/Cargo.lock +++ b/nym-wallet/Cargo.lock @@ -750,6 +750,12 @@ version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28c122c3980598d243d63d9a704629a2d748d101f278052ff068be5a4423ab6f" +[[package]] +name = "const-str" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aca749d3d3f5b87a0d6100509879f9cf486ab510803a4a4e1001da1ff61c2bd6" + [[package]] name = "convert_case" version = "0.4.0" @@ -3109,6 +3115,7 @@ dependencies = [ "clap", "clap_complete", "clap_complete_fig", + "const-str", "log", "pretty_env_logger", "schemars", @@ -3317,6 +3324,7 @@ dependencies = [ "cfg-if", "dotenvy", "hex-literal", + "log", "once_cell", "schemars", "serde", @@ -3446,7 +3454,6 @@ dependencies = [ "nym-network-defaults", "nym-service-provider-directory-common", "nym-vesting-contract-common", - "openssl", "prost", "reqwest", "serde", @@ -3678,15 +3685,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" -[[package]] -name = "openssl-src" -version = "111.27.0+1.1.1v" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06e8f197c82d7511c5b014030c9b1efeda40d7d5f99d23b4ceed3524a5e63f02" -dependencies = [ - "cc", -] - [[package]] name = "openssl-sys" version = "0.9.91" @@ -3695,7 +3693,6 @@ checksum = "866b5f16f90776b9bb8dc1e1802ac6f0513de3a7a7465867bfbc563dc737faac" dependencies = [ "cc", "libc", - "openssl-src", "pkg-config", "vcpkg", ] @@ -4446,6 +4443,7 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-futures", "web-sys", + "webpki-roots", "winreg", ] @@ -6262,6 +6260,12 @@ dependencies = [ "system-deps 6.1.1", ] +[[package]] +name = "webpki-roots" +version = "0.25.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" + [[package]] name = "webview2-com" version = "0.19.1" diff --git a/nym-wallet/package.json b/nym-wallet/package.json index f0d1b31155..e9098e8c15 100644 --- a/nym-wallet/package.json +++ b/nym-wallet/package.json @@ -1,6 +1,6 @@ { "name": "@nymproject/nym-wallet-app", - "version": "1.2.12-rc.2", + "version": "1.2.13", "license": "MIT", "main": "index.js", "scripts": { diff --git a/nym-wallet/src-tauri/Cargo.toml b/nym-wallet/src-tauri/Cargo.toml index 854aa1d57f..67f100aa05 100644 --- a/nym-wallet/src-tauri/Cargo.toml +++ b/nym-wallet/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nym_wallet" -version = "1.2.11" +version = "1.2.12" description = "Nym Native Wallet" authors = ["Nym Technologies SA"] license = "" diff --git a/nym-wallet/src-tauri/tauri.conf.json b/nym-wallet/src-tauri/tauri.conf.json index 8aabb2bc80..f0a42fa8df 100644 --- a/nym-wallet/src-tauri/tauri.conf.json +++ b/nym-wallet/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "package": { "productName": "nym-wallet", - "version": "1.2.11" + "version": "1.2.12" }, "build": { "distDir": "../dist", diff --git a/service-providers/network-requester/Cargo.toml b/service-providers/network-requester/Cargo.toml index 7a2805cd17..f65775ded6 100644 --- a/service-providers/network-requester/Cargo.toml +++ b/service-providers/network-requester/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "nym-network-requester" license = "GPL-3.0" -version = "1.1.32" +version = "1.1.33" authors.workspace = true edition.workspace = true rust-version = "1.65" diff --git a/service-providers/network-statistics/Cargo.toml b/service-providers/network-statistics/Cargo.toml index 98f2494c41..5b0ec549f0 100644 --- a/service-providers/network-statistics/Cargo.toml +++ b/service-providers/network-statistics/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nym-network-statistics" -version = "1.1.32" +version = "1.1.33" edition = "2021" license.workspace = true diff --git a/tools/nym-cli/Cargo.toml b/tools/nym-cli/Cargo.toml index 29a6f85e2f..fb4ffb7aab 100644 --- a/tools/nym-cli/Cargo.toml +++ b/tools/nym-cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nym-cli" -version = "1.1.33" +version = "1.1.34" authors.workspace = true edition = "2021" license.workspace = true @@ -30,4 +30,4 @@ nym-network-defaults = { path = "../../common/network-defaults" } [package.metadata.deb] name = "nym-cli" maintainer-scripts = "debian" -systemd-units = { enable = false } \ No newline at end of file +systemd-units = { enable = false } From f0705cd1f9b625f926df5b316aaffa8853a39d93 Mon Sep 17 00:00:00 2001 From: benedettadavico Date: Thu, 15 Feb 2024 10:56:13 +0100 Subject: [PATCH 07/22] Update workflow to add nymvisor binary --- .github/workflows/ci-build-upload-binaries.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci-build-upload-binaries.yml b/.github/workflows/ci-build-upload-binaries.yml index afaae3536e..c6a8be1811 100644 --- a/.github/workflows/ci-build-upload-binaries.yml +++ b/.github/workflows/ci-build-upload-binaries.yml @@ -30,6 +30,7 @@ on: - "sdk/rust/nym-sdk/**" - "service-providers/**" - "tools/**" + - "nymvisor/**" jobs: publish-nym: @@ -105,6 +106,7 @@ jobs: target/release/nym-network-requester target/release/nym-network-statistics target/release/nym-cli + target/release/nymvisor retention-days: 30 # If this was a pull_request or nightly, upload to build server @@ -122,6 +124,7 @@ jobs: cp target/release/nym-api $OUTPUT_DIR cp target/release/nym-network-requester $OUTPUT_DIR cp target/release/nym-network-statistics $OUTPUT_DIR + cp target/release/nymvisor $OUTPUT_DIR cp target/release/nym-cli $OUTPUT_DIR cp target/release/explorer-api $OUTPUT_DIR cp target/debian/*.deb $OUTPUT_DIR From 71c975d20c72606882d677f5e31a5a25ef79bd5d Mon Sep 17 00:00:00 2001 From: benedetta davico <46782255+benedettadavico@users.noreply.github.com> Date: Thu, 15 Feb 2024 11:46:20 +0100 Subject: [PATCH 08/22] Update publish-nym-binaries.yml --- .github/workflows/publish-nym-binaries.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/publish-nym-binaries.yml b/.github/workflows/publish-nym-binaries.yml index 9846dff2c7..5de57c66c7 100644 --- a/.github/workflows/publish-nym-binaries.yml +++ b/.github/workflows/publish-nym-binaries.yml @@ -29,6 +29,7 @@ jobs: client_hash: ${{ steps.binary-hashes.outputs.client_hash }} mixnode_hash: ${{ steps.binary-hashes.outputs.mixnode_hash }} gateway_hash: ${{ steps.binary-hashes.outputs.gateway_hash }} + nymvisor_hash: ${{ steps.binary-hashes.outputs.nymvisor_hash }} socks5_hash: ${{ steps.binary-hashes.outputs.socks5_hash }} netreq_hash: ${{ steps.binary-hashes.outputs.netreq_hash }} cli_hash: ${{ steps.binary-hashes.outputs.cli_hash }} @@ -36,6 +37,7 @@ jobs: client_version: ${{ steps.binary-versions.outputs.client_version }} mixnode_version: ${{ steps.binary-versions.outputs.mixnode_version }} gateway_version: ${{ steps.binary-versions.outputs.gateway_version }} + nymvisor_version: ${{ steps.binary-versions.outputs.nymvisor_version }} socks5_version: ${{ steps.binary-versions.outputs.socks5_version }} netreq_version: ${{ steps.binary-versions.outputs.netreq_version }} cli_version: ${{ steps.binary-versions.outputs.cli_version }} @@ -78,6 +80,7 @@ jobs: target/release/nym-network-requester target/release/nym-network-statistics target/release/nym-cli + target/release/nymvisor retention-days: 30 - id: create-release @@ -95,6 +98,7 @@ jobs: target/release/nym-network-requester target/release/nym-network-statistics target/release/nym-cli + target/release/nymvisor push-release-data-client: if: ${{ (startsWith(github.ref, 'refs/tags/nym-binaries-') && github.event_name == 'release') || github.event_name == 'workflow_dispatch' }} From 83da1f228bede6a9a8d97a5047a138a15981f40a Mon Sep 17 00:00:00 2001 From: Tommy Verrall Date: Fri, 16 Feb 2024 14:05:53 +0100 Subject: [PATCH 09/22] debian package changer - instead of dealing with the complexities of initing the builds, it's a complex beast for automagically guessing a user config for a binary - therefore, find their existing binary, move the executable from /usr/bin/ then find and replace it with their current set up - a user then can do sudo apt install nym-gateway && systemctl restart nym-gateway.service - script tells the user a few key things too --- gateway/debian/postinst | 55 ++++++++++++++++++++++++++++++++++++++--- gateway/debian/service | 11 --------- mixnode/debian/postinst | 55 ++++++++++++++++++++++++++++++++++++++--- mixnode/debian/service | 11 --------- 4 files changed, 102 insertions(+), 30 deletions(-) delete mode 100644 gateway/debian/service delete mode 100644 mixnode/debian/service diff --git a/gateway/debian/postinst b/gateway/debian/postinst index 9817170917..920339a36e 100644 --- a/gateway/debian/postinst +++ b/gateway/debian/postinst @@ -1,6 +1,53 @@ #DEBHELPER# -useradd nym -mkdir -p /etc/nym -chown -R nym /etc/nym -su nym -c 'NYM_HOME_DIR=/etc/nym nym-gateway init --host 0.0.0.0 --id nym-gateway --public-ips $(curl https://ipinfo.io/ip)' +default_location="/usr/bin/nym-gateway" +default_user="nym" +default_group="nym" + +existing_binary=$(sudo find / \( -path /proc -o -path /sys -o -path /dev -o -path /mnt -o -path /media \) -prune -o -type f -name nym-gateway -print 2>/dev/null) + +if [[ -n "$existing_binary" ]] && [[ "$existing_binary" != "/usr/bin/nym-gateway" ]]; then + echo "existing binary found at $existing_binary" + + backup_path="${existing_binary}.backup" + echo "backing up the original binary to $backup_path" + sudo cp "$existing_binary" "$backup_path" + + original_user=$(sudo stat -c "%U" "$existing_binary") + original_group=$(sudo stat -c "%G" "$existing_binary") + + echo "moving new binary from /usr/bin/nym-gateway to $existing_binary" + sudo mv "/usr/bin/nym-gateway" "$existing_binary" + + echo "changing ownership to $original_user:$original_group" + sudo chown "$original_user":"$original_group" "$existing_binary" + + original_perms=$(sudo stat -c "%a" "$backup_path") + echo "setting permissions to $original_perms" + sudo chmod "$original_perms" "$existing_binary" + + echo "please restart the nym-gateway process to apply changes." + echo "sometimes the gateways will require a re-init, but comms during releases should highlight this" + echo "usually: systemctl restart nym-gateway.service" + +elif [[ ! -f "$default_location" ]]; then + echo "no existing binary found, performing first-time installation." + + if [[ -f "/usr/bin/nym-gateway" ]]; then + echo "moving new binary to $default_location" + sudo mv "/usr/bin/nym-gateway" "$default_location" + + echo "setting default ownership to $default_user:$default_group" + sudo chown "$default_user":"$default_group" "$default_location" + + echo "setting default permissions" + sudo chmod 755 "$default_location" + + echo "installation complete. please configure and start the nym-gateway process manually." + echo "please refer to https://nymtech.net/operators/nodes/gateway-setup.html" + else + echo "error: the new binary /usr/bin/nym-gateway does not exist." + fi +else + echo "the binary is already in the expected location ($default_location). no action taken." +fi \ No newline at end of file diff --git a/gateway/debian/service b/gateway/debian/service deleted file mode 100644 index 6581fce890..0000000000 --- a/gateway/debian/service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=Nym Gateway -After=network-online.target - -[Service] -ExecStart=/usr/bin/nym-gateway run --id nym-gateway -User=nym -Environment="NYM_HOME_DIR=/etc/nym" - -[Install] -WantedBy=multi-user.target diff --git a/mixnode/debian/postinst b/mixnode/debian/postinst index cda1db59b0..5dfdd86131 100644 --- a/mixnode/debian/postinst +++ b/mixnode/debian/postinst @@ -1,6 +1,53 @@ #DEBHELPER# -useradd nym -mkdir -p /etc/nym -chown -R nym /etc/nym -su nym -c 'NYM_HOME_DIR=/etc/nym nym-mixnode init --host 0.0.0.0 --id nym-mixnode' +default_location="/usr/bin/nym-mixnode" +default_user="nym" +default_group="nym" + +existing_binary=$(sudo find / \( -path /proc -o -path /sys -o -path /dev -o -path /mnt -o -path /media \) -prune -o -type f -name nym-mixnode -print 2>/dev/null) + +if [[ -n "$existing_binary" ]] && [[ "$existing_binary" != "/usr/bin/nym-mixnode" ]]; then + echo "existing binary found at $existing_binary" + + backup_path="${existing_binary}.backup" + echo "backing up the original binary to $backup_path" + sudo cp "$existing_binary" "$backup_path" + + original_user=$(sudo stat -c "%U" "$existing_binary") + original_group=$(sudo stat -c "%G" "$existing_binary") + + echo "moving new binary from /usr/bin/nym-mixnode to $existing_binary" + sudo mv "/usr/bin/nym-mixnode" "$existing_binary" + + echo "changing ownership to $original_user:$original_group" + sudo chown "$original_user":"$original_group" "$existing_binary" + + original_perms=$(sudo stat -c "%a" "$backup_path") + echo "setting permissions to $original_perms" + sudo chmod "$original_perms" "$existing_binary" + + echo "please restart the nym-mixnode process to apply changes." + echo "sometimes the mixnode will require a re-init, but comms during releases should highlight this" + echo "usually: systemctl restart nym-mixnode.service" + +elif [[ ! -f "$default_location" ]]; then + echo "no existing binary found, performing first-time installation." + + if [[ -f "/usr/bin/nym-mixnode" ]]; then + echo "moving new binary to $default_location" + sudo mv "/usr/bin/nym-mixnode" "$default_location" + + echo "setting default ownership to $default_user:$default_group" + sudo chown "$default_user":"$default_group" "$default_location" + + echo "setting default permissions" + sudo chmod 755 "$default_location" + + echo "installation complete. please configure and start the nym-mixnode process manually." + echo "please refer to https://nymtech.net/operators/nodes/mix-node-setup.html" + else + echo "error: the new binary /usr/bin/nym-mixnode does not exist." + fi +else + echo "the binary is already in the expected location ($default_location). no action taken." +fi \ No newline at end of file diff --git a/mixnode/debian/service b/mixnode/debian/service deleted file mode 100644 index ad533b32c7..0000000000 --- a/mixnode/debian/service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=Nym Mixnode -After=network-online.target - -[Service] -ExecStart=/usr/bin/nym-mixnode run --id nym-mixnode -User=nym -Environment="NYM_HOME_DIR=/etc/nym" - -[Install] -WantedBy=multi-user.target From 85803ec11c079362cd25a0b0d746ac41344f8890 Mon Sep 17 00:00:00 2001 From: Tommy Verrall Date: Fri, 16 Feb 2024 15:25:25 +0100 Subject: [PATCH 10/22] change some of the logic --- gateway/debian/postinst | 97 ++++++++++++++++++++++------------------- mixnode/debian/postinst | 93 +++++++++++++++++++++------------------ 2 files changed, 102 insertions(+), 88 deletions(-) diff --git a/gateway/debian/postinst b/gateway/debian/postinst index 920339a36e..680b8a7d7d 100644 --- a/gateway/debian/postinst +++ b/gateway/debian/postinst @@ -1,53 +1,60 @@ -#DEBHELPER# +#!/bin/bash + +# DEBHELPER# default_location="/usr/bin/nym-gateway" default_user="nym" default_group="nym" -existing_binary=$(sudo find / \( -path /proc -o -path /sys -o -path /dev -o -path /mnt -o -path /media \) -prune -o -type f -name nym-gateway -print 2>/dev/null) +# We're assuming there's only two binaries on the machine, one is the newly installed app package version, and the second the existing binary, thus the logic below applies +existing_binaries=$(sudo find / \( -path /proc -o -path /sys -o -path /dev -o -path /mnt -o -path /media \) -prune -o -type f -name "nym-gateway" -print 2>/dev/null) +oldest_binary=$(ls -ltr $existing_binaries | head -n 1 | awk '{print $NF}') -if [[ -n "$existing_binary" ]] && [[ "$existing_binary" != "/usr/bin/nym-gateway" ]]; then - echo "existing binary found at $existing_binary" - - backup_path="${existing_binary}.backup" - echo "backing up the original binary to $backup_path" - sudo cp "$existing_binary" "$backup_path" - - original_user=$(sudo stat -c "%U" "$existing_binary") - original_group=$(sudo stat -c "%G" "$existing_binary") - - echo "moving new binary from /usr/bin/nym-gateway to $existing_binary" - sudo mv "/usr/bin/nym-gateway" "$existing_binary" - - echo "changing ownership to $original_user:$original_group" - sudo chown "$original_user":"$original_group" "$existing_binary" - - original_perms=$(sudo stat -c "%a" "$backup_path") - echo "setting permissions to $original_perms" - sudo chmod "$original_perms" "$existing_binary" - - echo "please restart the nym-gateway process to apply changes." - echo "sometimes the gateways will require a re-init, but comms during releases should highlight this" - echo "usually: systemctl restart nym-gateway.service" +if [ -n "$oldest_binary" ] && [ "$oldest_binary" != "$default_location" ]; then + echo "Existing binary found at $oldest_binary" -elif [[ ! -f "$default_location" ]]; then - echo "no existing binary found, performing first-time installation." - - if [[ -f "/usr/bin/nym-gateway" ]]; then - echo "moving new binary to $default_location" - sudo mv "/usr/bin/nym-gateway" "$default_location" - - echo "setting default ownership to $default_user:$default_group" - sudo chown "$default_user":"$default_group" "$default_location" - - echo "setting default permissions" - sudo chmod 755 "$default_location" - - echo "installation complete. please configure and start the nym-gateway process manually." - echo "please refer to https://nymtech.net/operators/nodes/gateway-setup.html" - else - echo "error: the new binary /usr/bin/nym-gateway does not exist." - fi + backup_path="${oldest_binary}.backup" + echo "Backing up the original binary to $backup_path" + sudo cp "$oldest_binary" "$backup_path" + + original_user=$(sudo stat -c "%U" "$oldest_binary") + original_group=$(sudo stat -c "%G" "$oldest_binary") + + echo "Original group: $original_group" + echo "Original user: $original_user" + + echo "Moving new binary from $default_location to $oldest_binary" + sudo mv "$default_location" "$oldest_binary" + + echo "Changing ownership to $original_user:$original_group" + sudo chown "$original_user":"$original_group" "$oldest_binary" + + original_perms=$(sudo stat -c "%a" "$backup_path") + echo "Setting permissions to $original_perms" + sudo chmod "$original_perms" "$oldest_binary" + + echo "Please restart the nym-gateway process to apply changes." + echo "Sometimes the gateways will require a re-init, but comms during releases should highlight this." + echo "Usually: systemctl restart nym-gateway.service" + +elif [ ! -f "$default_location" ]; then + echo "No existing binary found, performing first-time installation." + + if [ -f "/usr/bin/nym-gateway" ]; then + echo "Moving new binary to $default_location" + sudo mv "/usr/bin/nym-gateway" "$default_location" + + echo "Setting default ownership to $default_user:$default_group" + sudo chown "$default_user":"$default_group" "$default_location" + + echo "Setting default permissions" + sudo chmod 755 "$default_location" + + echo "Installation complete. Please configure and start the nym-gateway process manually." + echo "Please refer to https://nymtech.net/operators/nodes/gateway-setup.html" + else + echo "Error: the new binary /usr/bin/nym-gateway does not exist." + fi else - echo "the binary is already in the expected location ($default_location). no action taken." -fi \ No newline at end of file + echo "The binary is already in the expected location ($default_location). No action taken." +fi diff --git a/mixnode/debian/postinst b/mixnode/debian/postinst index 5dfdd86131..30c30b35e0 100644 --- a/mixnode/debian/postinst +++ b/mixnode/debian/postinst @@ -1,53 +1,60 @@ +#!/bin/bash + #DEBHELPER# default_location="/usr/bin/nym-mixnode" default_user="nym" default_group="nym" -existing_binary=$(sudo find / \( -path /proc -o -path /sys -o -path /dev -o -path /mnt -o -path /media \) -prune -o -type f -name nym-mixnode -print 2>/dev/null) +# We're assuming there's only two binaries on the machine, one is the newly installed app package version, and the second the existing binary, thus the logic below applies +existing_binaries=$(sudo find / \( -path /proc -o -path /sys -o -path /dev -o -path /mnt -o -path /media \) -prune -o -type f -name "nym-mixnode" -print 2>/dev/null) +oldest_binary=$(ls -ltr $existing_binaries | head -n 1 | awk '{print $NF}') -if [[ -n "$existing_binary" ]] && [[ "$existing_binary" != "/usr/bin/nym-mixnode" ]]; then - echo "existing binary found at $existing_binary" - - backup_path="${existing_binary}.backup" - echo "backing up the original binary to $backup_path" - sudo cp "$existing_binary" "$backup_path" - - original_user=$(sudo stat -c "%U" "$existing_binary") - original_group=$(sudo stat -c "%G" "$existing_binary") - - echo "moving new binary from /usr/bin/nym-mixnode to $existing_binary" - sudo mv "/usr/bin/nym-mixnode" "$existing_binary" - - echo "changing ownership to $original_user:$original_group" - sudo chown "$original_user":"$original_group" "$existing_binary" - - original_perms=$(sudo stat -c "%a" "$backup_path") - echo "setting permissions to $original_perms" - sudo chmod "$original_perms" "$existing_binary" - - echo "please restart the nym-mixnode process to apply changes." - echo "sometimes the mixnode will require a re-init, but comms during releases should highlight this" - echo "usually: systemctl restart nym-mixnode.service" +if [ -n "$oldest_binary" ] && [ "$oldest_binary" != "$default_location" ]; then + echo "Existing binary found at $oldest_binary" + + backup_path="${oldest_binary}.backup" + echo "Backing up the original binary to $backup_path" + sudo cp "$oldest_binary" "$backup_path" + + original_user=$(sudo stat -c "%U" "$oldest_binary") + original_group=$(sudo stat -c "%G" "$oldest_binary") + + echo "Original group: $original_group" + echo "Original user: $original_user" + + echo "Moving new binary from $default_location to $oldest_binary" + sudo mv "$default_location" "$oldest_binary" + + echo "Changing ownership to $original_user:$original_group" + sudo chown "$original_user":"$original_group" "$oldest_binary" + + original_perms=$(sudo stat -c "%a" "$backup_path") + echo "Setting permissions to $original_perms" + sudo chmod "$original_perms" "$oldest_binary" + + echo "Please restart the nym-mixnode process to apply changes." + echo "Sometimes the mixnode will require a re-init, but comms during releases should highlight this" + echo "Usually: systemctl restart nym-mixnode.service" elif [[ ! -f "$default_location" ]]; then - echo "no existing binary found, performing first-time installation." - - if [[ -f "/usr/bin/nym-mixnode" ]]; then - echo "moving new binary to $default_location" - sudo mv "/usr/bin/nym-mixnode" "$default_location" - - echo "setting default ownership to $default_user:$default_group" - sudo chown "$default_user":"$default_group" "$default_location" - - echo "setting default permissions" - sudo chmod 755 "$default_location" - - echo "installation complete. please configure and start the nym-mixnode process manually." - echo "please refer to https://nymtech.net/operators/nodes/mix-node-setup.html" - else - echo "error: the new binary /usr/bin/nym-mixnode does not exist." - fi + echo "no existing binary found, performing first-time installation." + + if [[ -f "/usr/bin/nym-mixnode" ]]; then + echo "Moving new binary to $default_location" + sudo mv "/usr/bin/nym-mixnode" "$default_location" + + echo "Setting default ownership to $default_user:$default_group" + sudo chown "$default_user":"$default_group" "$default_location" + + echo "Setting default permissions" + sudo chmod 755 "$default_location" + + echo "Installation complete. please configure and start the nym-mixnode process manually." + echo "Please refer to https://nymtech.net/operators/nodes/mix-node-setup.html" + else + echo "Error: the new binary /usr/bin/nym-mixnode does not exist." + fi else - echo "the binary is already in the expected location ($default_location). no action taken." -fi \ No newline at end of file + echo "The binary is already in the expected location ($default_location). No action taken." +fi From 721ad9d8bb7e8a78e3afc752f19988dc3c4abe4c Mon Sep 17 00:00:00 2001 From: Tommy Verrall Date: Fri, 16 Feb 2024 15:55:43 +0100 Subject: [PATCH 11/22] remove helper --- gateway/debian/postinst | 2 -- mixnode/debian/postinst | 2 -- 2 files changed, 4 deletions(-) diff --git a/gateway/debian/postinst b/gateway/debian/postinst index 680b8a7d7d..0491ef90ac 100644 --- a/gateway/debian/postinst +++ b/gateway/debian/postinst @@ -1,7 +1,5 @@ #!/bin/bash -# DEBHELPER# - default_location="/usr/bin/nym-gateway" default_user="nym" default_group="nym" diff --git a/mixnode/debian/postinst b/mixnode/debian/postinst index 30c30b35e0..e51964b923 100644 --- a/mixnode/debian/postinst +++ b/mixnode/debian/postinst @@ -1,7 +1,5 @@ #!/bin/bash -#DEBHELPER# - default_location="/usr/bin/nym-mixnode" default_user="nym" default_group="nym" From 3010d5192f47e36e86285c8320270172e5874c1f Mon Sep 17 00:00:00 2001 From: Tommy Verrall Date: Fri, 16 Feb 2024 16:00:18 +0100 Subject: [PATCH 12/22] add helper --- gateway/debian/postinst | 2 ++ mixnode/debian/postinst | 2 ++ 2 files changed, 4 insertions(+) diff --git a/gateway/debian/postinst b/gateway/debian/postinst index 0491ef90ac..4695111f9e 100644 --- a/gateway/debian/postinst +++ b/gateway/debian/postinst @@ -56,3 +56,5 @@ elif [ ! -f "$default_location" ]; then else echo "The binary is already in the expected location ($default_location). No action taken." fi + +#DEBHELPER# \ No newline at end of file diff --git a/mixnode/debian/postinst b/mixnode/debian/postinst index e51964b923..edc500b80c 100644 --- a/mixnode/debian/postinst +++ b/mixnode/debian/postinst @@ -56,3 +56,5 @@ elif [[ ! -f "$default_location" ]]; then else echo "The binary is already in the expected location ($default_location). No action taken." fi + +#DEBHELPER# \ No newline at end of file From 52c46f371eb8d428d6d50929cceb88e7fc0fa700 Mon Sep 17 00:00:00 2001 From: Tommy Verrall Date: Fri, 16 Feb 2024 16:18:11 +0100 Subject: [PATCH 13/22] shell --- gateway/debian/postinst | 4 ++-- mixnode/debian/postinst | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gateway/debian/postinst b/gateway/debian/postinst index 4695111f9e..b9a06fb46a 100644 --- a/gateway/debian/postinst +++ b/gateway/debian/postinst @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh default_location="/usr/bin/nym-gateway" default_user="nym" @@ -11,7 +11,7 @@ oldest_binary=$(ls -ltr $existing_binaries | head -n 1 | awk '{print $NF}') if [ -n "$oldest_binary" ] && [ "$oldest_binary" != "$default_location" ]; then echo "Existing binary found at $oldest_binary" - backup_path="${oldest_binary}.backup" + backup_path="${oldest_binary}.backup.$(date +%Y-%m-%dT%H:%M:%S%z)" echo "Backing up the original binary to $backup_path" sudo cp "$oldest_binary" "$backup_path" diff --git a/mixnode/debian/postinst b/mixnode/debian/postinst index edc500b80c..76206e93dc 100644 --- a/mixnode/debian/postinst +++ b/mixnode/debian/postinst @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh default_location="/usr/bin/nym-mixnode" default_user="nym" From 8e16678f744677617e803d54815a7350c86fb111 Mon Sep 17 00:00:00 2001 From: Tommy Verrall Date: Fri, 16 Feb 2024 16:39:01 +0100 Subject: [PATCH 14/22] fix syntax --- gateway/debian/postinst | 18 +++++++++--------- mixnode/debian/postinst | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) mode change 100644 => 100755 gateway/debian/postinst diff --git a/gateway/debian/postinst b/gateway/debian/postinst old mode 100644 new mode 100755 index b9a06fb46a..a0674bebc2 --- a/gateway/debian/postinst +++ b/gateway/debian/postinst @@ -15,21 +15,21 @@ if [ -n "$oldest_binary" ] && [ "$oldest_binary" != "$default_location" ]; then echo "Backing up the original binary to $backup_path" sudo cp "$oldest_binary" "$backup_path" - original_user=$(sudo stat -c "%U" "$oldest_binary") - original_group=$(sudo stat -c "%G" "$oldest_binary") + original_user=$(stat -c "%U" "$oldest_binary") + original_group=$(stat -c "%G" "$oldest_binary") echo "Original group: $original_group" echo "Original user: $original_user" echo "Moving new binary from $default_location to $oldest_binary" - sudo mv "$default_location" "$oldest_binary" + mv "$default_location" "$oldest_binary" echo "Changing ownership to $original_user:$original_group" - sudo chown "$original_user":"$original_group" "$oldest_binary" + chown "$original_user:$original_group" "$oldest_binary" - original_perms=$(sudo stat -c "%a" "$backup_path") + original_perms=$(stat -c "%a" "$backup_path") echo "Setting permissions to $original_perms" - sudo chmod "$original_perms" "$oldest_binary" + chmod "$original_perms" "$oldest_binary" echo "Please restart the nym-gateway process to apply changes." echo "Sometimes the gateways will require a re-init, but comms during releases should highlight this." @@ -40,13 +40,13 @@ elif [ ! -f "$default_location" ]; then if [ -f "/usr/bin/nym-gateway" ]; then echo "Moving new binary to $default_location" - sudo mv "/usr/bin/nym-gateway" "$default_location" + mv "/usr/bin/nym-gateway" "$default_location" echo "Setting default ownership to $default_user:$default_group" - sudo chown "$default_user":"$default_group" "$default_location" + chown "$default_user:$default_group" "$default_location" echo "Setting default permissions" - sudo chmod 755 "$default_location" + chmod 755 "$default_location" echo "Installation complete. Please configure and start the nym-gateway process manually." echo "Please refer to https://nymtech.net/operators/nodes/gateway-setup.html" diff --git a/mixnode/debian/postinst b/mixnode/debian/postinst index 76206e93dc..ba1b7788cf 100644 --- a/mixnode/debian/postinst +++ b/mixnode/debian/postinst @@ -35,7 +35,7 @@ if [ -n "$oldest_binary" ] && [ "$oldest_binary" != "$default_location" ]; then echo "Sometimes the mixnode will require a re-init, but comms during releases should highlight this" echo "Usually: systemctl restart nym-mixnode.service" -elif [[ ! -f "$default_location" ]]; then +elif [ ! -f "$default_location" ]; then echo "no existing binary found, performing first-time installation." if [[ -f "/usr/bin/nym-mixnode" ]]; then From 49c43617c9c2f36bc05ac9b635701da9dcbbd0bb Mon Sep 17 00:00:00 2001 From: Tommy Verrall Date: Mon, 19 Feb 2024 13:41:38 +0100 Subject: [PATCH 15/22] include a pretty print of the service file here --- gateway/debian/postinst | 20 +++++++++++++++++--- mixnode/debian/postinst | 22 ++++++++++++++++++---- 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/gateway/debian/postinst b/gateway/debian/postinst index a0674bebc2..7d80cf80bd 100755 --- a/gateway/debian/postinst +++ b/gateway/debian/postinst @@ -11,7 +11,7 @@ oldest_binary=$(ls -ltr $existing_binaries | head -n 1 | awk '{print $NF}') if [ -n "$oldest_binary" ] && [ "$oldest_binary" != "$default_location" ]; then echo "Existing binary found at $oldest_binary" - backup_path="${oldest_binary}.backup.$(date +%Y-%m-%dT%H:%M:%S%z)" + backup_path="${oldest_binary}.backup.$(date +%Y-%m-%dT%H:%M:%S)" echo "Backing up the original binary to $backup_path" sudo cp "$oldest_binary" "$backup_path" @@ -33,7 +33,7 @@ if [ -n "$oldest_binary" ] && [ "$oldest_binary" != "$default_location" ]; then echo "Please restart the nym-gateway process to apply changes." echo "Sometimes the gateways will require a re-init, but comms during releases should highlight this." - echo "Usually: systemctl restart nym-gateway.service" + echo "Now if you're running via systemd service file: systemctl restart nym-gateway.service" elif [ ! -f "$default_location" ]; then echo "No existing binary found, performing first-time installation." @@ -50,6 +50,20 @@ elif [ ! -f "$default_location" ]; then echo "Installation complete. Please configure and start the nym-gateway process manually." echo "Please refer to https://nymtech.net/operators/nodes/gateway-setup.html" + echo "An example running the Gateway via a service file:" + cat <<'EOF' +[Unit] +Description=Nym Gateway +After=network-online.target + +[Service] +ExecStart=/usr/bin/nym-gateway run --id nym-gateway +User=nym +Environment="NYM_HOME_DIR=/etc/nym" + +[Install] +WantedBy=multi-user.target +EOF else echo "Error: the new binary /usr/bin/nym-gateway does not exist." fi @@ -57,4 +71,4 @@ else echo "The binary is already in the expected location ($default_location). No action taken." fi -#DEBHELPER# \ No newline at end of file +#DEBHELPER# diff --git a/mixnode/debian/postinst b/mixnode/debian/postinst index ba1b7788cf..97177febc3 100644 --- a/mixnode/debian/postinst +++ b/mixnode/debian/postinst @@ -11,7 +11,7 @@ oldest_binary=$(ls -ltr $existing_binaries | head -n 1 | awk '{print $NF}') if [ -n "$oldest_binary" ] && [ "$oldest_binary" != "$default_location" ]; then echo "Existing binary found at $oldest_binary" - backup_path="${oldest_binary}.backup" + backup_path="${oldest_binary}.backup.$(date +%Y-%m-%dT%H:%M:%S)" echo "Backing up the original binary to $backup_path" sudo cp "$oldest_binary" "$backup_path" @@ -33,12 +33,12 @@ if [ -n "$oldest_binary" ] && [ "$oldest_binary" != "$default_location" ]; then echo "Please restart the nym-mixnode process to apply changes." echo "Sometimes the mixnode will require a re-init, but comms during releases should highlight this" - echo "Usually: systemctl restart nym-mixnode.service" + echo "If you're running via a service file: systemctl restart nym-gateway.service" elif [ ! -f "$default_location" ]; then echo "no existing binary found, performing first-time installation." - if [[ -f "/usr/bin/nym-mixnode" ]]; then + if [ -f "/usr/bin/nym-mixnode" ]; then echo "Moving new binary to $default_location" sudo mv "/usr/bin/nym-mixnode" "$default_location" @@ -50,6 +50,20 @@ elif [ ! -f "$default_location" ]; then echo "Installation complete. please configure and start the nym-mixnode process manually." echo "Please refer to https://nymtech.net/operators/nodes/mix-node-setup.html" + echo "An example running the Mixnode via a service file:" + cat <<'EOF' +[Unit] +Description=Nym Mixnode +After=network-online.target + +[Service] +ExecStart=/usr/bin/nym-mixnode run --id nym-mixnode +User=nym +Environment="NYM_HOME_DIR=/etc/nym" + +[Install] +WantedBy=multi-user.target +EOF else echo "Error: the new binary /usr/bin/nym-mixnode does not exist." fi @@ -57,4 +71,4 @@ else echo "The binary is already in the expected location ($default_location). No action taken." fi -#DEBHELPER# \ No newline at end of file +#DEBHELPER# From 1cfddb942b5a9d9a94e729ae09ee03e171e961cf Mon Sep 17 00:00:00 2001 From: Tommy Verrall Date: Mon, 19 Feb 2024 13:43:56 +0100 Subject: [PATCH 16/22] remove line --- gateway/debian/postinst | 3 +-- mixnode/debian/postinst | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/gateway/debian/postinst b/gateway/debian/postinst index 7d80cf80bd..6b6857565d 100755 --- a/gateway/debian/postinst +++ b/gateway/debian/postinst @@ -33,7 +33,7 @@ if [ -n "$oldest_binary" ] && [ "$oldest_binary" != "$default_location" ]; then echo "Please restart the nym-gateway process to apply changes." echo "Sometimes the gateways will require a re-init, but comms during releases should highlight this." - echo "Now if you're running via systemd service file: systemctl restart nym-gateway.service" + echo "If you're running via a service file: systemctl restart nym-gateway.service" elif [ ! -f "$default_location" ]; then echo "No existing binary found, performing first-time installation." @@ -59,7 +59,6 @@ After=network-online.target [Service] ExecStart=/usr/bin/nym-gateway run --id nym-gateway User=nym -Environment="NYM_HOME_DIR=/etc/nym" [Install] WantedBy=multi-user.target diff --git a/mixnode/debian/postinst b/mixnode/debian/postinst index 97177febc3..9e8a28a7cc 100644 --- a/mixnode/debian/postinst +++ b/mixnode/debian/postinst @@ -59,7 +59,6 @@ After=network-online.target [Service] ExecStart=/usr/bin/nym-mixnode run --id nym-mixnode User=nym -Environment="NYM_HOME_DIR=/etc/nym" [Install] WantedBy=multi-user.target From 49e2be5b042d12dd3f38e7bed959f626829d89b5 Mon Sep 17 00:00:00 2001 From: Tommy Verrall Date: Mon, 19 Feb 2024 14:37:35 +0100 Subject: [PATCH 17/22] a condition was not being met for new installs therefore, input a preinst script too to back up --- gateway/debian/postinst | 84 +++++++++++++++++---------------------- gateway/debian/preinst | 24 +++++++++++ mixnode/debian/postinst | 88 ++++++++++++++++++----------------------- mixnode/debian/preinst | 24 +++++++++++ 4 files changed, 122 insertions(+), 98 deletions(-) create mode 100644 gateway/debian/preinst create mode 100644 mixnode/debian/preinst diff --git a/gateway/debian/postinst b/gateway/debian/postinst index 6b6857565d..e23083e794 100755 --- a/gateway/debian/postinst +++ b/gateway/debian/postinst @@ -4,70 +4,58 @@ default_location="/usr/bin/nym-gateway" default_user="nym" default_group="nym" -# We're assuming there's only two binaries on the machine, one is the newly installed app package version, and the second the existing binary, thus the logic below applies -existing_binaries=$(sudo find / \( -path /proc -o -path /sys -o -path /dev -o -path /mnt -o -path /media \) -prune -o -type f -name "nym-gateway" -print 2>/dev/null) -oldest_binary=$(ls -ltr $existing_binaries | head -n 1 | awk '{print $NF}') +if [ -f "/tmp/nym_gateway_preinst_marker" ]; then + backup_path=$(cat /tmp/nym_gateway_preinst_marker) + echo "Upgrade detected. Previous version backed up at $backup_path" + + existing_location=$(dirname "$backup_path" | sed 's/\.backup\..*//') + echo "Existing location: ${existing_location}" + + if [ "$existing_location" != "$default_location" ]; then + echo "Custom installation location detected: $existing_location" + + mv "$default_location" "$existing_location/nym-gateway" + + original_user=$(stat -c "%U" "$backup_path") + original_group=$(stat -c "%G" "$backup_path") + original_perms=$(stat -c "%a" "$backup_path") + + chown "$original_user:$original_group" "$existing_location/nym-gateway" + chmod "$original_perms" "$existing_location/nym-gateway" + fi -if [ -n "$oldest_binary" ] && [ "$oldest_binary" != "$default_location" ]; then - echo "Existing binary found at $oldest_binary" + rm -f /tmp/nym_gateway_preinst_marker +else + echo "Fresh installation detected." - backup_path="${oldest_binary}.backup.$(date +%Y-%m-%dT%H:%M:%S)" - echo "Backing up the original binary to $backup_path" - sudo cp "$oldest_binary" "$backup_path" - - original_user=$(stat -c "%U" "$oldest_binary") - original_group=$(stat -c "%G" "$oldest_binary") - - echo "Original group: $original_group" - echo "Original user: $original_user" - - echo "Moving new binary from $default_location to $oldest_binary" - mv "$default_location" "$oldest_binary" - - echo "Changing ownership to $original_user:$original_group" - chown "$original_user:$original_group" "$oldest_binary" - - original_perms=$(stat -c "%a" "$backup_path") - echo "Setting permissions to $original_perms" - chmod "$original_perms" "$oldest_binary" - - echo "Please restart the nym-gateway process to apply changes." - echo "Sometimes the gateways will require a re-init, but comms during releases should highlight this." - echo "If you're running via a service file: systemctl restart nym-gateway.service" - -elif [ ! -f "$default_location" ]; then - echo "No existing binary found, performing first-time installation." - - if [ -f "/usr/bin/nym-gateway" ]; then - echo "Moving new binary to $default_location" - mv "/usr/bin/nym-gateway" "$default_location" - - echo "Setting default ownership to $default_user:$default_group" + if [ -f "$default_location" ]; then chown "$default_user:$default_group" "$default_location" - - echo "Setting default permissions" chmod 755 "$default_location" echo "Installation complete. Please configure and start the nym-gateway process manually." - echo "Please refer to https://nymtech.net/operators/nodes/gateway-setup.html" - echo "An example running the Gateway via a service file:" - cat <<'EOF' + echo "Refer to https://nymtech.net/operators/nodes/gateway-setup.html" + echo "Example for setting up the nym-gateway service:" + + cat </dev/null) + +if [ -n "$existing_binaries" ]; then + echo "Existing installation(s) detected. Preparing for upgrade." + + for binary_path in $existing_binaries; do + backup_path="$backup_dir/$(basename $binary_path).backup.$(date +%Y-%m-%dT%H:%M:%S)" + cp "$binary_path" "$backup_path" + + echo "Backed up existing binary from $binary_path to $backup_path" + done + + oldest_binary=$(echo "$existing_binaries" | head -n 1) + echo "$oldest_binary" > /tmp/nym_gateway_preinst_marker +else + echo "No existing nym-gateway installation detected. Proceeding with fresh installation." +fi + +exit 0 \ No newline at end of file diff --git a/mixnode/debian/postinst b/mixnode/debian/postinst index 9e8a28a7cc..f7db085852 100644 --- a/mixnode/debian/postinst +++ b/mixnode/debian/postinst @@ -4,70 +4,58 @@ default_location="/usr/bin/nym-mixnode" default_user="nym" default_group="nym" -# We're assuming there's only two binaries on the machine, one is the newly installed app package version, and the second the existing binary, thus the logic below applies -existing_binaries=$(sudo find / \( -path /proc -o -path /sys -o -path /dev -o -path /mnt -o -path /media \) -prune -o -type f -name "nym-mixnode" -print 2>/dev/null) -oldest_binary=$(ls -ltr $existing_binaries | head -n 1 | awk '{print $NF}') +if [ -f "/tmp/nym_mixnode_preinst_marker" ]; then + backup_path=$(cat /tmp/nym_mixnode_preinst_marker) + echo "Upgrade detected. Previous version backed up at $backup_path" + + existing_location=$(dirname "$backup_path" | sed 's/\.backup\..*//') + echo "Existing location: ${existing_location}" + + if [ "$existing_location" != "$default_location" ]; then + echo "Custom installation location detected: $existing_location" + + mv "$default_location" "$existing_location/nym-mixnode" + + original_user=$(stat -c "%U" "$backup_path") + original_group=$(stat -c "%G" "$backup_path") + original_perms=$(stat -c "%a" "$backup_path") + + chown "$original_user:$original_group" "$existing_location/nym-mixnode" + chmod "$original_perms" "$existing_location/nym-mixnode" + fi -if [ -n "$oldest_binary" ] && [ "$oldest_binary" != "$default_location" ]; then - echo "Existing binary found at $oldest_binary" + rm -f /tmp/nym_mixnode_preinst_marker +else + echo "Fresh installation detected." - backup_path="${oldest_binary}.backup.$(date +%Y-%m-%dT%H:%M:%S)" - echo "Backing up the original binary to $backup_path" - sudo cp "$oldest_binary" "$backup_path" + if [ -f "$default_location" ]; then + chown "$default_user:$default_group" "$default_location" + chmod 755 "$default_location" - original_user=$(sudo stat -c "%U" "$oldest_binary") - original_group=$(sudo stat -c "%G" "$oldest_binary") + echo "Installation complete. Please configure and start the nym-mixnode process manually." + echo "Refer to https://nymtech.net/operators/nodes/mixnode-setup.html" + echo "Example for setting up the nym-mixnode service:" - echo "Original group: $original_group" - echo "Original user: $original_user" - - echo "Moving new binary from $default_location to $oldest_binary" - sudo mv "$default_location" "$oldest_binary" - - echo "Changing ownership to $original_user:$original_group" - sudo chown "$original_user":"$original_group" "$oldest_binary" - - original_perms=$(sudo stat -c "%a" "$backup_path") - echo "Setting permissions to $original_perms" - sudo chmod "$original_perms" "$oldest_binary" - - echo "Please restart the nym-mixnode process to apply changes." - echo "Sometimes the mixnode will require a re-init, but comms during releases should highlight this" - echo "If you're running via a service file: systemctl restart nym-gateway.service" - -elif [ ! -f "$default_location" ]; then - echo "no existing binary found, performing first-time installation." - - if [ -f "/usr/bin/nym-mixnode" ]; then - echo "Moving new binary to $default_location" - sudo mv "/usr/bin/nym-mixnode" "$default_location" - - echo "Setting default ownership to $default_user:$default_group" - sudo chown "$default_user":"$default_group" "$default_location" - - echo "Setting default permissions" - sudo chmod 755 "$default_location" - - echo "Installation complete. please configure and start the nym-mixnode process manually." - echo "Please refer to https://nymtech.net/operators/nodes/mix-node-setup.html" - echo "An example running the Mixnode via a service file:" - cat <<'EOF' + cat </dev/null) + +if [ -n "$existing_binaries" ]; then + echo "Existing installation(s) detected. Preparing for upgrade." + + for binary_path in $existing_binaries; do + backup_path="$backup_dir/$(basename $binary_path).backup.$(date +%Y-%m-%dT%H:%M:%S)" + cp "$binary_path" "$backup_path" + + echo "Backed up existing binary from $binary_path to $backup_path" + done + + oldest_binary=$(echo "$existing_binaries" | head -n 1) + echo "$oldest_binary" > /tmp/nym_mixnode_preinst_marker +else + echo "No existing nym-mixnode installation detected. Proceeding with fresh installation." +fi + +exit 0 \ No newline at end of file From d6afa7428499e85ac57a77cf4d918bf469aa9583 Mon Sep 17 00:00:00 2001 From: Tommy Verrall Date: Mon, 19 Feb 2024 14:40:14 +0100 Subject: [PATCH 18/22] debhelper --- gateway/debian/preinst | 4 +++- mixnode/debian/preinst | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/gateway/debian/preinst b/gateway/debian/preinst index 32ebe1ebd2..83fdb8fe1d 100644 --- a/gateway/debian/preinst +++ b/gateway/debian/preinst @@ -21,4 +21,6 @@ else echo "No existing nym-gateway installation detected. Proceeding with fresh installation." fi -exit 0 \ No newline at end of file +exit 0 + +#DEBHELPER# diff --git a/mixnode/debian/preinst b/mixnode/debian/preinst index 8c6666f5a1..49adf297c9 100644 --- a/mixnode/debian/preinst +++ b/mixnode/debian/preinst @@ -21,4 +21,6 @@ else echo "No existing nym-mixnode installation detected. Proceeding with fresh installation." fi -exit 0 \ No newline at end of file +exit 0 + +#DEBHELPER# From 66a54aeab3843791d22c8f490dfebc6574baf214 Mon Sep 17 00:00:00 2001 From: Tommy Verrall Date: Mon, 19 Feb 2024 14:51:23 +0100 Subject: [PATCH 19/22] small formatting --- gateway/debian/postinst | 15 ++++++++------- mixnode/debian/postinst | 12 +++++++----- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/gateway/debian/postinst b/gateway/debian/postinst index e23083e794..a02816a596 100755 --- a/gateway/debian/postinst +++ b/gateway/debian/postinst @@ -7,19 +7,19 @@ default_group="nym" if [ -f "/tmp/nym_gateway_preinst_marker" ]; then backup_path=$(cat /tmp/nym_gateway_preinst_marker) echo "Upgrade detected. Previous version backed up at $backup_path" - + existing_location=$(dirname "$backup_path" | sed 's/\.backup\..*//') echo "Existing location: ${existing_location}" - + if [ "$existing_location" != "$default_location" ]; then echo "Custom installation location detected: $existing_location" - + mv "$default_location" "$existing_location/nym-gateway" - + original_user=$(stat -c "%U" "$backup_path") original_group=$(stat -c "%G" "$backup_path") original_perms=$(stat -c "%a" "$backup_path") - + chown "$original_user:$original_group" "$existing_location/nym-gateway" chmod "$original_perms" "$existing_location/nym-gateway" fi @@ -35,7 +35,7 @@ else echo "Installation complete. Please configure and start the nym-gateway process manually." echo "Refer to https://nymtech.net/operators/nodes/gateway-setup.html" echo "Example for setting up the nym-gateway service:" - + echo cat < Date: Tue, 20 Feb 2024 09:26:00 +0100 Subject: [PATCH 20/22] one last tweak --- gateway/debian/postinst | 3 ++- mixnode/debian/postinst | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/gateway/debian/postinst b/gateway/debian/postinst index a02816a596..a6b058a689 100755 --- a/gateway/debian/postinst +++ b/gateway/debian/postinst @@ -29,7 +29,8 @@ else echo "Fresh installation detected." if [ -f "$default_location" ]; then - chown "$default_user:$default_group" "$default_location" + # Leave the binary as the user to perform the apt install + # It's down to the user to specify the correct ownership and permissions chmod 755 "$default_location" echo "Installation complete. Please configure and start the nym-gateway process manually." diff --git a/mixnode/debian/postinst b/mixnode/debian/postinst index 8d5aabdf8a..14b893a2f7 100644 --- a/mixnode/debian/postinst +++ b/mixnode/debian/postinst @@ -29,7 +29,9 @@ else echo "Fresh installation detected." if [ -f "$default_location" ]; then - chown "$default_user:$default_group" "$default_location" + # Leave the binary as the user to perform the apt install + # It's down to the user to specify the correct ownership and permissions + chmod 755 "$default_location" chmod 755 "$default_location" echo "Installation complete. Please configure and start the nym-mixnode process manually." From 87ea3fcfc483f5bd7a46bd1279275ff0325d81d6 Mon Sep 17 00:00:00 2001 From: Tommy Verrall Date: Tue, 20 Feb 2024 09:29:26 +0100 Subject: [PATCH 21/22] remove extra line --- mixnode/debian/postinst | 1 - 1 file changed, 1 deletion(-) diff --git a/mixnode/debian/postinst b/mixnode/debian/postinst index 14b893a2f7..7c672de34b 100644 --- a/mixnode/debian/postinst +++ b/mixnode/debian/postinst @@ -32,7 +32,6 @@ else # Leave the binary as the user to perform the apt install # It's down to the user to specify the correct ownership and permissions chmod 755 "$default_location" - chmod 755 "$default_location" echo "Installation complete. Please configure and start the nym-mixnode process manually." echo "Refer to https://nymtech.net/operators/nodes/mixnode-setup.html" From 0efd7a231806f9f5a1b222868a711b2938584b4b Mon Sep 17 00:00:00 2001 From: Tommy Verrall Date: Tue, 20 Feb 2024 17:45:23 +0100 Subject: [PATCH 22/22] make check on conflicts --- Cargo.lock | 18 +++++++-------- nym-connect/desktop/Cargo.lock | 40 +++++++++++++++++++++------------- nym-wallet/Cargo.lock | 2 +- 3 files changed, 35 insertions(+), 25 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 813f304de4..70ea613374 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2864,7 +2864,7 @@ checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" [[package]] name = "explorer-api" -version = "1.1.32" +version = "1.1.33" dependencies = [ "chrono", "clap 4.4.7", @@ -5764,7 +5764,7 @@ dependencies = [ [[package]] name = "nym-api" -version = "1.1.34" +version = "1.1.35" dependencies = [ "actix-web", "anyhow", @@ -5922,7 +5922,7 @@ dependencies = [ [[package]] name = "nym-cli" -version = "1.1.33" +version = "1.1.34" dependencies = [ "anyhow", "base64 0.13.1", @@ -5998,7 +5998,7 @@ dependencies = [ [[package]] name = "nym-client" -version = "1.1.32" +version = "1.1.33" dependencies = [ "clap 4.4.7", "dirs 4.0.0", @@ -6347,7 +6347,7 @@ dependencies = [ [[package]] name = "nym-gateway" -version = "1.1.32" +version = "1.1.33" dependencies = [ "anyhow", "async-trait", @@ -6567,7 +6567,7 @@ dependencies = [ [[package]] name = "nym-mixnode" -version = "1.1.34" +version = "1.1.35" dependencies = [ "anyhow", "axum", @@ -6687,7 +6687,7 @@ dependencies = [ [[package]] name = "nym-network-requester" -version = "1.1.32" +version = "1.1.33" dependencies = [ "addr", "anyhow", @@ -6736,7 +6736,7 @@ dependencies = [ [[package]] name = "nym-network-statistics" -version = "1.1.32" +version = "1.1.33" dependencies = [ "dirs 4.0.0", "log", @@ -6981,7 +6981,7 @@ dependencies = [ [[package]] name = "nym-socks5-client" -version = "1.1.32" +version = "1.1.33" dependencies = [ "clap 4.4.7", "lazy_static", diff --git a/nym-connect/desktop/Cargo.lock b/nym-connect/desktop/Cargo.lock index d1249c0e25..c284610844 100644 --- a/nym-connect/desktop/Cargo.lock +++ b/nym-connect/desktop/Cargo.lock @@ -958,6 +958,12 @@ version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28c122c3980598d243d63d9a704629a2d748d101f278052ff068be5a4423ab6f" +[[package]] +name = "const-str" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aca749d3d3f5b87a0d6100509879f9cf486ab510803a4a4e1001da1ff61c2bd6" + [[package]] name = "constant_time_eq" version = "0.3.0" @@ -3722,6 +3728,7 @@ dependencies = [ "clap", "clap_complete", "clap_complete_fig", + "const-str", "log", "pretty_env_logger", "schemars", @@ -3762,6 +3769,7 @@ dependencies = [ "serde", "serde_json", "sha2 0.10.8", + "si-scale", "sqlx", "tap", "thiserror", @@ -4138,6 +4146,7 @@ dependencies = [ "cfg-if", "dotenvy", "hex-literal", + "log", "once_cell", "schemars", "serde", @@ -4504,7 +4513,6 @@ dependencies = [ "nym-network-defaults", "nym-service-provider-directory-common", "nym-vesting-contract-common", - "openssl", "prost", "reqwest", "serde", @@ -4651,15 +4659,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" -[[package]] -name = "openssl-src" -version = "111.27.0+1.1.1v" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06e8f197c82d7511c5b014030c9b1efeda40d7d5f99d23b4ceed3524a5e63f02" -dependencies = [ - "cc", -] - [[package]] name = "openssl-sys" version = "0.9.91" @@ -4668,7 +4667,6 @@ checksum = "866b5f16f90776b9bb8dc1e1802ac6f0513de3a7a7465867bfbc563dc737faac" dependencies = [ "cc", "libc", - "openssl-src", "pkg-config", "vcpkg", ] @@ -5509,6 +5507,7 @@ dependencies = [ "wasm-bindgen-futures", "wasm-streams", "web-sys", + "webpki-roots 0.25.4", "winreg 0.50.0", ] @@ -6221,6 +6220,12 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "si-scale" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44beb68bf488343b13ddbd74d1d5d5e6559a58b6dfaee74eb8d5ed4f7ed7666f" + [[package]] name = "signal-hook" version = "0.3.17" @@ -6458,7 +6463,7 @@ dependencies = [ "thiserror", "tokio-stream", "url", - "webpki-roots", + "webpki-roots 0.22.6", ] [[package]] @@ -7247,9 +7252,8 @@ checksum = "212d5dcb2a1ce06d81107c3d0ffa3121fe974b73f068c8282cb1c32328113b6c" dependencies = [ "futures-util", "log", - "native-tls", + "rustls 0.21.7", "tokio", - "tokio-native-tls", "tungstenite", ] @@ -7429,8 +7433,8 @@ dependencies = [ "http", "httparse", "log", - "native-tls", "rand 0.8.5", + "rustls 0.21.7", "sha1", "thiserror", "url", @@ -7874,6 +7878,12 @@ dependencies = [ "webpki", ] +[[package]] +name = "webpki-roots" +version = "0.25.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" + [[package]] name = "webview2-com" version = "0.19.1" diff --git a/nym-wallet/Cargo.lock b/nym-wallet/Cargo.lock index a197456fb9..89ce80a746 100644 --- a/nym-wallet/Cargo.lock +++ b/nym-wallet/Cargo.lock @@ -3528,7 +3528,7 @@ dependencies = [ [[package]] name = "nym_wallet" -version = "1.2.11" +version = "1.2.12" dependencies = [ "async-trait", "base64 0.13.1",