Skip to content

Commit

Permalink
v0.1.12
Browse files Browse the repository at this point in the history
  • Loading branch information
mdecimus committed Aug 29, 2024
1 parent a9a8918 commit e042f8a
Show file tree
Hide file tree
Showing 13 changed files with 373 additions and 64 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@

All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/).

## [0.1.12] - 2024-08-29

## Added
- Dashboard (Enterprise edition only).
- Alerts (Enterprise edition only).
- Fail2ban on failed RCPT and loitering events.
- Blocked domains list.
- Is allowed to sender setting.

### Changed

### Fixed
- Super users can't be added to groups.

## [0.1.11] - 2024-08-20

## Added
Expand Down
42 changes: 37 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ homepage = "https://stalw.art"
keywords = ["web", "admin", "email", "mail", "server"]
categories = ["email"]
license = "AGPL-3.0-only OR LicenseRef-SEL"
version = "0.1.11"
version = "0.1.12"
edition = "2021"
resolver = "2"

Expand All @@ -16,8 +16,8 @@ console_error_panic_hook = "0.1.7"
leptos = { version = "0.6.9", features = ["csr"] }
leptos_meta = { version = "0.6.9", features = ["csr"] }
leptos_router = { version = "0.6.9", features = ["csr"] }
leptos-use = "0.12"
codee = { version = "0.1.2", features = ["json_serde"] }
leptos-use = "0.13"
codee = { version = "0.2", features = ["json_serde"] }
gloo-net = { version = "0.6", features = ["http"] }
gloo-storage = "0.3.0"
serde = { version = "1", features = ["derive", "rc"] }
Expand Down
32 changes: 32 additions & 0 deletions src/components/icon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -735,3 +735,35 @@ pub fn IconNoSymbol(
</SvgWrapper>
}
}

#[component]
pub fn IconSignal(
#[prop(optional)] size: Option<usize>,
#[prop(attrs)] attrs: Vec<(&'static str, Attribute)>,
) -> impl IntoView {
view! {
<SvgWrapper size attrs>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M9.348 14.652a3.75 3.75 0 0 1 0-5.304m5.304 0a3.75 3.75 0 0 1 0 5.304m-7.425 2.121a6.75 6.75 0 0 1 0-9.546m9.546 0a6.75 6.75 0 0 1 0 9.546M5.106 18.894c-3.808-3.807-3.808-9.98 0-13.788m13.788 0c3.808 3.807 3.808 9.98 0 13.788M12 12h.008v.008H12V12Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Z"
></path>
</SvgWrapper>
}
}

#[component]
pub fn IconHandRaised(
#[prop(optional)] size: Option<usize>,
#[prop(attrs)] attrs: Vec<(&'static str, Attribute)>,
) -> impl IntoView {
view! {
<SvgWrapper size attrs>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M10.05 4.575a1.575 1.575 0 1 0-3.15 0v3m3.15-3v-1.5a1.575 1.575 0 0 1 3.15 0v1.5m-3.15 0 .075 5.925m3.075.75V4.575m0 0a1.575 1.575 0 0 1 3.15 0V15M6.9 7.575a1.575 1.575 0 1 0-3.15 0v8.175a6.75 6.75 0 0 0 6.75 6.75h2.018a5.25 5.25 0 0 0 3.712-1.538l1.732-1.732a5.25 5.25 0 0 0 1.538-3.712l.003-2.024a.668.668 0 0 1 .198-.471 1.575 1.575 0 1 0-2.228-2.228 3.818 3.818 0 0 0-1.12 2.687M6.9 7.575V12m6.27 4.318A4.49 4.49 0 0 1 16.35 15m.002 0h-.002"
></path>
</SvgWrapper>
}
}
10 changes: 5 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ use std::{sync::Arc, time::Duration};

use components::{
icon::{
IconAdjustmentsHorizontal, IconChartBarSquare, IconClock, IconDocumentChartBar,
IconDocumentText, IconKey, IconLockClosed, IconQueueList, IconShieldCheck, IconSquare2x2,
IconUserGroup, IconWrench,
IconAdjustmentsHorizontal, IconChartBarSquare, IconClock, IconDocumentChartBar, IconKey,
IconLockClosed, IconQueueList, IconShieldCheck, IconSignal, IconSquare2x2, IconUserGroup,
IconWrench,
},
layout::MenuItem,
};
Expand Down Expand Up @@ -425,8 +425,8 @@ impl LayoutBuilder {
.route("/tracing/delivery")
.insert()
.insert()
.create("Tracing")
.icon(view! { <IconDocumentText/> })
.create("Telemetry")
.icon(view! { <IconSignal/> })
.create("Logs")
.route("/logs")
.insert()
Expand Down
10 changes: 9 additions & 1 deletion src/pages/config/edit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,15 @@ pub fn SettingsEdit() -> impl IntoView {
}
Type::Text => {
view! {
<TextArea element=FormElement::new(field.id, data)/>
<TextArea
element=FormElement::new(field.id, data)
placeholder=create_memo(move |_| {
field
.placeholder(&data.get())
.unwrap_or_default()
.to_string()
})
/>
}
.into_view()
}
Expand Down
78 changes: 45 additions & 33 deletions src/pages/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ use crate::{
components::{
form::input::{Duration, Rate},
icon::{
IconCircleStack, IconCodeBracket, IconInbox, IconInboxArrowDown, IconInboxStack,
IconKey, IconServer, IconServerStack, IconShieldCheck,
IconCircleStack, IconCodeBracket, IconHandRaised, IconInbox, IconInboxArrowDown,
IconInboxStack, IconKey, IconServer, IconServerStack, IconShieldCheck, IconSignal,
},
layout::{LayoutBuilder, MenuItem},
},
Expand Down Expand Up @@ -301,39 +301,10 @@ impl LayoutBuilder {
.create("Cluster")
.route("/cluster/edit")
.insert()
// Telemetry
.create("Telemetry")
.create("Logging & Tracing")
.route("/tracing")
.insert()
.create("Metrics")
.route("/metrics/edit")
.insert()
.create("Webhooks")
.route("/web-hooks")
.insert()
.create("Custom levels")
.route("/custom-levels")
.insert()
.create("History")
.route("/telemetry-history/edit")
.insert()
.insert()
// Cache
.create("Cache")
.route("/cache/edit")
.insert()
// Security
.create("Security")
// Blocked IPs
.create("Blocked IPs")
.route("/blocked-ip")
.insert()
// Blocked IPs
.create("Allowed IPs")
.route("/allowed-ip")
.insert()
.insert()
.insert()
// Storage
.create("Storage")
Expand Down Expand Up @@ -484,8 +455,46 @@ impl LayoutBuilder {
.route("/imap-rate-limit/edit")
.insert()
.insert()
// Security
.create("Security")
.icon(view! { <IconHandRaised/> })
// Fail2ban
.create("Fail2ban")
.route("/fail2ban/edit")
.insert()
// Blocked IPs
.create("Blocked IPs")
.route("/blocked-ip")
.insert()
// Blocked IPs
.create("Allowed IPs")
.route("/allowed-ip")
.insert()
.insert()
// Telemetry
.create("Telemetry")
.icon(view! { <IconSignal/> })
.create("Logging & Tracing")
.route("/tracing")
.insert()
.create("Metrics")
.route("/metrics/edit")
.insert()
.create("Alerts")
.route("/alerts")
.insert()
.create("Webhooks")
.route("/web-hooks")
.insert()
.create("Custom levels")
.route("/custom-levels")
.insert()
.create("History")
.route("/telemetry-history/edit")
.insert()
.insert()
// SPAM Filter
.create("SPAM Filter")
.create("Antispam")
.icon(view! { <IconShieldCheck/> })
.create("Settings")
.route("/spam-settings/edit")
Expand All @@ -505,6 +514,9 @@ impl LayoutBuilder {
.create("Trusted domains")
.route("/spam-allow")
.insert()
.create("Blocked domains")
.route("/spam-block")
.insert()
.create("DMARC domains")
.route("/spam-dmarc")
.insert()
Expand All @@ -519,7 +531,7 @@ impl LayoutBuilder {
.insert()
.insert()
// Sieve Scripting
.create("Sieve Scripting")
.create("Scripting")
.icon(view! { <IconCodeBracket/> })
.create("Settings")
.route("/sieve-settings/edit")
Expand Down
8 changes: 1 addition & 7 deletions src/pages/config/schema/authentication.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ impl Builder<Schemas, ()> {
})
.input_check([], [Validator::Required])
.build()
.new_field("authentication.fail2ban")
.label("Ban rate")
.help("The maximum number of failed login attempts before the IP is banned")
.typ(Type::Rate)
.default("100/1d")
.build()
.new_field("authentication.rate-limit")
.label("Limit rate")
.help(concat!(
Expand Down Expand Up @@ -93,7 +87,7 @@ impl Builder<Schemas, ()> {
.build()
.new_form_section()
.title("Security")
.fields(["authentication.rate-limit", "authentication.fail2ban"])
.fields(["authentication.rate-limit"])
.build()
.build()
// OAuth
Expand Down
29 changes: 29 additions & 0 deletions src/pages/config/schema/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,35 @@ impl Builder<Schemas, ()> {
.list_fields(["_id"])
.no_list_action(Action::Modify)
.build()
// Fail2ban settings
.new_schema("fail2ban")
.new_field("server.fail2ban.authentication")
.label("Auth failures")
.help("The maximum number of failed login attempts before the IP is banned")
.typ(Type::Rate)
.default("100/1d")
.build()
.new_field("server.fail2ban.invalid-rcpt")
.label("Brute force")
.help("The maximum number of brute force attempts before the IP is banned")
.typ(Type::Rate)
.default("35/1d")
.build()
.new_field("server.fail2ban.loitering")
.label("Loitering")
.help("The maximum number of loitering disconnections before the IP is banned")
.typ(Type::Rate)
.default("150/1d")
.build()
.new_form_section()
.title("Fail2ban settings")
.fields([
"server.fail2ban.authentication",
"server.fail2ban.invalid-rcpt",
"server.fail2ban.loitering",
])
.build()
.build()
// Clustering
.new_schema("cluster")
// Cluster node ID
Expand Down
Loading

0 comments on commit e042f8a

Please sign in to comment.