Commit Graph
477 Commits
Author SHA1 Message Date
Christian Boltz ba705d1a12 db_where_clause(): fix Exception message
... to mention the correct function name

(cherry picked from commit 047bf192fb)
2026-10-04 23:01:56 +02:00
Rodrigo Cortés Cano 6c7146d2ea Distinguish local and external alias destinations on 4.x (#1168)
Port the final merged behavior of #1150 to `postfixadmin_4.0`, completing the wording-only port in #1152 (discussion #886).

Alias destinations with no matching local record within the administrator's managed domains are marked red; destinations outside those domains are marked blue without inspecting another administrator's
records. Mixed destinations can show both indicators. 

thanks @TrapoSAMA
2026-10-03 14:58:25 +01:00
David Goodwin 77ccefdbf2 fix incomplete MFA logins having the ability to change state
when a user is part way through an MFA login (username/password auth done, but not the MFA bit),
authentication_get_username() will return their current username. This function is used in various other places
and historically it was a suitable check to determine if someone was also authenticated.

Commit updates authentication_get_username() to include a call to authentication_mfa_incomplete() by default, the only exclusion being on the login-mfa.php pages.

Thanks to Wenhao Wu (Southeast University) for the security report "MFA-incomplete (password-only) mailbox session can rewrite its own alias forwarding via /edit.php (CWE-308)"
2026-09-29 12:05:32 +00:00
Rodrigo Cortés Cano d1457da94f 4.x: improve alias destination status indicators (#1152)
Ports #1150 to `postfixadmin_4.0` and addresses discussion #886.

An alias destination absent from local records can be a valid external
address. Replace the misleading “maybe UNDELIVERABLE” label with
“Possible external destination” and add the short tooltip “Not listed as
a local destination.” English and Spanish wording matches #1150.

thanks @TrapoSAMA
2026-09-19 10:26:14 +01:00
Rodrigo Cortés Cano f29ac152fb 4.x: harden password recovery requests (#1136)
Require a validated canonical site_url for recovery links, keep responses uniform, and persist a five-minute per-account request limit.

This ports the behavior of PR #1130 while preserving PHP 7.4 compatibility and the 4.x database boolean handling.

Refs #1128

Thanks @TrapoSAMA
2026-09-02 20:29:26 +01:00
Rodrigo Cortés Cano 4a23d84ac4 4.x: enforce SMTP protocol state (#1138)
Improve SMTP (see smtp_mail()) - treat unexpected SMTP replies, incomplete writes, and failed TLS
negotiation as delivery failures. 

Refs #1128

thanks @TrapoSAMA
2026-09-02 20:15:54 +01:00
Rodrigo Cortés Cano 852e719183 4.x: fix legacy md5crypt compatibility (#1126)
- restore `md5crypt` as the PostfixAdmin 3.x-compatible alias for MD5-CRYPT
- verify stored unprefixed MD5-CRYPT, prefixed MD5-CRYPT, bcrypt, and SHA512 crypt hashes from their stored format
- document the canonical `MD5-CRYPT` setting, the legacy alias, and the 3.x upgrade implications

This addresses #1123 on `postfixadmin_4.0`. The `master` correction is in #1125 so each maintained branch can be reviewed and tested against its own PHP requirements.

thanks @TrapoSAMA
2026-08-29 15:11:10 +01:00
Rodrigo Cortés Cano e971465a5a pacrypt - be more tolerant of doveadm output (#1122)
- port the `doveadm pw` stderr and exit-status handling from #1121 to
`postfixadmin_4.0`
- preserve PHP 7.4-compatible syntax and the branch-specific password flow
- add the same portable regression coverage for password generation and verification

See #1119.

thanks @TrapoSAMA
2026-08-26 09:08:48 +01:00
Rodrigo Cortés Cano 6e93d57766 Fix password expiration handling and visibility on 4.x (#1110)
- port the password-expiration correction to `postfixadmin_4.0`
- make password expiration optional and disabled by default
- make 0 consistently mean that domain passwords do not expire
- validate whole-day policies from 0 through 36500
- align password-change paths and preserve the existing Login fallback
- show mailbox expiration states in lists and CSV output
- add the new labels to every 4.x language file
- document how to enable the feature in `config.local.php`

thanks @TrapoSAMA
2026-08-11 09:28:19 +01:00
Rodrigo Cortés Cano a1724aa59a Reconcile 3.3 MySQL upgrades on 4.x (#1088)
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 16:25:09 +01:00
Sven Strickroth 188f38f14c No need to specify charset in connection string and then set it explicitly using "SET NAMES" again
Backport of #969.

Signed-off-by: Sven Strickroth <email@cs-ware.de>
2026-01-25 11:22:53 +01:00
David Goodwin 5fb080f79b minor code refactoring (login / TotpPf) 2025-11-23 16:04:53 +00:00
David Goodwin d0372d4db1 token renames (a variable called SESSID_USERNAME makes me think it is reserved by PHP or something, which I do not think it actually is, so just user a more meaningful $username 2025-10-28 09:49:29 +00:00
Christian Boltz 4b20d2be2b Fix hardcoded table name mailbox_app_password
... which exploded when using custom table names.
2025-09-11 22:39:57 +02:00
David Goodwin 460c624275 remove more references to sourceforge 2025-07-13 18:29:37 +01: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 066d6d10a8 bump db min version 2025-07-12 19:28:39 +01:00
David Goodwin ab0f7897fd drop support for legacy 2a bcrypt variants as we do not support PHP before <= 5.3.7 any longer 2025-06-01 15:43:15 +01:00
David Goodwin b56d0082ff token refactoring 2025-06-01 15:42:50 +01:00
David Goodwin ace5624508 change generate_password() to allow for repeated characaters, which probably provides more entropy. 2025-06-01 15:42:09 +01:00
David Goodwin 06a2cda24b this should be a better PFA_Cookie random token value 2025-06-01 15:41:30 +01:00
David Goodwin 293e318200 remove unused/dead code 2025-06-01 15:39:56 +01:00
David Goodwin 65db542ad2 php type hint and phpdoc changes 2025-06-01 15:39:03 +01:00
David Goodwin 999bfcfc54 drop support for mysql_encrypt, given MySQL after 5.7 has dropped it and we had not wired it into the pacrypt() function anyway, try and improve docs in config.inc.php 2025-05-28 09:41: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 759304ecb8 apparently these all need reformatting 2024-12-05 14:33:41 +00:00
David Goodwin c32f344b9d formatting? 2024-05-31 19:27:12 +01:00
David Goodwin 519c934ed3 Add minimal cron job to remove old vacation alias records - see https://github.com/postfixadmin/postfixadmin/issues/832 2024-05-31 19:25:53 +01:00
David Goodwin 56dd787ce2 when going through password recovery, only wipe the recovery token after the user has updated their password
see https://github.com/postfixadmin/postfixadmin/issues/550
2024-05-17 22:02:01 +01: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
Shao Yu-Lung (Allen) 0876c368e4 feat: support Dovecot DIGEST-MD5 (#816)
Add support for dovecot DIGEST-MD5 auth (using : $CONF['pacrypt'] = 'dovecot:DIGEST-MD5') 

This also changes the pacrypt() function to take an optional 3rd argument (username). 
Thanks @bestlong
2024-04-12 09:57:19 +01:00
David Goodwin 45557a6ed4 code formatting fix 2024-01-11 08:57:27 +00:00
David Goodwin eda637df1a Merge branch 'master' into michaelkrieger-patch-1 2024-01-11 08:51:17 +00:00
David Goodwin 39e378c783 improve type hinting 2023-12-27 16:17:55 +00:00
David Goodwin 015d4ec9cd reindent / reformat; add type hints for some of the app password stuff; try and make sure someone can only remove their own app password (see revokeAppPassword() ) 2023-12-23 21:43:31 +00:00
David Goodwin 4d17aa6ef9 manaul merge in of verdigado:master (see #753) (MFA/TOTP support) 2023-12-23 17:05:52 +00:00
David Goodwin 2d540e1da7 give the language selector an id - see #736 - thanks @frzquerty 2023-06-23 21:11:09 +01:00
David Goodwin d99d1785b4 fix pacrypt() call - if we have passwords stored like $1$... they are PHP_CRYPT:MD5, and treating them as crypt does not work with dovecot 2023-03-09 21:59:35 +00:00
Thomas GALLIOU e53b5e8a58 Update functions.inc.php
$conf['encrypt'] = 'dovecot:CRAM-MD5'

never success !

function _pacrypt_dovecot() will be never used

See my propose to run with dovecot:CRYPT-METHOD
2023-02-20 19:44:13 +01:00
David Goodwin 65aea00a1f see https://github.com/postfixadmin/postfixadmin/issues/667 - re-use smtp_get_admin_email(), try and make sure there is a From: set in password recovery emails 2022-11-30 21:18:06 +00:00
David Goodwin 3017ea3f3c psalm fixes (drop safeserver() (not used), $_COOKIE always contains strings etc). 2022-10-12 20:52:49 +01:00
David Goodwin 73106712e0 min_password_length might be integer, so do not be too strict with it 2022-09-27 19:56:28 +01:00
David Goodwin 989a709ee5 see https://github.com/postfixadmin/postfixadmin/issues/647 - if configured for sha512.b64 but
we have a hash with a {MD5-CRYPT} prefix, support the MD5-CRYPT form to allow for migration.
2022-08-11 20:23:32 +01:00
David Goodwin 7e514eb6f0 composer format thinks this should change 2022-08-11 20:23:15 +01:00
David Goodwin 38549c48ad composer format 2022-07-17 21:16:47 +01:00
Adrien Crivelli a97771adfd Automatic code style fixes 2022-07-15 11:29:55 +02:00
David Goodwin 2d6ded2786 PSR2 -> PSR12 formatting 2022-06-28 13:46:11 +01:00
David Goodwin bed0300fae fix tests (pacrypt/{md5raw} etc) 2022-06-23 22:18:16 +01:00
David Goodwin a349c75f53 rmeove var_dump 2022-06-06 20:37:23 +01:00
David Goodwin 35486a2ca9 remove dead code 2022-06-06 20:35:53 +01:00