Jira Data Center の SAML 認証を回避する

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

目的

It's possible to bypass SAML authentication if the product is configured to allow bypassing and a special query parameter is provided - auth_fallback

The URL to display the login page is: <BASE_URL>/login.jsp?auth_fallback but the admin needs to enable authentication fallback first. 

The parameter works only on the Jira Core/Software login page URL and is useful for troubleshooting SAML issues.
If the configuration allows bypassing SAML authentication, then the user will end up on the regular login page.
If the configuration does not allow for using auth_fallback, then the regular SAML flow will be initiated. 

(warning) The auth_fallback parameter is not intended to be appended to the end of the Service Management portal login page (servicedesk/customer/user/login?destination=portals&auth_fallback).
In this case, use the Jira login.jsp page, and the user will be redirected to Service Management as configuration allows. 

This documentation applies only to the native SSO 2.0 plugin provided by Jira. If using third-party SSO plugins, please refer to the plugin vendor documentation to get instructions on how to bypass their SSO redirection.

Solution A. Enable auth_fallback via the REST API

In order to make use of the auth_fallback functionality, we need to set a flag through the REST API, enabling this option.

Using curl

Follow one of the options below, depending on the Jira version that you have installed.

For SSO authentication plugin 4.2.0 and newer bundled in Jira Server and Data Center 8.16 / JSM 4.16

Expand for cURL example
curl -vvv -k -L -u admin_username -X PATCH <Jira-Base-URL>/rest/authconfig/1.0/sso \
    -H 'Content-Type: application/json'\
    -d '{"enable-authentication-fallback": true}'

For SSO authentication plugin 4.0.x-4.1.x bundled in Jira Server and Data Center 8.6-8.15 / JSM 4.5-4.15

Expand for cURL example
curl -vvv -u admin_username -XPUT <BASE_URL>/rest/authconfig/1.0/sso \
	-H 'Content-Type: application/json'\
	-d '{"allow-redirect-override": true}'

For SSO authentication plugin 3.x and older bundled in Jira Server and Data Center BEFORE 8.5 / JSM 4.5

Expand for cURL example
curl -vvv -u admin_username -XPUT <BASE_URL>/rest/authconfig/1.0/saml \
	-H 'Content-Type: application/json'\
	-d '{"allow-saml-redirect-override": true}'


Using REST client with a GUI such as Postman

  1. Download Postman for your browser (or use your own if you have an alternate REST client)
  2. Open Postman
  3. Select GET from the dropdown menu and select Basic Auth from the Authorization tab (enter the admin credentials)
  4. Enter the following URL, adjusting to match your environment and Jira version:

This should return something like the following after clicking SEND:

{
  "sso-url": "https://dev-486166.oktapreview.com/app/jeancodev486166_jiradc_1/exk9awjfupbFE8VQp0h7/sso/saml",
  "sso-issuer": "http://www.okta.com/exk9awjfupbFE8VQp0h7",
  "certificate": "MIIDpDCCAoygAwIBAgIGAVl1oNWbMA0GCSqGSIb3DQEBBQUAMIGSMQswCQYDVQQGEwJVUzETMBEG\nA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNU2FuIEZyYW5jaXNjbzENMAsGA1UECgwET2t0YTEU\nMBIGA1UECwwLU1NPUHJvdmlkZXIxEzARBgNVBAMMCmRldi00ODYxNjYxHDAaBgkqhkiG9w0BCQEW\nDWluZm9Ab2t0YS5jb20wHhcNMTcwMTA2MjExMjExWhcNMjcwMTA2MjExMzExWjCBkjELMAkGA1UE\nBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFjAUBgNVBAcMDVNhbiBGcmFuY2lzY28xDTALBgNV\nBAoMBE9rdGExFDASBgNVBAsMC1NTT1Byb3ZpZGVyMRMwEQYDVQQDDApkZXYtNDg2MTY2MRwwGgYJ\nKoZIhvcNAQkBFg1pbmZvQG9rdGEuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA\nn5+MbxEb0rRA5kDBxVvzNRO3otJS7UMB3ldTEqivmieXvkXiSLjVYQJr7gbg+OYAX12V35HmrIs6\nRiT/d4trsePI09hRjQD2eMXsd11v1eKmoyAbsV026LZTHoVpXZQyeK383chJLEp2G6lRVdA/uFpP\nj5OCSiB5jVhEdRXymbfeESecMbh5YJu9H025sDBiqyzDHmZXunPdmJ0fyFpY9Q98bMfi7KUICHff\nlncSYQRDYax17wTO/2Nu4akWVESiBaedBlXAKuEOoB26ysxbQiUATOJTKodiGydyxLAlk2DV+Uzz\nDAeN8mQw7y4MArrSDqTWnTbtg3SJl6e0Ho/CGQIDAQABMA0GCSqGSIb3DQEBBQUAA4IBAQBNy/LR\nG85t3nuk4bnh2XRWtOXlSKtq6fVMAtJ4kd8vxB8M8DyFWDIaoXTd35COs1p2LX176hdBKjgau8Ux\nNUOJ3MIOw8qQAwFWguBHFWYhrcgDCVtCvz3wLIBRZehW/tX2ah+M8ATsn8oLPHaL2W11Z0JOiEcV\nIdAu6CyR1iDcVjCT7DV3h8aUWaLjfnfcJasEqiTEs2DH1d8E+GdW/lWaGiAdVlnxmxv5rvkwFxvZ\nDJyk2VPxZmFVdK16cUbPgnk5Bge7wnNaQZOUBmUZKAKmzeA+22lhKPpv8IGTIwEpcoUHggAdhvrT\nHfcvAs4OyFQgeaBA5//UjZVa/MfAFmqP",
  "user-attribute": null,
  "allow-saml-redirect-override": false,
  "include-customer-logins": false,
  "redirect-on-login": false,
  "enable-remember-me": false
}

We will need to update the flag enable-authentication-fallbackallow-redirect-override or allow-saml-redirect-override (depending on your Jira version as detailed above) to true:

  1. To do this, open a new tab in Postman
  2. Select PUT or PATCH from the dropdown and enter the URL:
    1. Jira Server and Data Center 8.16 / JSM 4.16 and newer

      Attribute is enable-authentication-fallback and URL is <BASE_URL>/rest/authconfig/1.0/sso (e.g. https://jiraprod.net/jira/rest/authconfig/1.0/sso)

    2. Jira Server and Data Center 8.6-8.15 / JSM 4.5-4.15

      Attribute is allow-redirect-override and URL is <BASE_URL>/rest/authconfig/1.0/sso (e.g. https://jiraprod.net/jira/rest/authconfig/1.0/sso)

    3. Jira Server and Data Center BEFORE 8.5 / JSM 4.5

      Attribute is allow-saml-redirect-override and URL is <BASE_URL>/rest/authconfig/1.0/saml (e.g. https://jiraprod.net/jira/rest/authconfig/1.0/saml)

  3. Select Basic Auth from the Authorization tab and enter the credentials for the admin account
  4. Go to the Body tab, select Raw from the radio button. Select JSON from the dropdown menu.

Use the results from the command as a reference to set enable-authentication-fallbackallow-redirect-override or allow-saml-redirect-override (depending on your Jira version as detailed above) set to true:

{
  "allow-saml-redirect-override": true
}

(warning) This change can be reverted by changing true to false

You should get a 200 or 304 status when pressing the Send button and you will now be able to access <BASE_URL>/login.jsp?auth_fallback to bypass SAML. It's important to remember to set the flag back to false once the maintenance has been completed in order to restore the intended behavior. 


(warning) If the CURL command fails with an error 'Closing connection 0curl: (60) SSL certificate problem: unable to get local issuer certificate', you will need to run the CURL with the -k option to ignore the certificate: 

curl -vvv -XPUT -k <BASE_URL>/rest/authconfig/1.0/saml -H 'Content-Type: application/json' -d '{"allow-saml-redirect-override": true}' -u admin_username

Solution B. to Enable auth_fallback via the DB


If you're unable to access the above URL there is a database workaround, this has been tested in both Postgres and MySQL, please make sure when utilizing database workarounds that there is a viable backup of the database.

The following is a direct manipulation to enable the authentication fallback flag manually. This will require a restart of Jira as well.


Follow one of the instructions below, depending on your Jira version:


Jira Server and Data Center 8.16 / JSM 4.16
  1. Jira を停止します。
  2. Run the following query to determine the ID to update in the database

    select propertyentry.id from propertyentry join propertystring on propertyentry.id=propertystring.id where property_key like 'com.atlassian.plugins.authentication.sso.config.enable-authentication-fallback'; 
  3. You should receive output as below

      id  
    -------
     17074
    (1 row)
  4. Now let's use that ID to update and allow the auth_fallback URL:
    1. Take the ID and insert it into the following query:

      update propertystring set propertyvalue = 'true' where id=17074;
  5. Jira の起動
  6. You should now be able to access <BASE_URL>/login.jsp 

(warning) NOTE: The ID is 17074 in this example. Your ID will vary depending on the results of the first query we ran. 

Jira Server and Data Center 8.6-8.15 / JSM 4.5-4.15
  1. Jira を停止します。
  2. Run the following query to determine the ID to update in the database

    select propertyentry.id from propertyentry join propertystring on propertyentry.id=propertystring.id where property_key like 'com.atlassian.plugins.authentication.sso.config.allow-redirect-override';
  3. You should receive output as below

      id  
    -------
     17074
    (1 row)
  4. Now let's use that ID to update and allow the auth_fallback URL:
    1. Take the ID and insert it into the following query:

      update propertystring set propertyvalue = 'true' where id=17074;
  5. Jira の起動
  6. You should now be able to access <BASE_URL>/login.jsp?auth_fallback 

(warning) NOTE: The ID is 17074 in this example. Your ID will vary depending on the results of the first query we ran. 

Jira Server and Data Center BEFORE 8.5 / JSM 4.5
  1. Jira を停止します。
  2. Run the following query to determine the ID to update in the database

    select propertyentry.id from propertyentry join propertystring on propertyentry.id=propertystring.id where property_key='com.atlassian.plugins.authentication.samlconfig.allow-saml-override';
  3. You should receive the output as below

      id  
    -------
     17074
    (1 row)
  4. Now let's use that ID to update and allow the auth_fallback URL:
    1. Take the ID and insert it into the following query:

      update propertystring set propertyvalue = 'true' where id=17074;
  5. Jira の起動
  6. You should now be able to access <BASE_URL>/login.jsp?auth_fallback 

(warning) NOTE: The ID is 17074 in this example. Your ID will vary depending on the results of the first query we ran. 

最終更新日 2022 年 7 月 12 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.