1
0
Fork 0
mirror of https://codeberg.org/icewind/haze.git synced 2026-06-03 09:04:12 +02:00

add local clam

This commit is contained in:
Robin Appelman 2025-06-16 18:33:36 +02:00
commit 9824fc9254
6 changed files with 42 additions and 1 deletions

View file

@ -0,0 +1 @@
DatabaseDirectory /var/lib/clamav

View file

@ -0,0 +1,2 @@
DatabaseDirectory /var/lib/clamav
DatabaseOwner haze

Binary file not shown.

View file

@ -28,6 +28,7 @@
sudo, sudo,
su, su,
which, which,
clamav,
debug ? false, debug ? false,
writeShellApplication, writeShellApplication,
}: let }: let
@ -69,6 +70,12 @@
mkdir -p $out mkdir -p $out
cp -r ${../../redis-certificates} $out/redis-certificates cp -r ${../../redis-certificates} $out/redis-certificates
''; '';
clamav-data = runCommand "scripts" {} ''
mkdir -p $out/etc
mkdir -p $out/var/lib/clamav
cp ${data/clamav/daily.cvd} $out/var/lib/clamav/daily.cvd
cp -r ${configs/clamav} $out/etc/clamav
'';
baseImage = dockerTools.buildImage { baseImage = dockerTools.buildImage {
name = "icewind1991/haze-base"; name = "icewind1991/haze-base";
@ -93,6 +100,7 @@
which which
git git
sqlite sqlite
clamav
# samba # samba
wget wget
curl curl
@ -125,6 +133,7 @@ in
configs configs
scripts scripts
redis-certificates redis-certificates
clamav-data
shadowSetupScript shadowSetupScript
]; ];
fakeRootCommands = '' fakeRootCommands = ''

View file

@ -16,7 +16,7 @@ mod smb;
use crate::cloud::CloudOptions; use crate::cloud::CloudOptions;
use crate::config::{HazeConfig, Preset}; use crate::config::{HazeConfig, Preset};
pub use crate::service::clam::{ClamIcap, ClamIcapTls}; pub use crate::service::clam::{Clam, ClamIcap, ClamIcapTls};
use crate::service::dav::Dav; use crate::service::dav::Dav;
use crate::service::imaginary::Imaginary; use crate::service::imaginary::Imaginary;
use crate::service::kaspersky::{Kaspersky, KasperskyIcap}; use crate::service::kaspersky::{Kaspersky, KasperskyIcap};
@ -206,6 +206,7 @@ pub enum Service {
Sftp(Sftp), Sftp(Sftp),
Kaspersky(Kaspersky), Kaspersky(Kaspersky),
KasperskyIcap(KasperskyIcap), KasperskyIcap(KasperskyIcap),
Clam(Clam),
ClamIcap(ClamIcap), ClamIcap(ClamIcap),
ClamIcapTls(ClamIcapTls), ClamIcapTls(ClamIcapTls),
Oc(Oc), Oc(Oc),
@ -245,8 +246,10 @@ impl Service {
"imaginary" => Some(vec![Service::Imaginary(Imaginary)]), "imaginary" => Some(vec![Service::Imaginary(Imaginary)]),
"kaspersky" => Some(vec![Service::Kaspersky(Kaspersky)]), "kaspersky" => Some(vec![Service::Kaspersky(Kaspersky)]),
"kaspersky-icap" => Some(vec![Service::KasperskyIcap(KasperskyIcap)]), "kaspersky-icap" => Some(vec![Service::KasperskyIcap(KasperskyIcap)]),
"clamav" => Some(vec![Service::Clam(Clam)]),
"clamav-icap" => Some(vec![Service::ClamIcap(ClamIcap)]), "clamav-icap" => Some(vec![Service::ClamIcap(ClamIcap)]),
"clamav-icap-tls" => Some(vec![Service::ClamIcapTls(ClamIcapTls)]), "clamav-icap-tls" => Some(vec![Service::ClamIcapTls(ClamIcapTls)]),
"clam" => Some(vec![Service::Clam(Clam)]),
"clam-icap" => Some(vec![Service::ClamIcap(ClamIcap)]), "clam-icap" => Some(vec![Service::ClamIcap(ClamIcap)]),
"clam-icap-tls" => Some(vec![Service::ClamIcapTls(ClamIcapTls)]), "clam-icap-tls" => Some(vec![Service::ClamIcapTls(ClamIcapTls)]),
"mail" => Some(vec![Service::Mail(Mail)]), "mail" => Some(vec![Service::Mail(Mail)]),

View file

@ -208,3 +208,29 @@ impl ServiceTrait for ClamIcapTls {
]) ])
} }
} }
#[derive(Debug, Clone, Eq, PartialEq)]
pub struct Clam;
#[async_trait::async_trait]
impl ServiceTrait for Clam {
fn name(&self) -> &str {
"clamav"
}
fn apps(&self) -> &'static [&'static str] {
&["files_antivirus"]
}
async fn post_setup(
&self,
_docker: &Docker,
_cloud_id: &str,
_config: &HazeConfig,
) -> Result<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(),
])
}
}