-
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for clamav virus scanning
closes #27
- Loading branch information
Showing
7 changed files
with
62 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "autumn" | ||
version = "1.1.8" | ||
version = "1.1.9" | ||
authors = ["Paul Makles <[email protected]>"] | ||
edition = "2018" | ||
|
||
|
@@ -38,3 +38,6 @@ actix-web = "4.0.0-beta.9" | |
actix-cors = "0.6.0-beta.2" | ||
actix-files = "0.6.0-beta.7" | ||
actix-multipart = "0.4.0-beta.6" | ||
|
||
# virus scanning | ||
revolt_clamav-client = { version = "0.1.5" } |
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
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
use std::time::Duration; | ||
|
||
use log::{error, info}; | ||
|
||
use crate::util::variables::{CLAMD_HOST, USE_CLAMD}; | ||
|
||
pub fn init() { | ||
if *USE_CLAMD { | ||
info!("Waiting for clamd to be ready..."); | ||
|
||
loop { | ||
let clamd_available = match revolt_clamav_client::ping_tcp(CLAMD_HOST.to_string()) { | ||
Ok(ping_response) => ping_response == b"PONG\0", | ||
Err(_) => false, | ||
}; | ||
|
||
if clamd_available { | ||
info!("clamd is ready, virus protection enabled!"); | ||
break; | ||
} else { | ||
error!( | ||
"Could not ping clamd host at {}, retrying in 10 seconds...", | ||
CLAMD_HOST.to_string() | ||
); | ||
|
||
std::thread::sleep(Duration::from_secs(10)); | ||
} | ||
} | ||
} | ||
} |
f9a1058
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.