Skip to content

Commit d271ed8

Browse files
release 0.1.6 (#3)
1 parent 621fc98 commit d271ed8

10 files changed

Lines changed: 55 additions & 20 deletions

File tree

.fpm

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
-s dir
2+
-a native
3+
--name yubikey-provision
4+
--description "Defguard YubiKey Provision client"
5+
--url "https://defguard.net/"
6+
--maintainer "Teonite"

.github/workflows/current.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ jobs:
1616
uses: actions/checkout@v4
1717
with:
1818
submodules: recursive
19-
- name: Extract branch name
20-
uses: nelonoel/branch-name@v1
19+
20+
- name: Inject slug/short variables
21+
uses: rlespinasse/github-slug-action@v4
22+
2123
- name: Docker meta
2224
id: meta
2325
uses: docker/metadata-action@v4
@@ -26,23 +28,27 @@ jobs:
2628
ghcr.io/defguard/yubikey-provision
2729
tags: |
2830
type=ref,event=branch
29-
type=raw,value=current.${BRANCH_NAME}
31+
type=raw,value=current
3032
type=sha
33+
3134
- name: Set up QEMU
3235
uses: docker/setup-qemu-action@v2
36+
3337
- name: Set up Docker Buildx
3438
uses: docker/setup-buildx-action@v2
39+
3540
- name: Login to GitHub container registry
3641
uses: docker/login-action@v2
3742
with:
3843
registry: ghcr.io
3944
username: ${{ github.actor }}
4045
password: ${{ secrets.GITHUB_TOKEN }}
46+
4147
- name: Build container
4248
uses: docker/build-push-action@v4
4349
with:
4450
context: .
45-
platforms: linux/amd64,linux/arm64
51+
platforms: linux/amd64
4652
push: true
4753
tags: ${{ steps.meta.outputs.tags }}
4854
labels: ${{ steps.meta.outputs.labels }}

.github/workflows/release.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
uses: docker/build-push-action@v4
4040
with:
4141
context: .
42-
platforms: linux/amd64,linux/arm64
42+
platforms: linux/amd64
4343
push: ${{ github.event_name != 'pull_request' }}
4444
tags: ${{ steps.meta.outputs.tags }}
4545
labels: ${{ steps.meta.outputs.labels }}
@@ -112,9 +112,6 @@ jobs:
112112
- name: Rename binary
113113
run: mv target/${{ matrix.target }}/release/yubikey-provision ${{ matrix.asset_name }}-${{ github.ref_name }}
114114

115-
- name: Strip release binary
116-
run: strip "${{ matrix.asset_name }}-${{ github.ref_name }}"
117-
118115
- name: Tar
119116
uses: a7ul/tar-action@v1.1.0
120117
with:

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "yubikey-provider"
2+
name = "yubikey-provision"
33
version = "0.1.0"
44
edition = "2021"
55

@@ -23,3 +23,8 @@ which = "4"
2323
[build-dependencies]
2424
tonic-build = { version = "0.10" }
2525
prost-build = { version = "0.12" }
26+
27+
[profile.release]
28+
strip = true
29+
opt-level = "s"
30+
lto = true

Cross.toml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[target.x86_64-unknown-linux-gnu]
2+
pre-build = ["apt-get update && apt-get install --assume-yes unzip ",
3+
"PB_REL='https://github.com/protocolbuffers/protobuf/releases'",
4+
"PB_VERSION='3.20.0' && curl -LO $PB_REL/download/v$PB_VERSION/protoc-$PB_VERSION-linux-x86_64.zip",
5+
"unzip protoc-$PB_VERSION-linux-x86_64.zip bin/protoc include/google/* -d /usr"]
6+
7+
[target.armv7-unknown-linux-gnueabihf]
8+
pre-build = ["apt-get update && apt-get install --assume-yes unzip ",
9+
"PB_REL='https://github.com/protocolbuffers/protobuf/releases'",
10+
"PB_VERSION='3.20.0' && curl -LO $PB_REL/download/v$PB_VERSION/protoc-$PB_VERSION-linux-x86_64.zip",
11+
"unzip protoc-$PB_VERSION-linux-x86_64.zip bin/protoc include/google/* -d /usr"]
12+
13+
[target.aarch64-unknown-linux-gnu]
14+
pre-build = ["apt-get update && apt-get install --assume-yes unzip ",
15+
"PB_REL='https://github.com/protocolbuffers/protobuf/releases'",
16+
"PB_VERSION='3.20.0' && curl -LO $PB_REL/download/v$PB_VERSION/protoc-$PB_VERSION-linux-x86_64.zip",
17+
"unzip protoc-$PB_VERSION-linux-x86_64.zip bin/protoc include/google/* -d /usr"]

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ RUN pip install yubikey-manager
1515
FROM runner
1616
RUN service pcscd start
1717
WORKDIR /app
18-
COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/yubikey-provider /usr/local/bin
18+
COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/yubikey-provision /usr/local/bin
1919
ENTRYPOINT ["/usr/local/bin/yubikey-provider"]

src/config.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,23 @@ use crate::error::WorkerError;
88
#[derive(Debug, Parser, Clone, Deserialize)]
99
#[clap(about = "Defguard YubiKey Provisioning service")]
1010
pub struct Config {
11-
// CA Used for GRPC connection
12-
#[arg(long, env = "GRPC_CA")]
11+
// Path to CA Used for GRPC connection
12+
#[arg(long = "ca-file", env = "GRPC_CA")]
1313
pub grpc_ca: Option<PathBuf>,
14-
/// Worker id
15-
#[arg(long, env = "WORKER_ID", default_value = "YubiBridge")]
14+
/// ID, this will be also displayed in defguard UI
15+
#[arg(long = "id", env = "ID", default_value = "YubikeyProvisioner")]
1616
pub worker_id: String,
1717

1818
/// Logging level, needs to be compatible with log crate log::LevelFilter::from_str
1919
#[arg(long, env = "LOG_LEVEL", default_value = "info")]
2020
pub log_level: String,
2121

22-
/// Url of your DefGuard instance
23-
#[arg(long, env = "URL", default_value = "http://127.0.0.1:50055")]
22+
/// Url of your DefGuard GRPC server
23+
#[arg(
24+
long = "grpc",
25+
env = "GRPC_URL",
26+
default_value = "http://127.0.0.1:50055"
27+
)]
2428
pub url: String,
2529

2630
/// Number of retries in case if there are no keys detected

src/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub enum WorkerError {
2121
NoKeysFound,
2222
#[error("Multiple yubikeys found")]
2323
MultipleKeysPresent,
24-
#[error("IO error occured")]
24+
#[error("IO error occurred")]
2525
IO,
2626
#[error("UTF8 conversion failed")]
2727
UTF8Conversion,

src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::time::Duration;
33
use config::get_config;
44
use error::WorkerError;
55
use gpg::provision_key;
6-
use log::{debug, info};
6+
use log::{debug, error, info};
77
use proto::{worker_service_client::WorkerServiceClient, JobStatus, Worker};
88
use tokio::time::interval;
99
use tonic::{
@@ -124,7 +124,7 @@ async fn main() -> Result<(), WorkerError> {
124124
let request = tonic::Request::new(job_status);
125125
let _ = client.set_job_done(request).await;
126126
debug!("Job result sent");
127-
info!("Job failed");
127+
error!("Job failed! Result sent");
128128
}
129129
}
130130
}

0 commit comments

Comments
 (0)