Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Use 'hash' instead of 'encrypt' to prevent a warning. Add pip3 command to install passlib.


Excerpt

This page has instructions for doing a database-level user password reset in JIRA and Confluence (and other Crowd-library-using applications).

There's two things to try before messing with password hashes in the database:

...

  1. Compute a hash of a new password. For example:

    Code Block
    $ pythonsudo pip3 install passlib
    $ python3 -c 'from passlib.hash import atlassian_pbkdf2_sha1; print(atlassian_pbkdf2_sha1.encrypthash("hunter2"));'
    {PKCS5S2}sFaqFaJUijGG0FqLUQrhPOEXrxB7jrXI7lzkPstbM3bhPq7x8rSS+Q3NtSduIgwt

    (thanks to https://eikonal.wordpress.com/tag/authenticator/)

  2. Print and save the original password hash somewhere, just in case you need to restore it:

    Code Block
    jira=> select id, user_name, credential from cwd_user where user_name='admin';
    ┌───────┬───────────┬───────────────────────────────────────────────────────────────────────────┐
    │  id   │ user_name │                                credential                                 │
    ├───────┼───────────┼───────────────────────────────────────────────────────────────────────────┤
    │ 10000 │ admin     │ {PKCS5S2}Ba+7BCXolbe7oFyBuSISlh9ayhodhmqpXpYMNw5/Ky7YlHIbnDp+qgRuv4vqGrE6 │
    └───────┴───────────┴───────────────────────────────────────────────────────────────────────────┘
    (1 row)


  3. Set the new password:

    Code Block
    jira=> update cwd_user set credential='{PKCS5S2}sFaqFaJUijGG0FqLUQrhPOEXrxB7jrXI7lzkPstbM3bhPq7x8rSS+Q3NtSduIgwt' where user_name='admin' returning credential;
    ┌───────────────────────────────────────────────────────────────────────────┐
    │                                credential                                 │
    ├───────────────────────────────────────────────────────────────────────────┤
    │ {PKCS5S2}sFaqFaJUijGG0FqLUQrhPOEXrxB7jrXI7lzkPstbM3bhPq7x8rSS+Q3NtSduIgwt │
    └───────────────────────────────────────────────────────────────────────────┘
    (1 row)
    UPDATE 1


  4. Restart JIRA.