-
Notifications
You must be signed in to change notification settings - Fork 634
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add: integrate openvasctl into openvasd and make it configurable
- Loading branch information
1 parent
b6968ae
commit b95c61d
Showing
16 changed files
with
492 additions
and
62 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,25 @@ | ||
use std::time::Duration; | ||
|
||
#[derive(Default)] | ||
#[derive(Debug, Clone)] | ||
#[cfg_attr( | ||
feature = "serde_support", | ||
derive(serde::Serialize, serde::Deserialize), | ||
serde(deny_unknown_fields) | ||
)] | ||
pub struct Config { | ||
pub max_queued_scans: Option<usize>, | ||
pub max_running_scans: Option<usize>, | ||
pub min_free_mem: Option<u64>, | ||
pub check_interval: Duration, | ||
} | ||
|
||
impl Default for Config { | ||
fn default() -> Self { | ||
Self { | ||
max_queued_scans: Default::default(), | ||
max_running_scans: Default::default(), | ||
min_free_mem: Default::default(), | ||
check_interval: Duration::from_secs(1), | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,23 @@ | ||
use std::io; | ||
use std::{fmt::Display, io}; | ||
|
||
pub enum OpenvasError { | ||
MissingID, | ||
DuplicateScanID, | ||
DuplicateScanID(String), | ||
MissingExec, | ||
ScanNotFound, | ||
ScanAlreadyExists, | ||
ScanNotFound(String), | ||
CmdError(io::Error), | ||
BrokenChannel, | ||
MaxQueuedScans, | ||
UnableToRunExec, | ||
} | ||
|
||
impl Display for OpenvasError { | ||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
match self { | ||
OpenvasError::DuplicateScanID(id) => write!(f, "a scan with ID {id} already exists"), | ||
OpenvasError::MissingExec => write!(f, "unable to launch openvas executable"), | ||
OpenvasError::ScanNotFound(id) => write!(f, "a scan with ID {id} not found"), | ||
OpenvasError::CmdError(e) => write!(f, "unable to run command: {e}"), | ||
OpenvasError::MaxQueuedScans => write!(f, "maximum number of queued scan reached"), | ||
OpenvasError::UnableToRunExec => write!(f, "unable to run openvas"), | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.