Project

General

Profile

Patch #33929 ยป encrypt-totp-secret-key-with-rake-task.patch

Go MAEDA, 2020-08-30 15:59

View differences:

config/configuration.yml.example
# scm_stderr_log_file: /var/log/redmine_scm_stderr.log
scm_stderr_log_file:
# Key used to encrypt sensitive data in the database (SCM and LDAP passwords).
# Key used to encrypt sensitive data in the database (SCM and LDAP passwords,
# and TOTP (two-factor authentication) secret keys).
# If you don't want to enable data encryption, just leave it blank.
# WARNING: losing/changing this key will make encrypted data unreadable.
#
lib/tasks/ciphering.rake
desc 'Encrypts SCM and LDAP passwords in the database.'
task :encrypt => :environment do
unless (Repository.encrypt_all(:password) &&
AuthSource.encrypt_all(:account_password))
AuthSource.encrypt_all(:account_password) &&
User.encrypt_all(:twofa_totp_key))
raise "Some objects could not be saved after encryption, update was rolled back."
end
end
......
desc 'Decrypts SCM and LDAP passwords in the database.'
task :decrypt => :environment do
unless (Repository.decrypt_all(:password) &&
AuthSource.decrypt_all(:account_password))
AuthSource.decrypt_all(:account_password) &&
User.decrypt_all(:twofa_totp_key))
raise "Some objects could not be saved after decryption, update was rolled back."
end
end
    (1-1/1)