Commit Graph
142 Commits
Author SHA1 Message Date
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 ca76931f06 Allow configurable mailbox user display-name editing (#1177)
add config setting edit_mailbox_name which can be set to allow users to change their name. 

https://github.com/postfixadmin/postfixadmin/issues/1176#issuecomment-6061535053

Thanks @TrapoSAMA & @pvdv
2026-10-15 19:23:51 +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 8c6057b54b Distinguish mailbox and domain quota validation errors (#1096)
- distinguish the per-mailbox maximum quota error from insufficient remaining domain quota
- add the domain-quota error message to every language catalog

Thanks @TrapoSAMA
2026-08-02 10:15:08 +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
Kent Riboe 2c0a06f932 Add Exec class to help refactor/reduce duplication of proc_open calls, update phpunit (see note) (#1009)
* 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
2026-04-18 10:05:35 +01:00
Kent Riboe 291609ae6f Add phpstan, MySQL and PostgreSQL test jobs to CI (#1005)
* Add phpstan for static analysis.
* Run unit tests against MySQL and PostgreSQL databases

Thanks @knofte
2026-04-06 09:01:44 +01:00
David Goodwin cb91ae64f2 formatting 2026-02-28 16:41:45 +00:00
Fredrik Boström 902739f96d WIP: TOTP reset for lost secrets (#988)
add TOTP reset for lost secrets - see #924
2026-02-28 10:15:07 +00:00
David Goodwin b092017f9b be more explict over what types class properties should be 2026-01-28 09:50:26 +00:00
David Goodwin ff0a3d7636 psalm stuff, add Languages class, token refactor 2026-01-28 09:50:26 +00:00
David Goodwin 52794bede7 misc fixes for psalm after allowing it to be updated 2026-01-28 09:50:26 +00:00
David Goodwin 7f1d78e2cd fix issues from merging #958 - no longer provide smtp_password to smtp_mail(..) call, as it does it internally now 2026-01-01 13:40:17 +00:00
David Goodwin 0d5edbf099 move pacol() into PFAHandler class, I think it makes more sense for it to be there given the dependency between the two 2025-07-13 10:12:22 +01:00
David Goodwin 798e8b269c Topt app passwords fixes (WIP) (#805)
various improvements to the TOTP code see also:  #802
2025-05-16 20:31:20 +01:00
David Goodwin 24b3b12581 MailboxHandler: change mailbox_postcreation_hook and maildir_name_hook CONF callable check to use is_callable() and not is_string() && function_exists() - this should allow someone to define a PHP 7+ style anonymous function within their config, add unit test to illustrate behaviour etc
see also #869 and #812
2024-11-12 20:12:53 +00:00
Gianluca Giacometti 5bcfc0f613 Fix typo (#867)
typo fix in config file for mailbox_postcreation_hook; thanks @gianlucagiacometti
2024-11-11 08:54:35 +00:00
David Goodwin 25bab8d7a2 code formatting 2024-11-09 14:47:28 +00:00
Gianluca Giacometti bfebea5f3c Create new_mailbox_hook function (#864)
* Add new postcreate mailbox hook ( mailbox_postcreation_hook ) - which can be called after a mailbox is created (similar to mailbox_postcreation_script). 

Thanks @gianlucagiacometti !
2024-11-09 08:23:26 +00:00
Gianluca Giacometti 9b169e27f9 smtp_active should be a checkboox (#861) 2024-11-05 19:08:26 +00:00
David Goodwin f01274ec94 try relaxing composer dependencies to allow php8.2 dev support, reformat so composer format passes 2024-04-22 21:02:01 +01:00
David Goodwin d3dfe6382b fix syntax error added in 4ae78cd172 and #823 2024-04-22 21:00:12 +01:00
Nuno TavaresandNuno Tavares 4ae78cd172 dont assume 'quota' will be in the values, just like block before wasn't assuming (#823)
Co-authored-by: Nuno Tavares <n.tavares@portavita.eu>
2024-04-22 08:35:55 +01:00
David Goodwin 279e7f682d underlying db field is set to an int (for mysql and pgsql), pgsql does not cope with t/f being set for an inty field, so change the model definition .... - see #814 2024-04-07 19:37:41 +01:00
David Goodwin 62a76734c9 see #812 - remove config options for create_mailbox_subdirs_* due to the php-imap module being deprecated; leave in an error_log message to perhaps avoid future support tickets asking why this does not work 2024-04-01 19:38:31 +01:00
David Goodwin 81a1d45617 drop use of the deprecated PHP imap extension (php-imap) - see #472 and #812 2024-04-01 19:32:47 +01:00
John Fawcett 668960ccf6 Add a flag to mailbox table for enable/disable smtp protocol. The table column name
is "smtp_active". This enables use of this flag instead of active flag for postfix
mysql queries. There is a new configuration parameter $CONF['smtp_active_flag'] =
YES or NO, which defaults to NO, providing the existing behaviour. When set to YES
the active_smtp field is displayed in the edit mode and can be modified.
The commit includes update to the language files and documentation.

The commit does not include the code to add the field to existing installs,
which I presume can be added during the release cycle in upgrade.php along the
lines of:

_db_add_field('mailbox',  'smtp_active', 'int DEFAULT 1');
2024-01-09 20:50:49 +01:00
Fredrik Boström ea121c721b Add Alert() about illegal character in username 2023-09-26 15:27:24 +02:00
Fredrik Boström 7b8532b2b0 Add javascript check for illegal characters in username
Signed-off-by: Fredrik Boström <fredrik.bostroem@verdigado.com>
2023-09-26 14:12:33 +02:00
David Goodwin 8cc19b0adf add @todo for php-imap.com - see also #656 2022-10-12 20:28:53 +01:00
David Goodwin 2d6ded2786 PSR2 -> PSR12 formatting 2022-06-28 13:46:11 +01:00
Oliver Cooper b4028bd309 Add Mailbox quota translations 2022-02-13 18:01:36 +00:00
BotoX 768f2ee844 Improve dovecot mail-crypt postpassword script security (pipe password instead of passing on cmdline)
Suggested from: https://github.com/postfixadmin/postfixadmin/issues/441#issuecomment-774736944
2021-06-13 12:24:27 +02:00
Valery Kartel ae0d9436b5 Update MailboxHandler.php 2021-06-02 13:13:40 +03:00
David Goodwin 2edabc3e03 phpcs insists on some brace changes 2021-04-13 21:19:16 +01:00
David Goodwin 823f27b29d phpcs wants to change ... 2021-03-22 09:28:28 +00:00
David Goodwin 9700a3a9c9 fix psalm : bool -> int 2021-02-18 21:19:56 +00:00
David Goodwin 336259957d Merge remote-tracking branch 'origin/postfixadmin_3.3' 2021-01-25 21:58:31 +00:00
David Goodwin 34e0367a0b check if config option exists and do not require it is a string - see https://github.com/postfixadmin/postfixadmin/issues/437 2021-01-25 17:00:04 +00:00
David Goodwin 23cec95153 fix php8 moaning about string vs int 2021-01-18 20:49:49 +00:00
David Goodwin e8acde751f fix php8 moaning about string vs int 2021-01-18 20:46:11 +00:00
BotoX c6ae3ea2f3 Suport for dovecot mail-crypt-plugin via new mailbox_postpassword_script hook.
Uses doveadm mailbox cryptokey on create user / password change to adjust user encryption key.
https://doc.dovecot.org/configuration_manual/mail_crypt_plugin/
2021-01-11 21:07:45 +01:00
David Goodwin b8fa60bb8a more type hints / psalm fixes 2020-09-28 20:33:54 +01:00
David Goodwin b868f950bf refactor Login stuff out of Handler classes into Login... add tests 2020-09-25 21:32:53 +01:00
David Goodwin 3c7da4f3b8 Refactor some methods
PFAHandler::store() -> PFAHandler::save();
 PFAHandler::storemore() -> PFAHandler::postSave();
 PFAHandler::beforestore() -> PFAHandler::preSave();
2020-09-25 21:29:45 +01:00
David Goodwin 3d46ec7959 revert: 1d1960a476 - see https://github.com/postfixadmin/postfixadmin/issues/384 2020-09-12 21:04:18 +01:00
David Goodwin bbf41c7acc formatting 2020-06-02 12:59:47 +01:00
David Goodwin 864065cd37 fix MailboxHandler -> adding mailbox with empty quota field 2020-05-15 20:30:31 +01:00
David Goodwin d81363541a fix psalm 2020-03-18 21:03:27 +00:00
David Goodwin 338fb8c564 Fix quota storage; see https://github.com/postfixadmin/postfixadmin/issues/342 2020-03-18 14:36:53 +00:00