Skip to content

Commit

Permalink
feat: fix name with special char
Browse files Browse the repository at this point in the history
  • Loading branch information
stephane-segning committed Dec 3, 2024
1 parent 101a5f8 commit 25b3e72
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 17 deletions.
2 changes: 1 addition & 1 deletion helm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.2.8
version: 0.2.9

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
2 changes: 1 addition & 1 deletion scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fi
# Default log level and application details
LOG_LEVEL=${LOG_LEVEL:-INFO}
APP_NAME=${APP_NAME:-"wazuh-cert-oauth2-client"}
WOPS_VERSION=${WOPS_VERSION:-"0.2.8"}
WOPS_VERSION=${WOPS_VERSION:-"0.2.9"}
USER="root"
GROUP="wazuh"

Expand Down
13 changes: 10 additions & 3 deletions wazuh-cert-oauth2-client/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions wazuh-cert-oauth2-client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "wazuh-cert-oauth2-client"
version = "0.2.8"
version = "0.2.9"
edition = "2021"

[dependencies]
Expand All @@ -16,4 +16,5 @@ wazuh-cert-oauth2-model = { path = "../wazuh-cert-oauth2-model" }
openssl = { version = "0.10.66", features = ["vendored"] }
mid = "3.0.0"
local-ip-address = "0.6.3"
rand = "0.8.5"
rand = "0.8.5"
diacritics = "0.2.2"
7 changes: 4 additions & 3 deletions wazuh-cert-oauth2-client/src/services/set_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ use tokio::process::Command;

/// Set the name of the agent.
pub async fn set_name(name: &str) -> Result<()> {
let long_machine_id = if let Ok(machine_id) = mid::get(name) {
let name = diacritics::remove_diacritics(name);
let long_machine_id = if let Ok(machine_id) = mid::get(&name) {
info!("Machine ID: {}", machine_id);
machine_id
} else {
Expand All @@ -24,8 +25,8 @@ pub async fn set_name(name: &str) -> Result<()> {
};

info!("Small machine ID: {}", small_machine_id);
let agent_name = format!("{}-{}", name, small_machine_id)
.replace(|c: char| !c.is_alphanumeric(), "-");
let agent_name = format!("{}-{}", &name, small_machine_id)
.replace(|c: char| !c.is_ascii_alphanumeric(), "-");

let ossec_conf = default_path_to_ossec_conf();
info!("Updating agent name to {} in {}", agent_name, ossec_conf);
Expand Down
4 changes: 2 additions & 2 deletions wazuh-cert-oauth2-model/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion wazuh-cert-oauth2-model/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "wazuh-cert-oauth2-model"
version = "0.2.8"
version = "0.2.9"
edition = "2021"

[dependencies]
Expand Down
6 changes: 3 additions & 3 deletions wazuh-cert-oauth2/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion wazuh-cert-oauth2/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "wazuh-cert-oauth2"
version = "0.2.8"
version = "0.2.9"
edition = "2021"

[dependencies]
Expand Down

0 comments on commit 25b3e72

Please sign in to comment.