diff --git a/Cargo.lock b/Cargo.lock index 2781e43..eee7009 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -934,12 +934,6 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" -[[package]] -name = "hex-literal" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" - [[package]] name = "hkdf" version = "0.12.3" @@ -2357,12 +2351,12 @@ dependencies = [ "clap", "flate2", "hex", - "hex-literal", "reqwest", "serde", "sha2", "tar", "tempfile", + "trifid-pki", ] [[package]] @@ -2671,7 +2665,7 @@ dependencies = [ [[package]] name = "trifid-pki" -version = "0.1.4" +version = "0.1.5" dependencies = [ "ed25519-dalek", "hex", diff --git a/tfclient/Cargo.toml b/tfclient/Cargo.toml index be9c617..3291b5f 100644 --- a/tfclient/Cargo.toml +++ b/tfclient/Cargo.toml @@ -8,7 +8,7 @@ description = "An open-source reimplementation of a Defined Networking-compatibl [dependencies] clap = { version = "4.1.10", features = ["derive"] } -hex-literal = "0.3.4" +trifid-pki = { version = "0.1.5", path = "../trifid-pki" } [build-dependencies] serde = { version = "1.0.157", features = ["derive"] } diff --git a/tfclient/build.rs b/tfclient/build.rs index beeb87d..b1138e6 100644 --- a/tfclient/build.rs +++ b/tfclient/build.rs @@ -1,83 +1,3 @@ -/* -[ - { - "url": "https://api.github.com/repos/octocat/Hello-World/releases/1", - "html_url": "https://github.com/octocat/Hello-World/releases/v1.0.0", - "assets_url": "https://api.github.com/repos/octocat/Hello-World/releases/1/assets", - "upload_url": "https://uploads.github.com/repos/octocat/Hello-World/releases/1/assets{?name,label}", - "tarball_url": "https://api.github.com/repos/octocat/Hello-World/tarball/v1.0.0", - "zipball_url": "https://api.github.com/repos/octocat/Hello-World/zipball/v1.0.0", - "id": 1, - "node_id": "MDc6UmVsZWFzZTE=", - "tag_name": "v1.0.0", - "target_commitish": "master", - "name": "v1.0.0", - "body": "Description of the release", - "draft": false, - "prerelease": false, - "created_at": "2013-02-27T19:35:32Z", - "published_at": "2013-02-27T19:35:32Z", - "author": { - "login": "octocat", - "id": 1, - "node_id": "MDQ6VXNlcjE=", - "avatar_url": "https://github.com/images/error/octocat_happy.gif", - "gravatar_id": "", - "url": "https://api.github.com/users/octocat", - "html_url": "https://github.com/octocat", - "followers_url": "https://api.github.com/users/octocat/followers", - "following_url": "https://api.github.com/users/octocat/following{/other_user}", - "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", - "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", - "organizations_url": "https://api.github.com/users/octocat/orgs", - "repos_url": "https://api.github.com/users/octocat/repos", - "events_url": "https://api.github.com/users/octocat/events{/privacy}", - "received_events_url": "https://api.github.com/users/octocat/received_events", - "type": "User", - "site_admin": false - }, - "assets": [ - { - "url": "https://api.github.com/repos/octocat/Hello-World/releases/assets/1", - "browser_download_url": "https://github.com/octocat/Hello-World/releases/download/v1.0.0/example.zip", - "id": 1, - "node_id": "MDEyOlJlbGVhc2VBc3NldDE=", - "name": "example.zip", - "label": "short description", - "state": "uploaded", - "content_type": "application/zip", - "size": 1024, - "download_count": 42, - "created_at": "2013-02-27T19:35:32Z", - "updated_at": "2013-02-27T19:35:32Z", - "uploader": { - "login": "octocat", - "id": 1, - "node_id": "MDQ6VXNlcjE=", - "avatar_url": "https://github.com/images/error/octocat_happy.gif", - "gravatar_id": "", - "url": "https://api.github.com/users/octocat", - "html_url": "https://github.com/octocat", - "followers_url": "https://api.github.com/users/octocat/followers", - "following_url": "https://api.github.com/users/octocat/following{/other_user}", - "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", - "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", - "organizations_url": "https://api.github.com/users/octocat/orgs", - "repos_url": "https://api.github.com/users/octocat/repos", - "events_url": "https://api.github.com/users/octocat/events{/privacy}", - "received_events_url": "https://api.github.com/users/octocat/received_events", - "type": "User", - "site_admin": false - } - } - ] - } -] - */ - - use std::fs; use std::fs::{File, remove_file}; use std::io::{Read, Write}; @@ -107,6 +27,11 @@ struct GithubReleaseAsset { } fn main() { + if Path::new(&format!("{}/{}", std::env::var("OUT_DIR").unwrap(), "noredownload")).exists() && std::env::var("TFBUILD_FORCE_REDOWNLOAD").is_err() { + println!("noredownload exists and TFBUILD_FORCE_REDOWNLOAD is not set. Not redoing build process."); + return; + } + println!("[*] Fetching nebula releaseinfo..."); let mut headers = HeaderMap::new(); @@ -206,8 +131,8 @@ fn main() { codegen_version(&nebula_cert_bin, "nebula_cert.bin", "NEBULA_CERT"); - // get version info and codegen - + // Indicate to cargo and ourselves that we have already downloaded and codegenned + File::create(format!("{}/{}", std::env::var("OUT_DIR").unwrap(), "noredownload")).unwrap(); println!("cargo:rerun-if-changed=build.rs"); } diff --git a/tfclient/src/main.rs b/tfclient/src/main.rs index f420b51..d4d2582 100644 --- a/tfclient/src/main.rs +++ b/tfclient/src/main.rs @@ -43,7 +43,5 @@ fn main() { } fn print_version() { - println!("tfclient v{}", env!("CARGO_PKG_VERSION")); - println!("embedded nebula v{}", crate::nebula_bin::NEBULA_VERSION); - println!("embedded nebula-cert v{}", crate::nebula_cert_bin::NEBULA_CERT_VERSION); + println!("tfclient v{} linked to trifid-pki v{}, embedding nebula v{} and nebula-cert v{}", env!("CARGO_PKG_VERSION"), trifid_pki::TRIFID_PKI_VERSION, crate::nebula_bin::NEBULA_VERSION, crate::nebula_cert_bin::NEBULA_CERT_VERSION); } \ No newline at end of file diff --git a/trifid-pki/Cargo.toml b/trifid-pki/Cargo.toml index ce4daba..a6fdb94 100644 --- a/trifid-pki/Cargo.toml +++ b/trifid-pki/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "trifid-pki" -version = "0.1.4" +version = "0.1.5" edition = "2021" description = "A rust implementation of the Nebula PKI system" license = "AGPL-3.0-or-later" diff --git a/trifid-pki/src/lib.rs b/trifid-pki/src/lib.rs index 7323013..4c67fe0 100644 --- a/trifid-pki/src/lib.rs +++ b/trifid-pki/src/lib.rs @@ -57,4 +57,7 @@ pub mod cert; pub(crate) mod cert_codec; #[cfg(test)] #[macro_use] -pub mod test; \ No newline at end of file +pub mod test; + +/// Get the compiled version of trifid-pki. +pub const TRIFID_PKI_VERSION: &str = env!("CARGO_PKG_VERSION"); \ No newline at end of file