@@ -72,46 +72,72 @@ GPGEOF
72
72
}
73
73
74
74
set_up_oidc () {
75
- if [[ " $OIDC_ENABLE " ! = " true" ]]; then
76
- echo " ... OIDC authentication disabled "
77
- return
78
- fi
75
+ if [[ " $OIDC_ENABLE " = = " true" ]]; then
76
+ if [[ -z " $OIDC_ROLES_MAPPING " ]] ; then
77
+ OIDC_ROLES_MAPPING= " \"\" "
78
+ fi
79
79
80
- if [[ -z " $OIDC_ROLES_MAPPING " ]] ; then
81
- OIDC_ROLES_MAPPING= " \"\" "
82
- fi
80
+ # Check required variables
81
+ # OIDC_ISSUER may be empty
82
+ check_env_vars OIDC_PROVIDER_URL OIDC_CLIENT_ID OIDC_CLIENT_SECRET OIDC_ROLES_PROPERTY OIDC_ROLES_MAPPING OIDC_DEFAULT_ORG
83
83
84
- # Check required variables
85
- # OIDC_ISSUER may be empty
86
- check_env_vars OIDC_PROVIDER_URL OIDC_CLIENT_ID OIDC_CLIENT_SECRET OIDC_ROLES_PROPERTY OIDC_ROLES_MAPPING OIDC_DEFAULT_ORG
84
+ # Configure OIDC in MISP
85
+ sudo -u www-data php /var/www/MISP/tests/modify_config.php modify " {
86
+ \" Security\" : {
87
+ \" auth\" : [\" OidcAuth.Oidc\" ]
88
+ }
89
+ }" > /dev/null
87
90
88
- sudo -u www-data php /var/www/MISP/tests/modify_config.php modify " {
89
- \" Security\" : {
90
- \" auth\" : [\" OidcAuth.Oidc\" ]
91
- }
92
- }" > /dev/null
91
+ # Set OIDC authentication details in MISP
92
+ sudo -u www-data php /var/www/MISP/tests/modify_config.php modify " {
93
+ \" OidcAuth\" : {
94
+ \" provider_url\" : \" ${OIDC_PROVIDER_URL} \" ,
95
+ ${OIDC_ISSUER: +\" issuer\" : \" ${OIDC_ISSUER} \" ,}
96
+ \" client_id\" : \" ${OIDC_CLIENT_ID} \" ,
97
+ \" client_secret\" : \" ${OIDC_CLIENT_SECRET} \" ,
98
+ \" roles_property\" : \" ${OIDC_ROLES_PROPERTY} \" ,
99
+ \" role_mapper\" : ${OIDC_ROLES_MAPPING} ,
100
+ \" default_org\" : \" ${OIDC_DEFAULT_ORG} \"
101
+ }
102
+ }" > /dev/null
93
103
94
- sudo -u www-data php /var/www/MISP/tests/modify_config.php modify " {
95
- \" OidcAuth \" : {
96
- \" provider_url \" : \ "${OIDC_PROVIDER_URL} \" ,
97
- ${OIDC_ISSUER : + \" issuer \" : \" ${OIDC_ISSUER} \" ,}
98
- \" client_id \" : \" ${OIDC_CLIENT_ID} \" ,
99
- \" client_secret \" : \" ${OIDC_CLIENT_SECRET} \" ,
100
- \" roles_property \" : \" ${OIDC_ROLES_PROPERTY} \" ,
101
- \" role_mapper \" : ${OIDC_ROLES_MAPPING} ,
102
- \" default_org \" : \" ${OIDC_DEFAULT_ORG} \"
103
- }
104
- } " > /dev/null
104
+ # Set the custom logout URL for OIDC if it is defined
105
+ if [[ -n " ${OIDC_LOGOUT_URL} " ]] ; then
106
+ sudo -u www-data /var/www/MISP/app/Console/cake Admin setSetting -q " Plugin.CustomAuth_custom_logout " " ${OIDC_LOGOUT_URL} &post_logout_redirect_uri= ${BASE_URL} /users/login "
107
+ else
108
+ echo " OIDC_LOGOUT_URL is not set "
109
+ fi
110
+
111
+ # Disable password confirmation as recommended in https://github.com/MISP/MISP/issues/8116
112
+ sudo -u www-data /var/www/MISP/app/Console/cake Admin setSetting -q " Security.require_password_confirmation " false
113
+
114
+ echo " ... OIDC authentication enabled "
105
115
106
- # Set the custom logout URL for the OIDC plugin only if OIDC_LOGOUT_URL is defined
107
- if [[ -n " ${OIDC_LOGOUT_URL} " ]]; then
108
- sudo -u www-data /var/www/MISP/app/Console/cake Admin setSetting -q " Plugin.CustomAuth_custom_logout" " ${OIDC_LOGOUT_URL} &post_logout_redirect_uri=${BASE_URL} /users/login"
109
116
else
110
- echo " OIDC_LOGOUT_URL is not set"
111
- fi
117
+ # Reset OIDC authentication settings to empty values
118
+ sudo -u www-data php /var/www/MISP/tests/modify_config.php modify " {
119
+ \" OidcAuth\" : {
120
+ \" provider_url\" : \"\" ,
121
+ \" issuer\" : \"\" ,
122
+ \" client_id\" : \"\" ,
123
+ \" client_secret\" : \"\" ,
124
+ \" roles_property\" : \"\" ,
125
+ \" role_mapper\" : \"\" ,
126
+ \" default_org\" : \"\"
127
+ }
128
+ }" > /dev/null
112
129
113
- # Disable password confirmation as stated at https://github.com/MISP/MISP/issues/8116
114
- sudo -u www-data /var/www/MISP/app/Console/cake Admin setSetting -q " Security.require_password_confirmation" false
130
+ # Use sed to remove the OidcAuth.Oidc entry from the 'auth' array in the config.php
131
+ sudo -u www-data sed -i " /'auth' =>/,/)/ { /0 => 'OidcAuth.Oidc',/d; }" /var/www/MISP/app/Config/config.php
132
+
133
+ # Remove the custom logout URL
134
+ sudo -u www-data sed -i " /'CustomAuth_custom_logout' =>/d" /var/www/MISP/app/Config/config.php
135
+
136
+ # Re-enable password confirmation if necessary
137
+ sudo -u www-data /var/www/MISP/app/Console/cake Admin setSetting -q " Security.require_password_confirmation" true
138
+
139
+ echo " ... OIDC authentication disabled"
140
+ fi
115
141
}
116
142
117
143
set_up_ldap () {
0 commit comments