mirror of
https://codeberg.org/icewind/haze.git
synced 2026-08-02 12:14:46 +02:00
add sftp with key authentication service
This commit is contained in:
parent
f99238121b
commit
204fb676d6
19 changed files with 348 additions and 135 deletions
|
|
@ -2,7 +2,7 @@ use crate::cloud::CloudOptions;
|
|||
use crate::config::HazeConfig;
|
||||
use crate::exec::exec;
|
||||
use crate::image::pull_image;
|
||||
use crate::service::ServiceTrait;
|
||||
use crate::service::{split_cmnd, ServiceTrait};
|
||||
use crate::Result;
|
||||
use bollard::models::{ContainerCreateBody, EndpointSettings, HostConfig, NetworkingConfig};
|
||||
use bollard::query_parameters::CreateContainerOptions;
|
||||
|
|
@ -85,14 +85,13 @@ impl ServiceTrait for ClamIcap {
|
|||
_docker: &Docker,
|
||||
_cloud_id: &str,
|
||||
_config: &HazeConfig,
|
||||
) -> Result<Vec<String>> {
|
||||
) -> Result<Vec<Vec<String>>> {
|
||||
Ok(vec![
|
||||
"occ config:app:set files_antivirus av_mode --value=icap".into(),
|
||||
"occ config:app:set files_antivirus av_host --value=clamav-icap".into(),
|
||||
"occ config:app:set files_antivirus av_port --value=1344".into(),
|
||||
"occ config:app:set files_antivirus av_icap_request_service --value=avscan".into(),
|
||||
"occ config:app:set files_antivirus av_icap_response_header --value=X-Infection-Found"
|
||||
.into(),
|
||||
split_cmnd("occ config:app:set files_antivirus av_mode --value=icap"),
|
||||
split_cmnd("occ config:app:set files_antivirus av_host --value=clamav-icap"),
|
||||
split_cmnd("occ config:app:set files_antivirus av_port --value=1344"),
|
||||
split_cmnd("occ config:app:set files_antivirus av_icap_request_service --value=avscan"),
|
||||
split_cmnd("occ config:app:set files_antivirus av_icap_response_header --value=X-Infection-Found"),
|
||||
])
|
||||
}
|
||||
}
|
||||
|
|
@ -171,7 +170,7 @@ impl ServiceTrait for ClamIcapTls {
|
|||
docker: &Docker,
|
||||
cloud_id: &str,
|
||||
config: &HazeConfig,
|
||||
) -> Result<Vec<String>> {
|
||||
) -> Result<Vec<Vec<String>>> {
|
||||
let mut cert = Vec::new();
|
||||
exec(
|
||||
docker,
|
||||
|
|
@ -191,14 +190,13 @@ impl ServiceTrait for ClamIcapTls {
|
|||
.wrap_err("Failed to write icap certificate")?;
|
||||
|
||||
Ok(vec![
|
||||
"occ config:app:set files_antivirus av_mode --value=icap".into(),
|
||||
"occ config:app:set files_antivirus av_icap_tls --value=1".into(),
|
||||
"occ config:app:set files_antivirus av_host --value=clamav-icap-tls".into(),
|
||||
"occ config:app:set files_antivirus av_port --value=1345".into(),
|
||||
"occ config:app:set files_antivirus av_icap_request_service --value=avscan".into(),
|
||||
"occ config:app:set files_antivirus av_icap_response_header --value=X-Infection-Found"
|
||||
.into(),
|
||||
"occ security:certificates:import data/icap-cert.pem".into(),
|
||||
split_cmnd("occ config:app:set files_antivirus av_mode --value=icap"),
|
||||
split_cmnd("occ config:app:set files_antivirus av_icap_tls --value=1"),
|
||||
split_cmnd("occ config:app:set files_antivirus av_host --value=clamav-icap-tls"),
|
||||
split_cmnd("occ config:app:set files_antivirus av_port --value=1345"),
|
||||
split_cmnd("occ config:app:set files_antivirus av_icap_request_service --value=avscan"),
|
||||
split_cmnd("occ config:app:set files_antivirus av_icap_response_header --value=X-Infection-Found"),
|
||||
split_cmnd("occ security:certificates:import data/icap-cert.pem"),
|
||||
])
|
||||
}
|
||||
}
|
||||
|
|
@ -221,10 +219,10 @@ impl ServiceTrait for Clam {
|
|||
_docker: &Docker,
|
||||
_cloud_id: &str,
|
||||
_config: &HazeConfig,
|
||||
) -> Result<Vec<String>> {
|
||||
) -> Result<Vec<Vec<String>>> {
|
||||
Ok(vec![
|
||||
"occ config:app:set files_antivirus av_mode --value=executable".into(),
|
||||
"occ config:app:set files_antivirus av_path --value=/bin/clamscan".into(),
|
||||
split_cmnd("occ config:app:set files_antivirus av_mode --value=executable"),
|
||||
split_cmnd("occ config:app:set files_antivirus av_path --value=/bin/clamscan"),
|
||||
])
|
||||
}
|
||||
}
|
||||
|
|
@ -294,10 +292,12 @@ impl ServiceTrait for ClamSocket {
|
|||
_docker: &Docker,
|
||||
_cloud_id: &str,
|
||||
_config: &HazeConfig,
|
||||
) -> Result<Vec<String>> {
|
||||
) -> Result<Vec<Vec<String>>> {
|
||||
Ok(vec![
|
||||
"occ config:app:set files_antivirus av_mode --value=socket".into(),
|
||||
"occ config:app:set files_antivirus av_socket --value=tcp://clamav-socket:3310".into(),
|
||||
split_cmnd("occ config:app:set files_antivirus av_mode --value=socket"),
|
||||
split_cmnd(
|
||||
"occ config:app:set files_antivirus av_socket --value=tcp://clamav-socket:3310",
|
||||
),
|
||||
])
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue