Commit Graph

22 Commits (eb18249d2b66d69356c8d59b99fac2cc74c27d27)

Author SHA1 Message Date
Nicolas Höft 4c27826fb5 feat(core): Support ARGON2I/ARGON2ID password hashes
Requires libsodium ≥ 1.0.9 to be present at compile time.

Thus, the following distributions will have support for at least
ARGON2i:

* rhel ≥ 7 (with EPEL enabled)
* Debian ≥ 9 (stretch)
* Ubuntu ≥ Bionic (18.04)

Fixes #4895
2020-07-01 11:20:31 +02:00
Nicolas Höft 2e0fc3ca09 feat(core): Add PBKDF2 support
Extend NSData+Crypto to support PBKDF2 with SHA1 HMAC as dovecot
is using it since v2.3.0.

The format hashed passwords is {PBKDF2}$1$<salt>$<rounds>$<hashed value in hex>

The implementation of pkcs#5 PBKDF2 is taken from openbsd (with minor
adjustments) as OpenSSL and GnuTLS would require quite new versions to
support this hash.
2020-06-03 08:17:08 +02:00
Nicolas Höft 789b55c274 NSData+Crypto: add password verification function
This will allow for using specific verification, depending on the
scheme.
2020-05-15 22:53:15 +02:00
Nicolas Höft c3a4f4aeb4 fix(core): NSData+String: Simplify generateSalt function
Instead of converting binary data to base64 in order to get printable
data, use a white list of characters allowed and select from those.

This also makes sure we will get the right amount of characters as
requested, not potentially longer strings.
2020-05-15 07:43:38 +02:00
Nicolas Höft 8c612fc0a2 feat(core): Add BLF-CRYPT scheme.
Dovecot promotes the use of BLF-CRYPT as a hashing scheme [1].
However, as not all libc-crypt() implementations support this scheme,
use the implementation added in a previous commit.

Also, update the references to the dovecot implementation and a small
test case for testing the blowfish implementation.

[1] https://doc.dovecot.org/configuration_manual/authentication/password_schemes/

Fixes #4958
2020-05-15 07:43:38 +02:00
Nicolas Höft 562f81f21f fix(core): NSData+String: Dont mix tabs and spaces 2020-05-15 07:43:38 +02:00
Ludovic Marcotte f0980a9cbd feat(core): Added AES-128-CBC password scheme for SQL authentication.
This allows SOGo to use Plesk's database as an authentication source.
2020-01-06 15:47:47 -05:00
Nicolas Höft f7f0af67d8 (fix) Fix SIGSEGV and compilation due to missing include crypt.h
When building on debian buster, the following warning occurs during
compiling:

    NSData+Crypto.m: In function ‘-[NSData(SOGoCryptoExtension) _asCryptedUsingSalt:magic:]’:
    NSData+Crypto.m:610:9: warning: implicit declaration of function ‘crypt’; did you mean ‘creat’? [-Wimplicit-function-declaration]
       buf = crypt([cryptString UTF8String], [saltString UTF8String]);
             ^~~~~
             creat
    NSData+Crypto.m:610:7: warning: assignment to ‘char *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
       buf = crypt([cryptString UTF8String], [saltString UTF8String]);
           ^
    NSData+Crypto.m: In function ‘-[NSData(SOGoCryptoExtension) asCryptUsingSalt:]’:
    NSData+Crypto.m:674:7: warning: assignment to ‘char *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
       buf = crypt([cryptString UTF8String], [saltString UTF8String]);
           ^
     Creating derived_src/NSFramework_SOGo.m..

This warning is apparently more severe as it may also cause segfaults
(at least on Debian Buster) when logging in, rendering sogo unusable:

    2019-07-21 11:27:55.623 sogod[16074:16074] MySQL4 connection established 0x0x55e6b9e56f40
    2019-07-21 11:27:55.624 sogod[16074:16074] MySQL4 channel 0x0x55e6b9aa41f0 opened (connection=0x0x55e6b9e56f40,sogo)
    2019-07-21 11:27:55.624 sogod[16074:16074] <MySQL4Channel[0x0x55e6b9aa41f0] connection=0x0x55e6b9e56f40> SQL: SELECT c_password FROM sogo_userview WHERE c_uid = 'xxxx';
    2019-07-21 11:27:55.625 sogod[16074:16074] <MySQL4Channel[0x0x55e6b9aa41f0] connection=0x0x55e6b9e56f40>   query has results, entering fetch-mode.
    Jul 21 11:27:56 sogod [16057]: <0x0x55e6b9a56020[WOWatchDogChild]> child 16074 exited
    Jul 21 11:27:56 sogod [16057]: <0x0x55e6b9a56020[WOWatchDogChild]>  (terminated due to signal 11)
    Jul 21 11:27:56 sogod [16057]: <0x0x55e6b992b360[WOWatchDog]> child spawned with pid 16268

The reason for this segfault is likely the implicit conversion to int,
leading to uninitialized higher bits of the pointer passed to NSData.
2019-07-21 12:00:21 +02:00
Thomas Merkel e35988e669
Fix standard visibility macro use
Expect crypt(3) to be provided by unistd.h, not the ancient crypt.h.
Update _XOPEN_SOURCE for SUSv3 / POSIX.1-2001
2017-08-21 18:09:39 +02:00
Ludovic Marcotte 9fbc84158a (fix) handle sha512-crypt with rounds 2017-01-06 15:52:19 -05:00
Ludovic Marcotte bf42f225cb (fix) fixed broken string initializations (fixes #3899) 2016-11-15 14:18:57 -05:00
Ludovic Marcotte 5df85fa31a (fix) fixed method usage 2016-11-11 09:48:38 -05:00
Ludovic Marcotte 5b02685d2b (feat) added sha256-crypt and sha512-crypt support 2016-11-10 10:53:07 -05:00
Patrice Levesque 9e83ff9f04 Fix compilation errors with OpenSSL 2016-02-15 11:14:06 -05:00
Patrice Levesque bd56f4cf9f Remove pointless #include from .m and .h files
This was done with a brute-force approach, ensuring no additional
warnings from GCC 4.9 under x86_64.
2016-02-13 17:41:54 -05:00
Patrice Levesque 5539b7a823 Add missing header prototypes
Fixes compiling errors with GCC using -Werror=missing-prototypes.
2016-02-08 16:14:33 -05:00
Euan Thoms 46ccd04c70 Stage 9 of clang compiler warning patches. 2015-11-04 06:13:01 +08:00
Ludovic Marcotte beb666bc5f (fix) fixed md4 support (for NTLM password changes) with GNU TLS 2015-04-17 09:29:49 -04:00
Ludovic Marcotte e5d01428ad now possible for SOGo to change the sambaNTPassword/sambaLMPassword 2015-02-11 11:31:35 -05:00
Wolfgang Sourdeau 2f9369db57 Do not provide a default fallback on libssl, when gnutls is not in use.\nInstead, we make the use of either library mandatory. 2012-10-23 10:29:05 -04:00
Jeroen Dekkers 439bb132c1 Add support for GnuTLS 2012-10-19 17:33:48 +02:00
Ludovic Marcotte 08230b33bb See ChangeLog
Monotone-Parent: 747fe8c2134a990c1cdf3b494c2b7776021cb736
Monotone-Revision: 3c4baa92c5634d4da061da739a9b544d04c44586

Monotone-Author: ludovic@Sophos.ca
Monotone-Date: 2012-05-31T13:24:32
2012-05-31 13:24:32 +00:00