Skip to content

Commit

Permalink
v0.1.10
Browse files Browse the repository at this point in the history
  • Loading branch information
mdecimus committed Aug 8, 2024
1 parent 626b072 commit 1b1aae2
Show file tree
Hide file tree
Showing 8 changed files with 248 additions and 88 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

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

## [0.1.10] - 2024-08-08

## Added
- Metrics configuration.
- HTTP endpoint access controls.

### Changed

### Fixed
- Unfiltered data store select options on SQL directory creation (fixes #17).

## [0.1.9] - 2024-08-01

## Added
Expand Down
74 changes: 27 additions & 47 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion 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.9"
version = "0.1.10"
edition = "2021"
resolver = "2"

Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ pub fn build_schemas() -> Arc<Schemas> {
.build_tls()
.build_server()
.build_listener()
.build_tracing()
.build_telemetry()
.build_smtp_inbound()
.build_smtp_outbound()
.build_mail_auth()
Expand Down
7 changes: 7 additions & 0 deletions src/pages/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,10 @@ impl LayoutBuilder {
.create("Network")
.route("/network/edit")
.insert()
// HTTP
.create("HTTP")
.route("/http/edit")
.insert()
// System
.create("System")
.route("/system/edit")
Expand Down Expand Up @@ -301,6 +305,9 @@ impl LayoutBuilder {
.create("Logging & Tracing")
.route("/tracing")
.insert()
.create("Metrics")
.route("/metrics/edit")
.insert()
.create("Webhooks")
.route("/web-hooks")
.insert()
Expand Down
17 changes: 17 additions & 0 deletions src/pages/config/schema/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ pub const V_QUEUE_NOTIFY_NUM: &str = "notify_num";
pub const V_QUEUE_EXPIRES_IN: &str = "expires_in";
pub const V_QUEUE_LAST_STATUS: &str = "last_status";
pub const V_QUEUE_LAST_ERROR: &str = "last_error";
pub const V_URL: &str = "url";
pub const V_URL_PATH: &str = "url_path";
pub const V_HEADERS: &str = "headers";
pub const V_METHOD: &str = "method";

pub const CONNECTION_VARS: &[&str] = &[
V_LISTENER,
Expand All @@ -52,6 +56,19 @@ pub const CONNECTION_VARS: &[&str] = &[
V_PROTOCOL,
V_TLS,
];
pub const HTTP_VARS: &[&str] = &[
V_LISTENER,
V_REMOTE_IP,
V_REMOTE_PORT,
V_LOCAL_IP,
V_LOCAL_PORT,
V_PROTOCOL,
V_TLS,
V_URL,
V_URL_PATH,
V_HEADERS,
V_METHOD,
];
pub const RCPT_DOMAIN_VARS: &[&str] = &[V_RECIPIENT_DOMAIN];
pub const SMTP_EHLO_VARS: &[&str] = &[
V_LISTENER,
Expand Down
78 changes: 49 additions & 29 deletions src/pages/config/schema/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

use crate::core::schema::*;

use super::{tracing::EVENT_NAMES, CONNECTION_VARS};
use super::{tracing::EVENT_NAMES, HTTP_VARS};

impl Builder<Schemas, ()> {
pub fn build_server(self) -> Self {
let connect_expr = ExpressionValidator::new(CONNECTION_VARS, &[]);
let http_expr = ExpressionValidator::new(HTTP_VARS, &[]);

self.new_schema("network")
// Default hostname
Expand All @@ -34,20 +34,59 @@ impl Builder<Schemas, ()> {
)
.default("8192")
.build()
// Network fields
.add_network_fields(false)
// Forms
.new_form_section()
.title("Network settings")
.fields([
"lookup.default.hostname",
"server.max-connections",
"server.proxy.trusted-networks",
])
.build()
.new_form_section()
.title("Socket options")
.fields([
"server.socket.backlog",
"server.socket.ttl",
"server.socket.linger",
"server.socket.tos",
"server.socket.send-buffer-size",
"server.socket.recv-buffer-size",
"server.socket.nodelay",
"server.socket.reuse-addr",
"server.socket.reuse-port",
])
.build()
.build()
// HTTP settings
.new_schema("http")
// HTTP base URL
.new_field("server.http.url")
.label("Base URL")
.help("The base URL for the HTTP server")
.typ(Type::Expression)
.input_check(
[],
[
Validator::Required,
Validator::IsValidExpression(connect_expr),
],
[Validator::Required, Validator::IsValidExpression(http_expr)],
)
.default("protocol + '://' + key_get('default', 'hostname') + ':' + local_port")
.build()
// HTTP endpoint security
.new_field("server.http.allowed-endpoint")
.label("Allowed endpoints")
.help(concat!(
"An expression that determines whether access to an endpoint is allowed. ",
"The expression should an HTTP status code (200, 403, etc.)"
))
.typ(Type::Expression)
.input_check(
[],
[Validator::Required, Validator::IsValidExpression(http_expr)],
)
.default("200")
.build()
// Use X-Forwarded-For
.new_field("server.http.use-x-forwarded")
.label("Obtain remote IP from Forwarded header")
Expand Down Expand Up @@ -85,39 +124,20 @@ impl Builder<Schemas, ()> {
.typ(Type::Array)
.input_check([Transformer::Trim], [])
.build()
// Network fields
.add_network_fields(false)
// Forms
.new_form_section()
.title("Network settings")
.fields([
"lookup.default.hostname",
"server.max-connections",
"server.proxy.trusted-networks",
])
.build()
.new_form_section()
.title("HTTP Settings")
.fields([
"server.http.url",
"server.http.headers",
"server.http.hsts",
"server.http.use-x-forwarded",
"server.http.permissive-cors",
])
.build()
.new_form_section()
.title("Socket options")
.title("HTTP Security")
.fields([
"server.socket.backlog",
"server.socket.ttl",
"server.socket.linger",
"server.socket.tos",
"server.socket.send-buffer-size",
"server.socket.recv-buffer-size",
"server.socket.nodelay",
"server.socket.reuse-addr",
"server.socket.reuse-port",
"server.http.allowed-endpoint",
"server.http.hsts",
"server.http.permissive-cors",
])
.build()
.build()
Expand Down
Loading

0 comments on commit 1b1aae2

Please sign in to comment.