Skip to content

Commit

Permalink
chore: paths for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
stephane-segning committed Oct 11, 2024
1 parent 1494cfc commit a8742b3
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 23 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.6
version: 0.2.7

# 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
4 changes: 2 additions & 2 deletions scripts/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ $ErrorActionPreference = "Stop"
# Default log level and application details
$LOG_LEVEL = if ($env:LOG_LEVEL -ne $null) { $env:LOG_LEVEL } else { "INFO" }
$APP_NAME = if ($env:APP_NAME -ne $null) { $env:APP_NAME } else { "wazuh-cert-oauth2-client" }
$DEFAULT_WOPS_VERSION = "0.2.5"
$DEFAULT_WOPS_VERSION = "0.2.7"
$WOPS_VERSION = if ($env:WOPS_VERSION -ne $null) { $env:WOPS_VERSION } else { $DEFAULT_WOPS_VERSION }
$OSSEC_CONF_PATH = if ($env:OSSEC_CONF_PATH -ne $null) { $env:OSSEC_CONF_PATH } else { "C:\Program Files\ossec-agent\ossec.conf" }
$USER = "root"
Expand Down Expand Up @@ -190,4 +190,4 @@ if (Test-Path $OSSEC_CONF_PATH) {
}

SuccessMessage "Installation and configuration complete! You can now use '$BIN_DIR\$APP_NAME.exe' from your terminal."
InfoMessage "Run ` ./$BIN_DIR\$APP_NAME.exe o-auth2` to start configuring."
InfoMessage "Run ` ./$BIN_DIR\$APP_NAME.exe o-auth2` to start configuring."
3 changes: 1 addition & 2 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ else
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.6"}
WOPS_VERSION="0.2.7"
OSSEC_CONF_PATH=${OSSEC_CONF_PATH:-"/var/ossec/etc/ossec.conf"}
USER="root"
GROUP="wazuh"
Expand Down
4 changes: 2 additions & 2 deletions wazuh-cert-oauth2-client/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-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.6"
version = "0.2.7"
edition = "2021"

[dependencies]
Expand Down
30 changes: 20 additions & 10 deletions wazuh-cert-oauth2-client/src/shared/path.rs
Original file line number Diff line number Diff line change
@@ -1,32 +1,42 @@
use std::path::{Path, PathBuf};

/// Define a function to handle the default cert path
pub fn default_cert_path() -> String {
let cert_path = default_path_to_ossec();
format!("{}/etc/sslagent.cert", cert_path)
let path_buf = cert_path.join("etc").join("sslagent.cert");
path_buf.display().to_string()
}

/// Define a function to handle the default key path
pub fn default_key_path() -> String {
let cert_path = default_path_to_ossec();
format!("{}/etc/sslagent.key", cert_path)
let path_buf = cert_path.join("etc").join("sslagent.key");
path_buf.display().to_string()
}

/// Define a function to handle the default path to the agent control
/// Define a function to handle the default agent control path
pub fn default_path_agent_control() -> String {
let ossec_path = default_path_to_ossec();
format!("{}/bin/wazuh-control", ossec_path)
let path_buf = ossec_path.join("bin").join("wazuh-control");
path_buf.display().to_string()
}

/// Define a function to handle the default path to the ossec.conf file
/// Define a function to handle the default path to ossec.conf
pub fn default_path_to_ossec_conf() -> String {
let ossec_path = default_path_to_ossec();
format!("{}/etc/ossec.conf", ossec_path)
let path_buf = ossec_path.join("etc").join("ossec.conf");
path_buf.display().to_string()
}

/// Define a function to handle the default path to the ossec directory
pub fn default_path_to_ossec() -> &'static str {
if cfg!(target_os = "macos") {
/// Define a function to handle the default path to ossec
pub fn default_path_to_ossec() -> PathBuf {
let base_path = if cfg!(target_os = "macos") {
"/Library/Ossec"
} else if cfg!(target_os = "windows") {
"C:\\Program Files (x86)\\ossec-agent"
} else {
"/var/ossec"
}
};

Path::new(base_path).to_path_buf()
}
2 changes: 1 addition & 1 deletion 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.6"
version = "0.2.7"
edition = "2021"

[dependencies]
Expand Down
4 changes: 2 additions & 2 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.6"
version = "0.2.7"
edition = "2021"

[dependencies]
Expand Down

0 comments on commit a8742b3

Please sign in to comment.