I actually found another error, but after fixing it, it didn't solve this problem.
After fixing this, I get something different on the reverse proxy logs, which shows an improvement, but now getting an 403 on the authorize endpoint (could be the Redirect URL, that I'm going to fix next):
64 169.254.253.29 -
oiduser 06/Oct/2020:19:36:09 +0100 "POST /pkmslogin.form?token=Unknown HTTP/1.1" 200 8015
65 169.254.253.29 -
oiduser 06/Oct/2020:19:36:09 +0100 "GET /mga/sps/oauth/oauth2/authorize?response_type=code&client_id=ClientApp&client_secret=secret&scope=openid HTTP/1.1" 403 2039
66 169.254.253.29 -
unauthenticated 06/Oct/2020:19:36:09 +0100 "POST /mga/sps/oauth/oauth20/token HTTP/1.1" 400 121
Here is the output of pkmslogin:
+ HOST=169.254.253.131
+ USER=oiduser
+ PASS=P@ssw0rd
+ curl -v -s -k --cookie-jar cookie.jar --cookie cookie.jar -H 'Content-Type: application/x-www-form-urlencoded' -X POST 'https://169.254.253.131/pkmslogin.form?token=Unknown' --data-ascii 'username=oiduser&password=P@ssw0rd&login-form-type=pwd'
* About to connect() to 169.254.253.131 port 443 (#0)
* Trying 169.254.253.131...
* Connected to 169.254.253.131 (169.254.253.131) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* skipping SSL peer certificate verification
* SSL connection using TLS_RSA_WITH_AES_128_GCM_SHA256
* Server certificate:
* subject: CN=isam.pyxis.pt
* start date: Sep 26 19:52:00 2020 GMT
* expire date: Oct 12 19:52:00 2040 GMT
* common name: isam.pyxis.pt
* issuer: CN=isam.pyxis.pt
> POST /pkmslogin.form?token=Unknown HTTP/1.1
> User-Agent: curl/7.29.0
> Host: 169.254.253.131
> Accept: */*
> Content-Type: application/x-www-form-urlencoded
> Content-Length: 54
>
} [data not shown]
* upload completely sent off: 54 out of 54 bytes
< HTTP/1.1 200 OK
< content-length: 8015
< content-type: text/html
< date: Tue, 06 Oct 2020 18:36:09 GMT
< p3p: CP="NON CUR OTPi OUR NOR UNI"
< server: WebSEAL/9.0.7.0
< x-frame-options: DENY
< x-content-type-options: nosniff
< cache-control: no-store
< x-xss-protection: 1
< content-security-policy: frame-ancestors 'none'
< strict-transport-security: max-age=31536000; includeSubDomains
< pragma: no-cache
* Added cookie PD-S-SESSION-ID="1_2_1_xYaVA3F2lv0+8WyHaNtMwyZPG3PWbxEXAZKyD-q27X
tRH3ps" for domain 169.254.253.131, path /, expire 0
< Set-Cookie: PD-S-SESSION-ID=1_2_1_xYaVA3F2lv0+8WyHaNtMwyZPG3PWbxEXAZKyD-q27XtR
H3ps; Path=/; Secure; HttpOnly
<
{ [data not shown]
<!DOCTYPE html>
<!-- Copyright (C) 2015 IBM Corporation -->
<!-- Copyright (C) 2000 Tivoli Systems, Inc. -->
<!-- Copyright (C) 1999 IBM Corporation -->
<!-- Copyright (C) 1998 Dascom, Inc. -->
<!-- All Rights Reserved. -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>IBM Security Access Manager</title>
<style>
em {
font-style:inherit;
font-weight:700;
}
body {
background-color:#555;
font-family:Helvetica, Arial, sans-serif;
-moz-font-smoothing:antialiased;
-ms-font-smoothing:antialiased;
-o-font-smoothing:antialiased;
unicode-bidi:embed;
-webkit-font-smoothing:antialiased;
-webkit-locale:en;
margin:0;
padding:0;
}
html {
height:100%;
min-height:400px;
...
------------------------------
Joao Goncalves
Pyxis, Lda.
Sintra
+351 91 721 4994
------------------------------
Original Message:
Sent: Tue October 06, 2020 02:09 PM
From: Jon Harry
Subject: Testing OpenID Connect
P.S. Maybe remove the > /dev/null from the call to pkmslogin.sh in the main script - so you can see the output.
Jon.
------------------------------
Jon Harry
Consulting IT Security Specialist
IBM
Original Message:
Sent: Tue October 06, 2020 02:06 PM
From: Jon Harry
Subject: Testing OpenID Connect
Hi Joao,
The scope=openid is required by OpenID Connect. I guess it's not included in the scripts you're using because they are for OAuth which doesn't have that requirement. I don't know if it's relevant but when doing OpenID Connect, the Redirect URI is required in the request to /authorize and must match a configured redirect URI on the client definition. Again, this isn't required for OAuth.
I'm not sure that is the root cause of your issue though - I think you're probably right that the "unauthenticated" request to /authorize is more of a problem.
I'm not an expert on cURL but I think that after the pkmslogin script has completed, there should be a PD_S_SESSION_ID cookie in the cookie.jar file. This should allow the authorize script to be authenticated. Does the response from pkmslogin indicate a successful login? (A 200 doesn't necessarily mean it worked - you need to see a success message in the response body). Do you see the cookie.jar file get created successfully?
Jon.
------------------------------
Jon Harry
Consulting IT Security Specialist
IBM
Original Message:
Sent: Tue October 06, 2020 12:39 PM
From: Joao Goncalves
Subject: Testing OpenID Connect
I noticed that in the get-authorize.sh script there is a missing parameter, scope. According to the authorize endpoint definition (https://www.ibm.com/support/knowledgecenter/SSPREK_9.0.7/com.ibm.isam.doc/config/concept/con_oidc_op_auth_point.html) this parameter is required.
But even after changing the script, it didn't work.
Here is the updated script:
#! /bin/sh
HOST=$1
CLIENT_ID=$2
CLIENT_SECRET=$3
curl -v -s -k --cookie cookie.jar --cookie-jar cookie.jar \
"https://$HOST/mga/sps/oauth/oauth2/authorize?response_type=code&client_id=$CLIENT_ID&client_secret=$CLIENT_SECRET&scope=openid" 2>&1 | tee authorize.out | grep location
I went to check the reverse proxy logs, and found this:
40 169.254.253.29 - oiduser 06/Oct/2020:16:49:10 +0100 "GET /pkmslogin.form HTTP/1.1" 200 8683
41 169.254.253.29 - unauthenticated 06/Oct/2020:16:58:42 +0100 "GET /mga/sps/oauth/oauth2/authorize?response_type=code&client_id=ClientApp&client_secret=secret HTTP/1.1" 200 13516
42 169.254.253.29 - unauthenticated 06/Oct/2020:16:58:43 +0100 "POST /mga/sps/oauth/oauth20/token HTTP/1.1" 400 138
Although authorize return "200", curl apparently did not use the sessionID, as the request was not identified to "oiduser".
Am I thinking correctly?
------------------------------
Joao Goncalves
Pyxis, Lda.
Sintra
+351 91 721 4994
Original Message:
Sent: Tue October 06, 2020 12:00 PM
From: Joao Goncalves
Subject: Testing OpenID Connect
I am using the scripts provided in IBM-Security/isam-support for testing OpenID Connect, and I am getting an error which I cannot understand what is going on!
I created a user, named oiduser which I can successfully login using pkmslogin.form
The OIDC client is configured this way:
------------------------------
Joao Goncalves
Pyxis, Lda.
Sintra
+351 91 721 4994
------------------------------