Use django-axes to lockout after multiple failed logins

Repeated failed login attempts should trigger lockout to prevent
brute-forcing and user enumeration - django-axes does this using account
and IP-based lockout.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
Paul Eggleton 2018-10-19 08:55:36 +13:00
parent f609ce3919
commit dff454815f
3 changed files with 35 additions and 0 deletions

View File

@ -152,10 +152,16 @@ INSTALLED_APPS = (
'reversion', 'reversion',
'reversion_compare', 'reversion_compare',
'captcha', 'captcha',
'axes',
'rest_framework', 'rest_framework',
'corsheaders', 'corsheaders',
) )
AUTHENTICATION_BACKENDS = [
'axes.backends.AxesModelBackend',
'django.contrib.auth.backends.ModelBackend',
]
REST_FRAMEWORK = { REST_FRAMEWORK = {
'DEFAULT_PERMISSION_CLASSES': ( 'DEFAULT_PERMISSION_CLASSES': (
'layerindex.restperm.ReadOnlyPermission', 'layerindex.restperm.ReadOnlyPermission',
@ -242,6 +248,16 @@ PARALLEL_JOBS = "4"
#CAPTCHA_FLITE_PATH = "/usr/bin/flite" #CAPTCHA_FLITE_PATH = "/usr/bin/flite"
#CAPTCHA_SOX_PATH = "/usr/bin/sox" #CAPTCHA_SOX_PATH = "/usr/bin/sox"
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
},
'axes_cache': {
'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
}
}
AXES_CACHE = "axes_cache"
# Full path to directory to store logs for dynamically executed tasks # Full path to directory to store logs for dynamically executed tasks
TASK_LOG_DIR = "/tmp/layerindex-task-logs" TASK_LOG_DIR = "/tmp/layerindex-task-logs"

View File

@ -5,7 +5,10 @@ billiard==3.5.0.3
celery==4.1.0 celery==4.1.0
confusable-homoglyphs==3.0.0 confusable-homoglyphs==3.0.0
Django>1.11.0,<1.12 Django>1.11.0,<1.12
django-appconf==1.0.2
django-axes==4.4.0
django-cors-headers==1.1.0 django-cors-headers==1.1.0
django-ipware==2.1.0
django-ranged-response==0.2.0 django-ranged-response==0.2.0
django-registration==2.4.1 django-registration==2.4.1
django-reversion==2.0.13 django-reversion==2.0.13

View File

@ -152,10 +152,16 @@ INSTALLED_APPS = (
'reversion', 'reversion',
'reversion_compare', 'reversion_compare',
'captcha', 'captcha',
'axes',
'rest_framework', 'rest_framework',
'corsheaders', 'corsheaders',
) )
AUTHENTICATION_BACKENDS = [
'axes.backends.AxesModelBackend',
'django.contrib.auth.backends.ModelBackend',
]
REST_FRAMEWORK = { REST_FRAMEWORK = {
'DEFAULT_PERMISSION_CLASSES': ( 'DEFAULT_PERMISSION_CLASSES': (
'layerindex.restperm.ReadOnlyPermission', 'layerindex.restperm.ReadOnlyPermission',
@ -241,6 +247,16 @@ PARALLEL_JOBS = "4"
#CAPTCHA_FLITE_PATH = "/usr/bin/flite" #CAPTCHA_FLITE_PATH = "/usr/bin/flite"
#CAPTCHA_SOX_PATH = "/usr/bin/sox" #CAPTCHA_SOX_PATH = "/usr/bin/sox"
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
},
'axes_cache': {
'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
}
}
AXES_CACHE = "axes_cache"
# Full path to directory to store logs for dynamically executed tasks # Full path to directory to store logs for dynamically executed tasks
TASK_LOG_DIR = "/tmp/layerindex-task-logs" TASK_LOG_DIR = "/tmp/layerindex-task-logs"