Foreword: Jenkins changed the administrator password. I read all the tutorials on the Internet, and all of them replaced the config with a string of encrypted ciphertext of 111111. The password in the xml file, and everyone’s password is 111111! I think this approach is too perfunctory! So I did some research, including the encryption method of Jenkins password and how to change the administrator's password. Of course, it is also a good choice to register a user by configuring Jenkins to allow registered users.
1. Jenkies’ encryption method
Jenkins’ password uses the Java encryption and decryption tool jBCrypt. This is the first time I have come into contact with this encryption method, and I am really amazed by it! This encryption method gets different results every time it encrypts the same plaintext. So how does it decrypt it? It turns out that he took the user's plaintext and the stored ciphertext to regenerate a string of ciphertext for judgment. To summarize, it has the following characteristics:
import org.mindrot.jbcrypt.BCrypt;/** * Created by Administrator on 2017/6/2. * <p> * Description: */public class Test {public static void main(String[] args) {//这是加密方式String hashed = BCrypt.hashpw("nimda", BCrypt.gensalt()); System.out.println(hashed);//这是解密方式if (BCrypt.checkpw("nimda", hashed)) System.out.println("It matches");elseSystem.out.println("It does not match"); } }
2, change the Jenkins admin password
##3. Restart Jenkins and you can see the modification effect.
http://localhost:8080/restart
The above is the detailed content of Jenkins tutorial to change administrator password. For more information, please follow other related articles on the PHP Chinese website!