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
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.
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
Users changing their mailbox password currently hit an unprefixed `mailbox` table lookup when `database_prefix` is configured, causing the password change to fail even though authentication succeeds.
Fixes: #1154
thanks @masterblaster79
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
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
- 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
- distinguish the per-mailbox maximum quota error from insufficient remaining domain quota
- add the domain-quota error message to every language catalog
Thanks @TrapoSAMA
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
Changes:
* Improve Spanish translations for mail, DKIM, logs, quota and Backup MX labels.
* Use a shorter domain-list quota label while keeping the full domain quota label in edit forms.
* Keep hidden domain-list values available in the domain tooltip without reusing form labels.
* Add explicit labels for max mailbox quota and unmanaged quota state.
Thanks @TrapoSAMA
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
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.
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
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`.
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
Implements the improvements suggested by @fredkilbourn in #1024, cleaned up for current master.
**Changes:**
1. **Auto-generate RSA 2048 keypair** when creating a new DKIM key. Only
generates on the create form, not on list views or edits.
2. **Descriptive signing table dropdown** shows `domain:selector
(description) [id]` instead of just the numeric ID.
3. **Domain:Selector and Description columns** in the signing table list
view via LEFT JOIN.
4. **Order by domain:selector** instead of raw dkim_id.
**Technical notes:**
- Uses `$this->new` check to avoid key generation overhead on list/edit
views
- Handles MySQL (`CONCAT()`) vs SQLite/PostgreSQL (`||`) string
concatenation
- Uses named arguments for `pacol()` per current conventions
Two separate commits. Credit to @fredkilbourn for the original patch.
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
Add DOCUMENTS/HANDLER_CLASSES.md which attempts to document how the Handler classes work and help future developers/contributors.
Changes spec of PFAHandler::pacol() to discourage the 9th parameter (was: multiopt) from being passed as an array (param renamed to not_in_db). Previous behaviour is maintained, but a deprecation error should be triggered.
* code refactoring (adds Exec class to centralise proc_open like calls).
* bump phpunit to ^11.0, as this is the last release that supports php8.2. Note, there is not (yet?) a phpunit release for php8.2 that fixes PKSA-z3gr-8qht-p93v or PKSA-5jz8-6tcw-pbk4, so ignore them for now in composer.json
* 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.
possible fix for https://github.com/postfixadmin/postfixadmin/issues/967
CSRF Token changes : rather than have one PFA_Token value in $_SESSION, store a list of them, where each value has a time stamp it was issued on. The aim is to allow the user to have multiple browser tabs open at once - and not have the last tab that loaded trample on others. Tokens expire after 1 hour.
Adds a Smarty helper function `{CSRF_Token}` which will output `<input type=hidden name=CSRF_Token value=asdf123>` or `{CSRF_Token type=url}` which outputs a literal string like 'asdf123' suitable for placing in a URL.
Adds a PHP exception handler in public/common.php, which could be used to display a more friendly error message/response (but at the moment is fairly minimal).
Removes most uses of `die()` within the codebase, and instead moves to throw an exception
* Upgrade to Bootstrap 5.3.0 with Bootstrap Icons
* token improvements to setup.php rendering
* improve backup page rendering
* move to use html5 datetime-local field for vacation from/to rather than the previous js version
* remove datetimepicker js and bootstrap js and jquery (no longer needed)
* vacation: we load any previous dates in from the database, these could include ancient dates, so default them to now and now+1 if they are before today
* drop bootstrap 3.4.1 css
* bootstrap - add light mode / dark mode switch - taken from https://github.com/404GamerNotFound/bootstrap-5.3-dark-mode-light-mode-switch