Skip to content

Commit

Permalink
[Minor] Hardening GeoNode checks and settings
Browse files Browse the repository at this point in the history
  • Loading branch information
afabiani committed May 28, 2019
1 parent 6c940c2 commit 2e3d49d
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions geonode/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,7 @@
SESSION_COOKIE_SECURE = ast.literal_eval(os.environ.get('SESSION_COOKIE_SECURE', 'False'))
CSRF_COOKIE_SECURE = ast.literal_eval(os.environ.get('CSRF_COOKIE_SECURE', 'False'))
CSRF_COOKIE_HTTPONLY = ast.literal_eval(os.environ.get('CSRF_COOKIE_HTTPONLY', 'False'))
CORS_ORIGIN_ALLOW_ALL = ast.literal_eval(os.environ.get('CORS_ORIGIN_ALLOW_ALL', 'False'))
X_FRAME_OPTIONS = os.environ.get('X_FRAME_OPTIONS', 'DENY')
SECURE_CONTENT_TYPE_NOSNIFF = ast.literal_eval(os.environ.get('SECURE_CONTENT_TYPE_NOSNIFF', 'True'))
SECURE_BROWSER_XSS_FILTER = ast.literal_eval(os.environ.get('SECURE_BROWSER_XSS_FILTER', 'True'))
Expand Down Expand Up @@ -1237,26 +1238,24 @@
# Settings for MONITORING plugin
MONITORING_ENABLED = ast.literal_eval(os.environ.get('MONITORING_ENABLED', 'True'))

MONITORING_CONFIG = os.getenv("MONITORING_CONFIG", None)
MONITORING_HOST_NAME = os.getenv("MONITORING_HOST_NAME", HOSTNAME)
MONITORING_SERVICE_NAME = os.getenv("MONITORING_SERVICE_NAME", 'local-geonode')

# how long monitoring data should be stored
MONITORING_DATA_TTL = timedelta(days=7)

# this will disable csrf check for notification config views,
# use with caution - for dev purpose only
MONITORING_DISABLE_CSRF = ast.literal_eval(os.environ.get('MONITORING_DISABLE_CSRF', 'False'))

if MONITORING_ENABLED:
if 'geonode.monitoring' not in INSTALLED_APPS:
INSTALLED_APPS += ('geonode.monitoring',)
if 'geonode.monitoring.middleware.MonitoringMiddleware' not in MIDDLEWARE_CLASSES:
MIDDLEWARE_CLASSES += \
('geonode.monitoring.middleware.MonitoringMiddleware',)

# add following lines to your local settings to enable monitoring
MONITORING_CONFIG = None
MONITORING_HOST_NAME = os.getenv("MONITORING_HOST_NAME", HOSTNAME)
MONITORING_SERVICE_NAME = os.getenv("MONITORING_SERVICE_NAME", 'local-geonode')

# how long monitoring data should be stored
MONITORING_DATA_TTL = timedelta(days=7)

# this will disable csrf check for notification config views,
# use with caution - for dev purpose only
CORS_ORIGIN_ALLOW_ALL = ast.literal_eval(os.environ.get('CORS_ORIGIN_ALLOW_ALL', 'True'))
MONITORING_DISABLE_CSRF = ast.literal_eval(os.environ.get('MONITORING_DISABLE_CSRF', 'False'))

CACHES = {
# DUMMY CACHE FOR DEVELOPMENT
'default': {
Expand Down

0 comments on commit 2e3d49d

Please sign in to comment.