mirror of
https://github.com/stalwartlabs/mail-server.git
synced 2025-02-25 00:12:58 +08:00
Updated resources
This commit is contained in:
parent
23edd40fd0
commit
62aa3be182
7 changed files with 103 additions and 68 deletions
|
@ -38,13 +38,13 @@ impl ServerCommands {
|
|||
}
|
||||
ServerCommands::ReloadCertificates {} => {
|
||||
client
|
||||
.http_request::<Value, String>(Method::GET, "/api/reload/certificates", None)
|
||||
.http_request::<Value, String>(Method::GET, "/api/reload/certificate", None)
|
||||
.await;
|
||||
eprintln!("Success.");
|
||||
}
|
||||
ServerCommands::ReloadConfig {} => {
|
||||
client
|
||||
.http_request::<Value, String>(Method::GET, "/api/reload/settings", None)
|
||||
.http_request::<Value, String>(Method::GET, "/api/reload", None)
|
||||
.await;
|
||||
eprintln!("Success.");
|
||||
}
|
||||
|
|
|
@ -230,26 +230,39 @@ impl Scripting {
|
|||
.with_max_header_size(10240)
|
||||
.with_valid_notification_uri("mailto")
|
||||
.with_valid_ext_lists(stores.lookup_stores.keys().map(|k| k.to_string()))
|
||||
.with_functions(&mut fnc_map);
|
||||
.with_functions(&mut fnc_map)
|
||||
.with_max_redirects(
|
||||
config
|
||||
.property_or_default("sieve.trusted.limits.redirects", "3")
|
||||
.unwrap_or(3),
|
||||
)
|
||||
.with_max_out_messages(
|
||||
config
|
||||
.property_or_default("sieve.trusted.limits.out-messages", "5")
|
||||
.unwrap_or(5),
|
||||
)
|
||||
.with_cpu_limit(
|
||||
config
|
||||
.property_or_default("sieve.trusted.limits.cpu", "1048576")
|
||||
.unwrap_or(1048576),
|
||||
)
|
||||
.with_max_nested_includes(
|
||||
config
|
||||
.property_or_default("sieve.trusted.limits.nested-includes", "5")
|
||||
.unwrap_or(5),
|
||||
)
|
||||
.with_max_received_headers(
|
||||
config
|
||||
.property_or_default("sieve.trusted.limits.received-headers", "50")
|
||||
.unwrap_or(50),
|
||||
)
|
||||
.with_default_duplicate_expiry(
|
||||
config
|
||||
.property_or_default::<Duration>("sieve.trusted.limits.duplicate-expiry", "7d")
|
||||
.unwrap_or_else(|| Duration::from_secs(604800))
|
||||
.as_secs(),
|
||||
);
|
||||
|
||||
if let Some(value) = config.property("sieve.trusted.limits.redirects") {
|
||||
trusted_runtime.set_max_redirects(value);
|
||||
}
|
||||
if let Some(value) = config.property("sieve.trusted.limits.out-messages") {
|
||||
trusted_runtime.set_max_out_messages(value);
|
||||
}
|
||||
if let Some(value) = config.property("sieve.trusted.limits.cpu") {
|
||||
trusted_runtime.set_cpu_limit(value);
|
||||
}
|
||||
if let Some(value) = config.property("sieve.trusted.limits.nested-includes") {
|
||||
trusted_runtime.set_max_nested_includes(value);
|
||||
}
|
||||
if let Some(value) = config.property("sieve.trusted.limits.received-headers") {
|
||||
trusted_runtime.set_max_received_headers(value);
|
||||
}
|
||||
if let Some(value) = config.property::<Duration>("sieve.trusted.limits.duplicate-expiry") {
|
||||
trusted_runtime.set_default_duplicate_expiry(value.as_secs());
|
||||
}
|
||||
let hostname = config
|
||||
.value("sieve.trusted.hostname")
|
||||
.or_else(|| config.value("lookup.default.hostname"))
|
||||
|
|
|
@ -314,6 +314,7 @@ fn quickstart(path: impl Into<PathBuf>) {
|
|||
eprintln!("🔑 Your administrator account is 'admin' with password '{admin_pass}'.");
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "foundation"))]
|
||||
const QUICKSTART_CONFIG: &str = r#"[server.listener.smtp]
|
||||
bind = "[::]:25"
|
||||
protocol = "smtp"
|
||||
|
@ -378,3 +379,68 @@ enable = true
|
|||
user = "admin"
|
||||
secret = "_S_"
|
||||
"#;
|
||||
|
||||
#[cfg(feature = "foundation")]
|
||||
const QUICKSTART_CONFIG: &str = r#"[server.listener.smtp]
|
||||
bind = "[::]:25"
|
||||
protocol = "smtp"
|
||||
|
||||
[server.listener.submission]
|
||||
bind = "[::]:587"
|
||||
protocol = "smtp"
|
||||
|
||||
[server.listener.submissions]
|
||||
bind = "[::]:465"
|
||||
protocol = "smtp"
|
||||
tls.implicit = true
|
||||
|
||||
[server.listener.imap]
|
||||
bind = "[::]:143"
|
||||
protocol = "imap"
|
||||
|
||||
[server.listener.imaptls]
|
||||
bind = "[::]:993"
|
||||
protocol = "imap"
|
||||
tls.implicit = true
|
||||
|
||||
[server.listener.sieve]
|
||||
bind = "[::]:4190"
|
||||
protocol = "managesieve"
|
||||
|
||||
[server.listener.https]
|
||||
protocol = "http"
|
||||
bind = "[::]:443"
|
||||
tls.implicit = true
|
||||
|
||||
[server.listener.http]
|
||||
protocol = "http"
|
||||
bind = "[::]:8080"
|
||||
|
||||
[storage]
|
||||
data = "foundation-db"
|
||||
fts = "foundation-db"
|
||||
blob = "foundation-db"
|
||||
lookup = "foundation-db"
|
||||
directory = "internal"
|
||||
|
||||
[store.foundation-db]
|
||||
type = "foundationdb"
|
||||
compression = "lz4"
|
||||
|
||||
[directory.internal]
|
||||
type = "internal"
|
||||
store = "foundation-db"
|
||||
|
||||
[tracer.log]
|
||||
type = "log"
|
||||
level = "info"
|
||||
path = "_P_/logs"
|
||||
prefix = "stalwart.log"
|
||||
rotate = "daily"
|
||||
ansi = false
|
||||
enable = true
|
||||
|
||||
[authentication.fallback-admin]
|
||||
user = "admin"
|
||||
secret = "_S_"
|
||||
"#;
|
||||
|
|
|
@ -31,15 +31,10 @@ pub mod reload;
|
|||
pub mod webadmin;
|
||||
|
||||
pub const SPAMFILTER_URL: &str = "https://get.stalw.art/resources/config/spamfilter.toml";
|
||||
pub const WEBADMIN_URL: &str = "file://get.stalw.art/resources/config/webadmin.toml";
|
||||
pub const WEBADMIN_URL: &str = "https://get.stalw.art/resources/webadmin.zip";
|
||||
pub const WEBADMIN_KEY: &[u8] = "STALWART_WEBADMIN".as_bytes();
|
||||
|
||||
async fn download_resource(url: &str) -> Result<Vec<u8>, String> {
|
||||
let todo = "remove";
|
||||
if url == WEBADMIN_URL {
|
||||
return Ok(tokio::fs::read("/tmp/dist.zip").await.unwrap());
|
||||
}
|
||||
|
||||
reqwest::Client::builder()
|
||||
.timeout(Duration::from_secs(60))
|
||||
.user_agent(USER_AGENT)
|
||||
|
|
|
@ -27,7 +27,7 @@ use deadpool::{
|
|||
};
|
||||
use std::{sync::Arc, time::Duration};
|
||||
use store::{Store, Stores};
|
||||
use utils::config::{utils::ParseValue, Config};
|
||||
use utils::config::Config;
|
||||
|
||||
use ahash::AHashMap;
|
||||
|
||||
|
@ -146,40 +146,3 @@ pub(crate) fn build_pool<M: Manager>(
|
|||
)
|
||||
})
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum LookupType {
|
||||
List,
|
||||
Glob,
|
||||
Regex,
|
||||
Map,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct LookupFormat {
|
||||
pub lookup_type: LookupType,
|
||||
pub comment: Option<String>,
|
||||
pub separator: Option<String>,
|
||||
}
|
||||
|
||||
impl Default for LookupFormat {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
lookup_type: LookupType::Glob,
|
||||
comment: Default::default(),
|
||||
separator: Default::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ParseValue for LookupType {
|
||||
fn parse_value(value: &str) -> utils::config::Result<Self> {
|
||||
match value {
|
||||
"list" => Ok(LookupType::List),
|
||||
"glob" => Ok(LookupType::Glob),
|
||||
"regex" => Ok(LookupType::Regex),
|
||||
"map" => Ok(LookupType::Map),
|
||||
_ => Err(format!("Invalid value for lookup type {value:?}",)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,9 +32,7 @@ tracing = "0.1"
|
|||
jemallocator = "0.5.0"
|
||||
|
||||
[features]
|
||||
default = ["sqlite", "foundationdb", "postgres", "mysql", "rocks", "elastic", "s3", "redis"]
|
||||
#default = ["sqlite", "postgres", "mysql", "rocks", "elastic", "s3", "redis"]
|
||||
#default = ["foundationdb", "postgres", "mysql"]
|
||||
default = ["sqlite", "postgres", "mysql", "rocks", "elastic", "s3", "redis"]
|
||||
sqlite = ["store/sqlite"]
|
||||
foundationdb = ["store/foundation"]
|
||||
postgres = ["store/postgres"]
|
||||
|
|
BIN
resources/webadmin.zip
Normal file
BIN
resources/webadmin.zip
Normal file
Binary file not shown.
Loading…
Reference in a new issue