Skip to content

Commit 0d24111

Browse files
sklein94cesmarvin
authored andcommitted
Merge branch 'release/v1.7.0-1'
2 parents 771d276 + 7e5c88f commit 0d24111

30 files changed

+546
-42
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
## [v1.7.0-1] - 2022-08-23
10+
### Changed
11+
- The password rules are now set via global etcd keys. For more information see [docs](docs/operations/password-policy_en.md#Configuration-of-password-rules-in-etcd) (#63)
12+
- Note: the existing password rules will NOT be migrated automatically.
13+
914
## [v1.6.1-2] - 2022-07-05
1015
### Changed
1116
- Increase max username length to 64 characters (was 32 before) (#61)

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ RUN set -x \
88
FROM registry.cloudogu.com/official/java:8u302-3
99

1010
LABEL NAME="official/usermgt" \
11-
VERSION="1.6.1-2" \
11+
VERSION="1.7.0-1" \
1212
maintainer="[email protected]"
1313

1414
# mark as webapp for nginx

Jenkinsfile

+32-1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ node('docker') {
4545
shellCheck("./resources/startup.sh")
4646
}
4747

48+
stage('Shell tests') {
49+
executeShellTests()
50+
}
51+
4852
// Run inside of docker container, because karma always starts on port 9876 which might lead to errors when two
4953
// builds run concurrently (e.g. feature branch, PR and develop)
5054
new Docker(this).image('openjdk:8-jdk')
@@ -114,7 +118,17 @@ node('docker') {
114118

115119
stage('Setup') {
116120
ecoSystem.loginBackend('cesmarvin-setup')
117-
ecoSystem.setup()
121+
ecoSystem.setup([registryConfig:"""
122+
"_global": {
123+
"password-policy": {
124+
"must_contain_capital_letter": "true",
125+
"must_contain_lower_case_letter": "true",
126+
"must_contain_digit": "true",
127+
"must_contain_special_character": "true",
128+
"min_length": "14"
129+
}
130+
}
131+
"""])
118132
}
119133

120134
stage('Wait for dependencies') {
@@ -206,3 +220,20 @@ void gitWithCredentials(String command){
206220
)
207221
}
208222
}
223+
224+
def executeShellTests() {
225+
def bats_base_image = "bats/bats"
226+
def bats_custom_image = "cloudogu/bats"
227+
def bats_tag = "1.2.1"
228+
229+
def batsImage = docker.build("${bats_custom_image}:${bats_tag}", "--build-arg=BATS_BASE_IMAGE=${bats_base_image} --build-arg=BATS_TAG=${bats_tag} ./unitTests")
230+
try {
231+
sh "mkdir -p target"
232+
233+
batsContainer = batsImage.inside("--entrypoint='' -v ${WORKSPACE}:/workspace") {
234+
sh "make unit-test-shell-ci"
235+
}
236+
} finally {
237+
junit allowEmptyResults: true, testResults: 'target/shell_test_reports/*.xml'
238+
}
239+
}

Makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Set these to the desired values
22
ARTIFACT_ID=usermgt
3-
VERSION=1.6.1-2
3+
VERSION=1.7.0-1
44
# overwrite ADDITIONAL_LDFLAGS to disable static compilation
55
# this should fix https://github.com/golang/go/issues/13470
66
ADDITIONAL_LDFLAGS=""
@@ -10,5 +10,6 @@ MAKEFILES_VERSION=4.2.0
1010
include build/make/variables.mk
1111
include build/make/self-update.mk
1212
include build/make/release.mk
13+
include bats.mk
1314

1415
default: dogu-release

app/src/main/webapp/views/user/edit.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@ <h1>{{create ? 'New user' : 'Account'}}</h1>
8484
<div class="form-group password-field has-feedback" data-uadm-validate>
8585
<label class="control-label" for="password">Password</label>
8686
<input id="password" name="password" type="password" class="form-control" placeholder="Password" ng-required="true" ng-model="user.password" ng-change="applyPasswordPolicy()">
87-
<span class="glyphicon glyphicon-remove form-control-feedback "></span>
88-
<span class="glyphicon glyphicon-ok form-control-feedback"></span>
87+
<span class="glyphicon glyphicon-remove form-control-feedback " data-testid="password-invalid-marker"></span>
88+
<span class="glyphicon glyphicon-ok form-control-feedback" data-testid="password-valid-marker"></span>
8989
</div>
90-
<p>
90+
<p data-testid="password-policy-rules">
9191
<span ng-repeat="violation in passwordPolicy.violations" class="text-danger display-block"><strong>{{violation.Description}}.&nbsp;</strong></span>
9292
<span ng-repeat="satisfaction in passwordPolicy.satisfactions" class="text-success display-block"><strong>{{satisfaction.Description}}.&nbsp;</strong></span>
9393
</p>

bats.mk

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
2+
WORKSPACE=/workspace
3+
BATS_LIBRARY_DIR=$(TARGET_DIR)/bats_libs
4+
TESTS_DIR=./unitTests
5+
BASH_TEST_REPORT_DIR=$(TARGET_DIR)/shell_test_reports
6+
BASH_TEST_REPORTS=$(BASH_TEST_REPORT_DIR)/TestReport-*.xml
7+
BATS_ASSERT=$(BATS_LIBRARY_DIR)/bats-assert
8+
BATS_MOCK=$(BATS_LIBRARY_DIR)/bats-mock
9+
BATS_SUPPORT=$(BATS_LIBRARY_DIR)/bats-support
10+
BATS_FILE=$(BATS_LIBRARY_DIR)/bats-file
11+
BATS_BASE_IMAGE?=bats/bats
12+
BATS_CUSTOM_IMAGE?=cloudogu/bats
13+
BATS_TAG?=1.2.1
14+
15+
.PHONY unit-test-shell:
16+
unit-test-shell: unit-test-shell-$(ENVIRONMENT)
17+
18+
$(BATS_ASSERT):
19+
@git clone --depth 1 https://github.com/bats-core/bats-assert $@
20+
21+
$(BATS_MOCK):
22+
@git clone --depth 1 https://github.com/grayhemp/bats-mock $@
23+
24+
$(BATS_SUPPORT):
25+
@git clone --depth 1 https://github.com/bats-core/bats-support $@
26+
27+
$(BATS_FILE):
28+
@git clone --depth 1 https://github.com/bats-core/bats-file $@
29+
30+
$(BASH_SRC):
31+
BASH_SRC:=$(shell find "${WORKDIR}" -type f -name "*.sh")
32+
33+
${BASH_TEST_REPORT_DIR}: $(TARGET_DIR)
34+
@mkdir -p $(BASH_TEST_REPORT_DIR)
35+
36+
unit-test-shell-ci: $(BASH_SRC) $(BASH_TEST_REPORT_DIR) $(BATS_ASSERT) $(BATS_MOCK) $(BATS_SUPPORT) $(BATS_FILE)
37+
@echo "Test shell units on CI server"
38+
@make unit-test-shell-generic
39+
40+
unit-test-shell-local: $(BASH_SRC) $(PASSWD) $(ETCGROUP) $(HOME_DIR) buildTestImage $(BASH_TEST_REPORT_DIR) $(BATS_ASSERT) $(BATS_MOCK) $(BATS_SUPPORT) $(BATS_FILE)
41+
@echo "Test shell units locally (in Docker)"
42+
@docker run --rm \
43+
-v $(HOME_DIR):/home/$(USER) \
44+
-v $(WORKDIR):$(WORKSPACE) \
45+
-w $(WORKSPACE) \
46+
--entrypoint="" \
47+
$(BATS_CUSTOM_IMAGE):$(BATS_TAG) \
48+
${TESTS_DIR}/customBatsEntrypoint.sh make unit-test-shell-generic
49+
50+
unit-test-shell-generic:
51+
@bats --formatter junit --output ${BASH_TEST_REPORT_DIR} ${TESTS_DIR}
52+
53+
.PHONY buildTestImage:
54+
buildTestImage:
55+
@echo "Build shell test container"
56+
@cd ${TESTS_DIR} && docker build \
57+
--build-arg=BATS_BASE_IMAGE=${BATS_BASE_IMAGE} \
58+
--build-arg=BATS_TAG=${BATS_TAG} \
59+
-t ${BATS_CUSTOM_IMAGE}:${BATS_TAG} \
60+
.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Konfiguration für Integrations-Tests
2+
3+
Die Integrationstests erwarten eine bestimmte Konfiguration, damit diese erfolgreich durchlaufen. Konkret müssen
4+
bestimmte Werte im etcd gesetzt sein. Dies sind folgende:
5+
6+
```
7+
etcdctl set /config/_global/password-policy/must_contain_capital_letter true
8+
etcdctl set /config/_global/password-policy/must_contain_lower_case_letter true
9+
etcdctl set /config/_global/password-policy/must_contain_digit true
10+
etcdctl set /config/_global/password-policy/must_contain_special_character true
11+
etcdctl set /config/_global/password-policy/min_length 14
12+
```
13+
14+
Damit die gesetzten Werte berücksichtigt werden, muss das Dogu einmal neu gestartet werden.
15+
16+
Die Werte konfigurieren die Passwort-Regeln, welche in den Integrationstests überprüft werden.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Configuration for integration tests
2+
3+
The integration tests expect a certain configuration to run successfully. Specifically certain values be set in the
4+
etcd. These are as follows:
5+
6+
```
7+
etcdctl set /config/_global/password-policy/must_contain_capital_letter true
8+
etcdctl set /config/_global/password-policy/must_contain_lower_case_letter true
9+
etcdctl set /config/_global/password-policy/must_contain_digit true
10+
etcdctl set /config/_global/password-policy/must_contain_special_character true
11+
etcdctl set /config/_global/password-policy/min_length 14
12+
```
13+
14+
In order for the set values to be taken into account, the Dogu must be restarted once.
15+
16+
The values configure the password rules that are checked in the integration tests.
Loading
Loading
Loading

docs/gui/usermanagement_de.md

+1-10
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ Wird versucht, eine Nutzerin oder einen Nutzer mit einer E-Mail-Addresse anzuleg
7272
![Nutzerin oder Nutzer neu angelegt_Unique_Email: Fehlermeldung E-mail](figures/usermanagement/CESUsermanagement_EmailUnique.png)
7373

7474
### Passwort-Richtlinien
75-
Im User Management können Passwort-Richtlinien konfiguriert werden, die während der Eingabe der Passwörter validiert werden. Durch das Anlegen von sinnvollen Passwort-Richtlinien kann die Sicherheit der Passwörter global kontrolliert werden.
75+
Im etcd vom CES können Passwort-Richtlinien konfiguriert werden, die während der Eingabe der Passwörter validiert werden. Durch das Anlegen von sinnvollen Passwort-Richtlinien kann die Sicherheit der Passwörter global kontrolliert werden.
7676

7777
##### Ablauf
7878
1. Alle nicht erfüllten Passwort-Richtlinien werden angezeigt.
@@ -87,15 +87,6 @@ Im User Management können Passwort-Richtlinien konfiguriert werden, die währen
8787

8888
![Alle Regeln erfüllt](figures/usermanagement/CESUsermanagement_Password_Policy_All_Rules_Satisfied.png)
8989

90-
91-
##### Ausnahmen
92-
Sollten Passwort-Richtlinien falsch konfiguriert worden sein, so werden diese angezeigt. Die Eingabe von Passwörtern im System ist dann nicht möglich. Der Administrator muss in diesem Fall die Einstellungen korrigieren.
93-
94-
Sollte ein ungültiger Regex zur Konfiguration verwendet worden sein, so wird eine Fehlermeldung nach dem folgenden Muster angezeigt:
95-
96-
![Invalid Regel](figures/usermanagement/CESUsermanagement_Password_Policy_InvalidRegex.png)
97-
98-
9990
### Nutzerin oder Nutzer löschen
10091
Klicken Sie hierzu auf der Seite "Users" auf das Symbol "Mülltonne", welches in der Spalte "Functions" und in der Zeile der zu löschenden Nutzerin oder des Nutzers abgebildet ist. Bestätigen Sie daraufhin die Sicherheitsabfrage.
10192

docs/gui/usermanagement_en.md

+1-10
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ If you try to create a user with an email address that already exists the follow
7373
![User newly created_Unique_Email: Error message E-mail](figures/usermanagement/CESUsermanagement_EmailUnique.png)
7474

7575
### Password policies
76-
In User Management, password policies can be configured to be validated as passwords are entered. By creating meaningful password policies, the security of passwords can be controlled globally.
76+
In etcd of the CES, password policies can be configured to be validated as passwords are entered. By creating meaningful password policies, the security of passwords can be controlled globally.
7777

7878
##### Procedure
7979
1. all password policies that are not fulfilled are displayed.
@@ -88,15 +88,6 @@ In User Management, password policies can be configured to be validated as passw
8888

8989
![All rules satisfied](figures/usermanagement/CESUsermanagement_Password_Policy_All_Rules_Satisfied.png)
9090

91-
92-
##### Exceptions
93-
If password policies have been configured incorrectly, they will be displayed. It is then not possible to enter passwords in the system. In this case, the administrator must correct the settings.
94-
95-
If an invalid regex has been used for configuration, an error message will be displayed according to the following pattern:
96-
97-
![Invalid Rule](figures/usermanagement/CESUsermanagement_Password_Policy_InvalidRegex.png)
98-
99-
10091
### Delete user
10192
To do this, click on the "Trash can" icon on the "Users" page, which is shown in the "Functions" column and in the row of the user you want to delete. Confirm the security prompt at the end.
10293

docs/operations/password-policy_de.md

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Passwort Policy
2+
3+
Im etcd vom CES können bestimmte Regeln für die Passwörter definiert werden. Diese Regeln müssen im User Management beim
4+
Setzen von Passwörtern eingehalten werden.
5+
6+
## Konfiguration der Passwort-Regeln im etcd
7+
8+
Konkret kann konfiguriert werden, ob ein Passwort bestimmte Zeichen enthalten muss und welche Länge ein Passwort
9+
mindestens haben muss.
10+
11+
Mit dem Wert `true` kann bei den folgenden Einträgen die jeweilige Regel aktiviert werden.
12+
13+
* `/config/_global/password-policy/must_contain_capital_letter` - gibt an, ob das Passwort mindestens einen
14+
Großbuchstaben enthalten muss
15+
* `/config/_global/password-policy/must_contain_lower_case_letter` - gibt an, ob das Passwort mindestens einen
16+
Kleinbuchstaben enthalten muss
17+
* `/config/_global/password-policy/must_contain_digit` - gibt an, ob das Passwort mindestens eine Ziffer enthalten muss
18+
* `/config/_global/password-policy/must_contain_special_character` - gibt an, ob das Passwort mindestens ein
19+
Sonderzeichen enthalten muss
20+
21+
Bei den Großbuchstaben zählen die Umlaute `Ä`, `Ö` und `Ü` dazu, bei den Kleinbuchstaben die Umlaute `ä`, `ö` und `u`
22+
sowie das `ß`. Als Sonderzeichen gelten alle Zeichen, die weder Großbuchstabe, Kleinbuchstabe noch Ziffer sind.
23+
24+
Die Mindestlänge des Passworts kann über den Eintrag `/config/_global/password-policy/min_length` konfiguriert werden.
25+
Hier ist ein numerischer Integerwert einzutragen. Wird kein Wert angegeben oder ein Nicht-Integerwert gesetzt, ist die
26+
Mindestlänge 1.
27+
28+
Die Werte werden nach einem Neustart vom CAS herangezogen.
29+
30+
Es ist zu beachten, dass diese Werte nicht über `cesapp edit-config usermgt` konfiguriert werden können, da es sich
31+
hierbei um globale Werte handelt. Diese Werte sind für das gesamte CES gültig und somit nicht Dogu-spezifisch.

docs/operations/password-policy_en.md

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Passwort Policy
2+
3+
Certain rules for passwords can be defined in the etcd of the CES. These rules must be observed in User Management when
4+
set passwords in the User Management.
5+
6+
## Configuration of password rules in etcd
7+
8+
Specifically, it can be configured whether a password must contain certain characters and what the minimum length of a
9+
password must be.
10+
11+
With the value `true` the respective rule can be activated for the following entries.
12+
13+
* `/config/_global/password-policy/must_contain_capital_letter` - specifies whether the password must contain at least
14+
one capital letter.
15+
* `/config/_global/password-policy/must_contain_lower_case_letter` - specifies whether the password must contain at
16+
least one lowercase letter.
17+
* `/config/_global/password-policy/must_contain_digit` - specifies if the password must contain at least one digit
18+
* `/config/_global/password-policy/must_contain_special_character` - indicates whether the password must contain at
19+
least one
20+
21+
For uppercase letters this includes the umlauts `Ä`, `Ö` and `Ü`, for lowercase letters it includes the umlauts `ä`, `ö`
22+
and `ü` and the `ß`. Special characters are all characters that are neither uppercase letters, lowercase letters nor
23+
numbers.
24+
25+
The minimum length of the password can be configured via the entry `/config/_global/password-policy/min_length`. A
26+
numeric integer value must be entered here. If no value is entered or a non-integer value is set, the minimum length is
27+
1 .
28+
29+
The values are used by the CAS after a restart.
30+
31+
It should be noted that these values cannot be configured via `cesapp edit-config usermgt`, as they are global values.
32+
These values are valid for the entire CES and are therefore not Dogu-specific.

dogu.json

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"Name": "official/usermgt",
3-
"Version": "1.6.1-2",
3+
"Version": "1.7.0-1",
44
"DisplayName": "User Management",
55
"Description": "User and Group Management.",
66
"Category": "Administration Apps",
@@ -38,11 +38,6 @@
3838
}
3939
],
4040
"Configuration": [
41-
{
42-
"Name": "password_policy",
43-
"Description": "Configure a password policy for users passwords, based on a set of rules",
44-
"Optional": true
45-
},
4641
{
4742
"Name": "pwd_reset_selected_by_default",
4843
"Description": "Specifies whether the checkbox for the password change at the next login attribute should be preselected by default ",
@@ -91,6 +86,12 @@
9186
}
9287
}
9388
],
89+
"ExposedCommands": [
90+
{
91+
"Name": "post-upgrade",
92+
"Command": "/post-upgrade.sh"
93+
}
94+
],
9495
"ServiceAccounts": [
9596
{
9697
"Type": "ldap",

integrationTests/cypress/fixtures/newuser_data.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"username": "newuser",
3-
"password": "newuserpassword",
3+
"password": "newuserpassword1234A$",
44
"givenname": "newuser",
55
"surname": "newuser",
66
"displayName": "newuser",

integrationTests/cypress/fixtures/testuser_data.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"username": "testuser",
3-
"password": "testuserpassword",
3+
"password": "testuserpassword1234A$",
44
"givenname": "test",
55
"surname": "test",
66
"displayName": "test",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Feature: Tests for the verification of the password policy
2+
3+
@requires_testuser
4+
Scenario: a user who wants to change his password is shown the password rules
5+
Given the user is logged into the CES
6+
When the user opens his own page in usermgt
7+
And the user deletes his password input
8+
Then the password entry is marked as invalid
9+
And all password rules are displayed
10+
And all password rules are marked as not fullfilled
11+
When the user enters a valid password
12+
Then the password entry is marked as valid
13+
And all password rules are displayed
14+
And all password rules are marked as fullfilled

0 commit comments

Comments
 (0)