[users] sample config and stub function for libpwquality

This commit is contained in:
Adriaan de Groot 2018-01-23 15:28:49 +01:00
parent 27e1de6548
commit 354cb79cb1
3 changed files with 26 additions and 2 deletions

View File

@ -89,6 +89,18 @@ DEFINE_CHECK_FUNC(maxLength)
#ifdef HAVE_LIBPWQUALITY #ifdef HAVE_LIBPWQUALITY
DEFINE_CHECK_FUNC(libpwquality) DEFINE_CHECK_FUNC(libpwquality)
{ {
if ( !value.canConvert( QVariant::List ) )
{
cDebug() << "WARNING: libpwquality settings is not a list";
return;
}
QVariantList l = value.toList();
unsigned int requirement_count = 0;
for ( const auto& v : l )
{
cDebug() << " .. " << v.type() << v;
// TODO: pass strings on to libpwquality
}
} }
#endif #endif

View File

@ -473,5 +473,5 @@ UsersPage::addPasswordCheck( const QString& key, const QVariant& value )
} }
#endif #endif
else else
cDebug() << "WARNING: Unknown password-check key" << '"' << key << '"'; cDebug() << "WARNING: Unknown password-check key" << key;
} }

View File

@ -58,7 +58,19 @@ doReusePassword: true
# (e.g. specifying a maximum length less than the minimum length # (e.g. specifying a maximum length less than the minimum length
# will annoy users). # will annoy users).
# #
# (additional checks may be implemented in UsersPage.cpp) # The libpwquality check relies on the (optional) libpwquality library.
# Its value is a list of configuration statements that could also
# be found in pwquality.conf, and these are handed off to the
# libpwquality parser for evaluation. The check is ignored if
# libpwquality is not available at build time (generates a warning in
# the log). The Calamares password check rejects passwords with a
# score of < 40 with the given libpwquality settings.
#
# (additional checks may be implemented in CheckPWQuality.cpp and
# wired into UsersPage.cpp)
passwordRequirements: passwordRequirements:
minLength: -1 # Password at least this many characters minLength: -1 # Password at least this many characters
maxLength: -1 # Password at most this many characters maxLength: -1 # Password at most this many characters
libpwquality:
- minlen=8
- minclass=2