366 Commits
Author SHA1 Message Date
Rodrigo Cortés Cano 907117b4b8 Queue broadcast messages for background sending (#1054)
When doing a broadcast message, create a list of pending recipients in new db tables, and processes each message in turn. Jobs can be cancelled/retried. Locking is in place to try and stop multiple concurrent jobs being run. 

Adds db tables: broadcast_job, broadcast_job_domain and broadcast_recipient. 

thanks @TrapoSAMA
2026-11-20 20:20:34 +00:00
vibpe 7a1eb67db2 Send the 419 status with a reason phrase so Apache does not answer 500 (#1209)
Fixes #1208 - add reason phrase with http 419 response (used with  invalid or missing CSRF token is answered with the "Session expired"), otherwise Apache returns a http 500 response instead.

thanks @vibpe
2026-11-20 13:56:53 +00:00
Rodrigo Cortés Cano 1eaaecfcbc Show configured MFA status and add CLI reset commands (#1196)
The administrator list shows a translated Yes/No MFA column immediately after Active. 
Domains display an MFA badge only when at least one mailbox has a configured secret. 

Add resetmfa task for the postfixadmin-cli command. ( postfixadmin-cli admin resetmfa <address> and
postfixadmin-cli mailbox resetmfa <address> )

thanks @TrapoSAMA
2026-11-18 13:22:21 +00:00
Rodrigo Cortés Cano bff07294dd Add daily Vacation choice and optional INI reply intervals (#1189)
Update vacation interval selection and support readable choice names 

thanks @TrapoSAMA
2026-11-12 19:57:12 +00:00
Rodrigo Cortés Cano 07b9d500fe FIX: Complete search and account-form follow-ups from #1165 (#1188)
thanks @TrapoSAMA
2026-11-12 19:39:49 +00:00
Rodrigo Cortés Cano b14e323af7 Add Cancel navigation to create/edit forms and mail composers (#1181)
Create and edit forms currently lack a Cancel action, making administrators and mailbox users rely on browser navigation or menus to abandon changes. The individual and broadcast mail composers have the
same gap.

thanks @TrapoSAMA
2026-11-01 10:44:23 +00:00
Rodrigo Cortés Cano 3feeb081af Escape security lists and make template escaping opt-outs explicit (#1172)
fixes potential XSS issue with TOTP exception lists (which need escaping, see also #1185). 

refactors Template escaping to use TemplateEscape enum (rather than the previous boolean).

thanks @TrapoSAMA
2026-11-01 10:41:54 +00:00
Jean-Francois Jauvin 06e3af5fe0 Fix session warnings in setup.php (#1183)
Move `<!DOCTYPE html>` below the opening PHP block in `public/setup.php`
so `common.php` initializes the session and sends headers before any
HTML output.

thanks @jfjauvin
2026-10-27 09:37:45 +00:00
David Goodwin ae85e51f6e Security fixes (master only) (#1165)
Someone wishing to remain anonymous emailed @cboltz a number of security issues, summarised below.

1. fix sql injection bug in getPageBrowser - search keys bypass the field filter, due to 2a6f27c3 / #1127
2. when performing a password change, do not start the session before the new password has been validated for compexity etc - as things stand someone with a recovery code gets logged in even if their password gets
rejected. Also invalid recovery code on failure.
3. broadcast-message.php was using smtp_mail() with incorrect args, and passing the SMTP password in as the mail body. - probably related to commit 7f1d78e and 42a664e9c2
4. a regular (non-admin) user could submit an arbitrary username in the POST data and create/edit a TOTP exception for another user or entire domain

PR includes refactoring of the password change code (into PasswordChangeAttempt) to make it easier to test/verify.
2026-10-17 09:27:59 +01:00
Rodrigo Cortés Cano 8995ee7b55 Support multiple recipient delimiters (#1178)
- treat recipient_delimiter as a set of alternative characters, matching Postfix semantics
- centralize recipient-extension removal so alias status and mailbox classification cannot diverge
- restrict delimiter matching to the local part and document multi-character configuration
- add focused unit and alias-status regression coverage

See #1143
Thanks @TrapoSAMA
2026-10-15 19:26:09 +01:00
Rodrigo Cortés Cano 01747fda26 Revoke stale XML-RPC authorization across web login and MFA (#1173)
Stop someone sharing a session cookie between xmlrpc and normal logins, and using it to avoid TOTP auth. 

thanks @TrapoSAMA
2026-10-13 17:10:21 +01:00
Rodrigo Cortés Cano ff0ae9ddbe Clarify alias destination status indicators (#1150)
Alias destinations absent from local records previously shared the misleading “maybe UNDELIVERABLE” indicator, including valid external addresses such as Gmail. The indicator now distinguishes “Check local destination” (red) from “External destination” (blue), with short explanatory tooltips. An alias with both kinds of destinations can show
both indicators.


thanks @TrapoSAMA
2026-10-03 11:20:28 +01:00
David Goodwin 2c05ff950c Totp fixes (#1153)
Wenhao Wu emailed with the following security report, this affects master and postfixadmin-4.0.

High — mailbox takeover of mail flow for a 2FA-enrolled account by a password holder. CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N ≈ 8.1 (PR:L models possession of the first factor; impact is limited to the attacker's own mailbox account). CWE-308 (Use of Single-Factor Authentication with Two Factors), secondary CWE-287. Not related to the fixed TOTP-exception issue #1014.

....
With `$CONF['totp']='YES'` and a mailbox that has TOTP enrolled, logging in with **only the mailbox password** creates an MFA-incomplete session (`username` set, `roles=[]`, `mfa_complete=false`) that is parked at `users/login-mfa.php`. That half-session cannot open `users/main.php` (it has no `user` role), but `public/edit.php` never checks MFA completion:

- `public/edit.php:30` — `authentication_get_username()` (comment "enforce login") treats any session with a username as logged in; it never calls `authentication_mfa_incomplete()`.
- `public/edit.php:57-63` — for a non-admin session with a handler that has `user_hardcoded_field`, `require_role('admin')` is skipped entirely.
....

Wenhao Wu, Southeast University

thanks @d3do-23 (@cboltz and TrapoSAMA for reviewing etc)
2026-09-26 09:39:53 +01:00
David Goodwin 63ef208055 see #1162 - avoid passing null into explode(), thanks @danielsdadm-commits 2026-09-26 09:24:27 +01:00
Rodrigo Cortés Cano 24c51277c2 Show inactive domain DNS status in overview (#1146)
Show DNS status for domains to administrators.
Adds new config setting domain_dns_status_check ( 0 - disabled, 1 authoritative zone, 2 usable MX ) 

Document installation, an optional CLI/cron command, permissions, networking, timeouts, and saved-result semantics.

thanks @TrapoSAMA
2026-09-19 15:04:21 +01:00
Rodrigo Cortés Cano d56a05d862 Replace list-virtual cNav_bar with shared pagination (#1093)
This is the second step of #1064, following #1090.

- replace `list-virtual.php`'s `cNav_bar` HTML renderer with normalized items for the shared `templates/_pagination.tpl` 
- preserve the selected domain and nested search parameter in every page link
- use stable `#aliases` and `#mailboxes` anchors for the two independently rendered lists
- render the same accessible Bootstrap 5 pagination above and below each list 
- remove the now-unused `arrow-l.png`, `arrow-r.png`, and `arrow-u.png` assets
2026-09-16 14:52:53 +01:00
Rodrigo Cortés Cano d92137719d Require reauthentication for TOTP removal (#1129)
- require a completed user or admin role before opening TOTP management
- remove TOTP through the existing password-verifying change path
- keep configured post-change hooks active when a secret is removed
- add regression coverage proving an invalid password cannot remove the stored secret

This is the first focused change for #1128.

thanks @TrapoSAMA
2026-09-02 20:23:26 +01:00
Rodrigo Cortés Cano 2c8a8893e9 Enforce TOTP policy for XML-RPC login (#1131)
if a user/mailbox has TOTP enabled, block access via XMLRPC (if it's enabled) as the two aren't compatible.

Part of #1128.

thanks @TrapoSAMA
2026-08-29 20:07:23 +01:00
Rodrigo Cortés Cano 2a6f27c3c4 Use shared pagination in generic lists (#1127)
Extend bootstrap pagination to list.php

#1090, #1093, and this PR cover all three pagination surfaces tracked in #1064.

thanks @TrapoSAMA
2026-08-29 15:09:23 +01:00
Rodrigo Cortés Cano e638095d58 Harden password recovery requests (#1130)
Require a validated canonical site_url for recovery links, keep responses uniform, and persist a five-minute per-account request limit.

The token update is atomic across supported database engines and performs the same password hashing work for unknown accounts.

Refs #1128

thanks @TrapoSAMA
2026-08-29 14:55:49 +01:00
Rodrigo Cortés Cano 314a3242c9 Escape viewlog output by default (#1134)
Render log records through the default output sanitization path and
remove the inline JavaScript interpolation of log data.

Full log data remains available through a native details element without
placing it in a script context.

Refs #1128

thanks @TrapoSAMA
2026-08-29 14:51:41 +01:00
Rodrigo Cortés Cano ab0a4d1357 Fix password expiration handling and visibility (#1109)
- validate domain password-expiration policies as whole numbers from 0 through 36500 days
- make password expiration optional and disabled by default
- make 0 consistently mean that passwords in the domain do not expire
- align administrator, recovery, mailbox-user, and XML-RPC password changes
- show each mailbox password-expiration state in lists and CSV output
- add the new labels to every language file
- document how to enable the feature in `config.local.php`

thanks @TrapoSAMA
2026-08-10 09:19:35 +01:00
Rodrigo Cortés Cano 875113f305 Improve form focus and TOTP input semantics (#1105)
- use a softer, consistent primary-blue focus treatment for standard
data-entry controls
- identify TOTP inputs as one-time codes and request numeric keyboards
on supported devices
- keep TOTP digits visible while they are entered
- fix the TOTP setup input ID so its label points to the actual control

thanks @TrapoSAMA
2026-08-10 09:09:08 +01:00
Rodrigo Cortés Cano bf47bddc9c Update Bootstrap Icons to 1.13.1 (#1095)
Update bootstrap icons to 1.13.1 (was 1.11.3); thanks @TrapoSAMA
2026-07-28 09:36:32 +01:00
Rodrigo Cortés Cano ab94193611 Update Bootstrap to 5.3.8 (#1094)
upgrade from bootstrap 5.3.0 to 5.3.8
2026-07-28 09:32:23 +01:00
Rodrigo Cortés Cano 4a38010594 Make 3.3 schema reconciliation retry-safe (#1092)
fix regression in MySQL schema upgrade from 3.3 where vacation.domain, vacation.email and quota2.username had the wrong collation.

thanks @TrapoSAMA + @Knofte
2026-07-28 09:27:38 +01:00
Kent Riboe 00622a1155 Add reusable _pagination.tpl partial, use it in viewlog (#1064) (#1090)
adds templates/_pagination.tpl - bootstrap 5 shared pagination component. 
migrates viewlog to use it.

See  #1064 (thanks @TrapoSAMA and @Knofte)
2026-07-27 19:14:24 +01:00
mkocustos 513542370d Let admins store a default for the alias "To" (goto) field (#1061)
adds new db table admin_preferences to store a default goto for aliases etc, which when populated will prefil the forward form with that value.


thanks @mkocustos
2026-07-25 10:56:40 +01:00
Rodrigo Cortés Cano 9a930b61ad Add a read-only database integrity check to setup.php (#1091)
attempt to highlight any orphaned data, see also https://github.com/postfixadmin/postfixadmin/issues/972

thanks @TrapoSAMA
2026-07-24 09:09:03 +01:00
Rodrigo Cortés Cano 755f6c3990 Reconcile 3.3 MySQL upgrades on master (#1089)
fix regression in MySQL database update order. See #971

thanks @TrapoSAMA and @csware
2026-07-23 09:31:31 +01:00
Rodrigo Cortés Cano 3ab0104d1a Address forwarding editor review feedback 2026-07-22 18:13:16 +00:00
Rodrigo Cortés Cano 9a9078ce21 Unify user and admin forwarding editor 2026-07-22 18:13:16 +00:00
Rodrigo Cortés Cano 10a76e8773 Preserve anonymous login sessions across repeated GETs (#1085)
Restrict recreating $_SESSION to only those where the user has been logged in previously; this should help stop anonymous users from failing a CSRF check.

thanks @TrapoSAMA
2026-07-22 08:52:33 +01:00
David Goodwin 7388aa17bd fix psalm annoyances 2026-07-07 21:27:27 +01:00
David Goodwin 94d8ffcf78 squash merge #1058 - add the ability to bulk delete forwards from the alias list, thanks @knofte
see https://github.com/postfixadmin/postfixadmin/pull/1058
2026-07-07 21:22:33 +01:00
Kent Riboe a400db12dc Add active-status filter to the alias (forwards) list (#1038) (#1056)
Adds a **Forward status: All / Active / Inactive** selector above the
alias (forwards) list in the domain overview (`list-virtual.php`). 

see #1038, thanks @knofte
2026-07-07 20:44:43 +01:00
Kent Riboe 0f68dee15c viewlog: per-page selector + Bootstrap 5 pager, fix footer layout (#1062) (#1063)
Improve pagination on viewlog page (make page size configurable, use bootstrap 5 pager) 

Closes #1062. Thanks @knofte
2026-07-05 20:21:19 +01:00
Rodrigo Cortés Cano 43fbf7e56b UI improvements for virtual form labels and search spacing (#1052)
small UI and translation fixes for virtual/admin forms.

Changes:

- Adds PALANG entry for the domain search placeholder.
- Replaces the hardcoded domain search placeholder in edit forms.
- Shows the Domain label when creating aliases and mailboxes.
- Uses Bootstrap 5 form-select for generated select controls.
- Adds minor spacing for the virtual search field.

Thanks @trapoSAMA
2026-07-03 18:33:55 +01:00
Rodrigo Cortés Cano 42fd9870d4 Improve invalid CSRF token response page (#1067)
Improve CSRF invalid error page

- Replaces the raw hardcoded error with localized PALANG text. 
- Provides a simple Continue link back to main.php

Related to the 4.0 branch fix in PR #1055.
2026-07-03 18:31:55 +01:00
Kent Riboe d6aabd7745 viewlog: add "All domains" option to the log viewer (#1059) (#1060)
Adds an **"All domains"** option to the View Log domain dropdown, so an
admin managing many domains can see log entries across all of them in
one view instead of picking each domain individually.

Closes #1059.

Thanks @knofte
2026-07-01 16:22:21 +01:00
Rodrigo Cortés Cano 730ddcb909 Improve virtual list responsiveness and quota tooltip (#1050)
This PR includes two small UI improvements:

* Add horizontal scroll wrappers to virtual mailbox/alias lists so
action buttons and table content do not overflow narrow desktop/tablet
widths.
* Add a domain quota tooltip showing assigned quota and real used quota,
while preserving the existing visible assigned quota text and
usage-based bar color.
  
Tested locally with PHP lint for DomainHandler.php.

thanks @trapoSAMA
2026-06-28 08:49:53 +01:00
David Goodwin ff73976b72 UI enhancements around quota and icons for domain/mailbox lists
various patches from @trapoSama sent via email -

* Keeps the assigned domain quota text and uses real mailbox usage for
the quota bar color and fill.
* Shows a red count next to a domain when one or more mailboxes exceed
the configured quota alert threshold. Requires patch 1.
* Adds optional configuration to hide mailbox quota and password expiry
columns while retaining those values in the domain tooltip.
 * Corrects the quota-bar markup and aligns domain-list columns.
* Replaces the quota bars in the domain overview and mailbox list with a
unified bar component, preventing the fill, label, and border from
separating. It hides Modified, Backup MX, and Transport progressively on
reduced desktop widths, then uses horizontal scrolling as the final
fallback. 
* Uses icon-only controls with translated tooltips in domain and mailbox
lists: active state, SMTP active state, autoresponder, alias, edit, and
delete. Active-state tooltips show the current value, for example
`Activo: SI` or `Activo: NO`.
2026-06-27 16:22:33 +01:00
Rodrigo Cortés Cano e0067e4138 Improve top menu and main dashboard labels (#1047)
- Use context-specific top menu labels instead of reusing the first dropdown
item label.
- Compact the Bootstrap 5 top navbar spacing and switch collapse to xl to avoid wrapping on desktop widths.
- Move hardcoded main dashboard/search labels into PALANG entries, including Spanish
translations

thanks @TrapoSAMA
2026-06-26 08:54:08 +01:00
Justin Warren 2469e045d8 Add 'description' field to alias and alias_domain tables. (#1042)
Adds a `description` field to the `alias` and `alias_domain` tables, so you can add a comment explaining why the alias exists.

Partially addresses #1036

thanks @jpwarren
2026-06-08 09:08:02 +01:00
David Goodwin 8696f300c5 formatting 2026-05-23 15:10:25 +01:00
Fredrik Boström 1024befd39 Fix pw recovery without totp (#1032)
Check if user has TOTP active, if so display input field in pw-change form and evaluate it.
2026-05-23 14:34:42 +01:00
Copilot ae7339afd4 Use native booleans for prepared SQL params; stop binding db_get_boolean() values (#1019)
Prepared statements were binding DB-specific boolean literals (`'t'/'f'`) produced by `db_get_boolean()`, which breaks PostgreSQL parameter typing in some paths (notably mailbox creation via handler flows). 

This change standardizes bound boolean parameters to native PHP `true`/`false` (which are then cast to 0/1 which seems to work fine within PDO/PostgreSQL).

fixes https://github.com/postfixadmin/postfixadmin/issues/1017
2026-04-23 19:28:01 +01:00
Kent Riboe c6773f8390 Migrate TOTP exceptions to TotpexceptionHandler class (#1007)
refactor code to use the PFAHandler approach, allowing re-use of list.php and edit.php.
2026-04-18 10:22:54 +01:00
Kent Riboe e546e6d593 Fix privilege check ordering for TotpPf::addException (global admin being treated like admin) (#1012)
* Fix privilege check ordering in TotpPf::addException() (#1012)

Global admins were incorrectly downgraded to regular admins because
authentication_has_role('admin') was checked before 'global-admin',
and global admins have both roles. Reorder to check global-admin first.

* Add missing isset() check on $_GET['abort'] in users/login-mfa.php (#1013)

Matches the admin version at public/login-mfa.php which already has
the isset() check.
2026-04-14 21:17:03 +01:00
Kent Riboe 0f9f67be0f Add missing database indexes for domain_admins and fetchmail (#1010)
* Add missing database indexes for domain_admins and fetchmail (see #972)

Adds composite index on domain_admins(username, domain, active) for
permission checks that run on every admin operation, and index on
fetchmail(mailbox) for domain deletion cascades.
2026-04-09 09:24:57 +01:00