Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Puppet module - Automated Comptoir du Libre deployment
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Comptoir
Puppet module - Automated Comptoir du Libre deployment
Commits
ccd84de3
Commit
ccd84de3
authored
9 months ago
by
Fabrice Gangler
Browse files
Options
Downloads
Patches
Plain Diff
feat: allow to configure WEBAPP_USER_CONFIG_PASSWORD_RESET_TOKEN_LIFETIME environment variable
parent
6d50ccd9
No related branches found
No related tags found
1 merge request
!8
Resolve "Allow to configure WEBAPP_USER_CONFIG_PASSWORD_RESET_TOKEN_LIFETIME environment variable"
Pipeline
#76902
passed
9 months ago
Stage: syntax
Stage: unit
Stage: acceptance
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
REFERENCE.md
+9
-0
9 additions, 0 deletions
REFERENCE.md
manifests/init.pp
+2
-0
2 additions, 0 deletions
manifests/init.pp
spec/classes/comptoir_spec.rb
+28
-0
28 additions, 0 deletions
spec/classes/comptoir_spec.rb
templates/env.prod.local.epp
+3
-6
3 additions, 6 deletions
templates/env.prod.local.epp
with
42 additions
and
6 deletions
REFERENCE.md
+
9
−
0
View file @
ccd84de3
...
@@ -39,6 +39,7 @@ The following parameters are available in the `comptoir` class:
...
@@ -39,6 +39,7 @@ The following parameters are available in the `comptoir` class:
*
[
`app_name`
](
#-comptoir--app_name
)
*
[
`app_name`
](
#-comptoir--app_name
)
*
[
`app_shortname`
](
#-comptoir--app_shortname
)
*
[
`app_shortname`
](
#-comptoir--app_shortname
)
*
[
`app_session_lifetime`
](
#-comptoir--app_session_lifetime
)
*
[
`app_session_lifetime`
](
#-comptoir--app_session_lifetime
)
*
[
`app_reset_password_token_lifetime`
](
#-comptoir--app_reset_password_token_lifetime
)
*
[
`app_user_min_password_lenght`
](
#-comptoir--app_user_min_password_lenght
)
*
[
`app_user_min_password_lenght`
](
#-comptoir--app_user_min_password_lenght
)
*
[
`app_version_displayed_publicly`
](
#-comptoir--app_version_displayed_publicly
)
*
[
`app_version_displayed_publicly`
](
#-comptoir--app_version_displayed_publicly
)
*
[
`app_secret`
](
#-comptoir--app_secret
)
*
[
`app_secret`
](
#-comptoir--app_secret
)
...
@@ -121,6 +122,14 @@ Lifetime of webapp session in seconds
...
@@ -121,6 +122,14 @@ Lifetime of webapp session in seconds
Default value:
`3600`
Default value:
`3600`
##### <a name="-comptoir--app_reset_password_token_lifetime"></a>`app_reset_password_token_lifetime`
Data type:
`Integer`
Lifetime of reset password token in seconds
Default value:
`1500`
##### <a name="-comptoir--app_user_min_password_lenght"></a>`app_user_min_password_lenght`
##### <a name="-comptoir--app_user_min_password_lenght"></a>`app_user_min_password_lenght`
Data type:
`Integer`
Data type:
`Integer`
...
...
This diff is collapsed.
Click to expand it.
manifests/init.pp
+
2
−
0
View file @
ccd84de3
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
# @param app_name A custom string displayed to users as name of service.
# @param app_name A custom string displayed to users as name of service.
# @param app_shortname A custom string displayed to users as short name of service.
# @param app_shortname A custom string displayed to users as short name of service.
# @param app_session_lifetime Lifetime of webapp session in seconds
# @param app_session_lifetime Lifetime of webapp session in seconds
# @param app_reset_password_token_lifetime Lifetime of reset password token in seconds
# @param app_user_min_password_lenght Minimum user password length
# @param app_user_min_password_lenght Minimum user password length
# @param app_version_displayed_publicly Public display of software version
# @param app_version_displayed_publicly Public display of software version
# @param app_secret Application secret is required to generate CSRF tokens
# @param app_secret Application secret is required to generate CSRF tokens
...
@@ -53,6 +54,7 @@ class comptoir (
...
@@ -53,6 +54,7 @@ class comptoir (
String
[
1
]
$app_name
=
'Comptoir-du-Libre'
,
String
[
1
]
$app_name
=
'Comptoir-du-Libre'
,
String
[
1
]
$app_shortname
=
'Comptoir'
,
String
[
1
]
$app_shortname
=
'Comptoir'
,
Integer
$app_session_lifetime
=
3600
,
Integer
$app_session_lifetime
=
3600
,
Integer
$app_reset_password_token_lifetime
=
1500
,
Integer
$app_user_min_password_lenght
=
12
,
Integer
$app_user_min_password_lenght
=
12
,
Boolean
$app_version_displayed_publicly
=
false
,
Boolean
$app_version_displayed_publicly
=
false
,
Stdlib
::
Absolutepath
$config_path
=
'/etc/comptoir'
,
Stdlib
::
Absolutepath
$config_path
=
'/etc/comptoir'
,
...
...
This diff is collapsed.
Click to expand it.
spec/classes/comptoir_spec.rb
+
28
−
0
View file @
ccd84de3
...
@@ -38,6 +38,8 @@ describe 'comptoir' do
...
@@ -38,6 +38,8 @@ describe 'comptoir' do
.
with_content
(
sensitive
(
%r{^WEBAPP_TIMEZONE='Europe/Paris'$}
))
.
with_content
(
sensitive
(
%r{^WEBAPP_TIMEZONE='Europe/Paris'$}
))
is_expected
.
to
contain_file
(
'/etc/comptoir/env.prod.local'
)
\
is_expected
.
to
contain_file
(
'/etc/comptoir/env.prod.local'
)
\
.
with_content
(
sensitive
(
%r{^WEBAPP_USER_CONFIG_MIN_PASSWORD_LENGTH=12$}
))
.
with_content
(
sensitive
(
%r{^WEBAPP_USER_CONFIG_MIN_PASSWORD_LENGTH=12$}
))
is_expected
.
to
contain_file
(
'/etc/comptoir/env.prod.local'
)
\
.
with_content
(
sensitive
(
%r{^WEBAPP_USER_CONFIG_PASSWORD_RESET_TOKEN_LIFETIME=1500$}
))
end
end
end
end
...
@@ -264,6 +266,32 @@ describe 'comptoir' do
...
@@ -264,6 +266,32 @@ describe 'comptoir' do
.
with_content
(
sensitive
(
%r{^WEBAPP_USER_CONFIG_MIN_PASSWORD_LENGTH=16$}
))
.
with_content
(
sensitive
(
%r{^WEBAPP_USER_CONFIG_MIN_PASSWORD_LENGTH=16$}
))
end
end
end
end
context
'/etc/comptoir/env.prod.local with custom password reset token lifetime (10 minutes, smaller than default value)'
do
let
(
:params
)
do
{
app_reset_password_token_lifetime:
60
*
10
,
# 60 secondes * 10 minutes = 600 seconds
}
end
it
do
is_expected
.
to
contain_file
(
'/etc/comptoir/env.prod.local'
)
\
.
with_content
(
sensitive
(
%r{^WEBAPP_USER_CONFIG_PASSWORD_RESET_TOKEN_LIFETIME=600$}
))
end
end
context
'/etc/comptoir/env.prod.local with custom password reset token lifetime (3 hours, greater than default value)'
do
let
(
:params
)
do
{
app_reset_password_token_lifetime:
60
*
60
*
3
,
# 60 secondes * 60 minutes * 3 hours = 10 800 seconds
}
end
it
do
is_expected
.
to
contain_file
(
'/etc/comptoir/env.prod.local'
)
\
.
with_content
(
sensitive
(
%r{^WEBAPP_USER_CONFIG_PASSWORD_RESET_TOKEN_LIFETIME=10800$}
))
end
end
end
end
end
end
end
end
This diff is collapsed.
Click to expand it.
templates/env.prod.local.epp
+
3
−
6
View file @
ccd84de3
...
@@ -23,9 +23,9 @@
...
@@ -23,9 +23,9 @@
# - WEBAPP_TIMEZONE Time Zone of web application (default: Europe/Paris)
# - WEBAPP_TIMEZONE Time Zone of web application (default: Europe/Paris)
# - WEBAPP_TRUSTED_HOSTS List of allowed domains and IP to prevent HTTP Host header attacks
# - WEBAPP_TRUSTED_HOSTS List of allowed domains and IP to prevent HTTP Host header attacks
#######################################################################################################################
#######################################################################################################################
# - WEBAPP_USER_CONFIG_RESET_PASSWORD_TOKEN_LIFETIME Lifetime of reset password token in seconds (default: 1200 = 20 minutes).
# - WEBAPP_USER_CONFIG_MIN_PASSWORD_LENGTH Minimum user password length (default: 12)
# - WEBAPP_SOFTWARE_VERSION_DISPLAYED_PUBLICLY Public display of software version (default: true)
# - WEBAPP_SOFTWARE_VERSION_DISPLAYED_PUBLICLY Public display of software version (default: true)
# - WEBAPP_USER_CONFIG_MIN_PASSWORD_LENGTH Minimum user password length (default: 12)
# - WEBAPP_USER_CONFIG_PASSWORD_RESET_TOKEN_LIFETIME Lifetime of reset password token in seconds (default: 1200 = 20 minutes).
#######################################################################################################################
#######################################################################################################################
APP_ENV=prod
APP_ENV=prod
...
@@ -44,7 +44,4 @@ WEBAPP_SOFTWARE_VERSION_DISPLAYED_PUBLICLY=<% if $comptoir::app_version_displaye
...
@@ -44,7 +44,4 @@ WEBAPP_SOFTWARE_VERSION_DISPLAYED_PUBLICLY=<% if $comptoir::app_version_displaye
WEBAPP_TIMEZONE='
<%=
$comptoir::timezone
%>
'
WEBAPP_TIMEZONE='
<%=
$comptoir::timezone
%>
'
WEBAPP_TRUSTED_HOSTS='
<%=
$comptoir::trusted_hosts
%>
'
WEBAPP_TRUSTED_HOSTS='
<%=
$comptoir::trusted_hosts
%>
'
WEBAPP_USER_CONFIG_MIN_PASSWORD_LENGTH=
<%=
$comptoir::app_user_min_password_lenght
%>
WEBAPP_USER_CONFIG_MIN_PASSWORD_LENGTH=
<%=
$comptoir::app_user_min_password_lenght
%>
WEBAPP_USER_CONFIG_PASSWORD_RESET_TOKEN_LIFETIME=
<%=
$comptoir::app_reset_password_token_lifetime
%>
############ Environment variables not yet managed by Puppet ##########################################################
# WEBAPP_USER_CONFIG_PASSWORD_RESET_TOKEN_LIFETIME=1200
#######################################################################################################################
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment