Last active
December 13, 2019 13:36
-
-
Save icarrr/6aceaece6846784ee773db8a746f7aaf to your computer and use it in GitHub Desktop.
Reset the list of trusted CA certificates in RHEL 7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Get time | |
localTime=$(date '+%Y%m%d_%H%M%S' -d "$(curl -s --head http://google.com | grep ^Date: | sed 's/Date: //g')") | |
# Create cert bak dir | |
mkdir -p $HOME/cert.bak | |
# Reset cert | |
sudo rpm -Vv ca-certificates | awk '$1!="........." && $2!="d" {system("mv -v " $NF " $HOME/cert.bak")}' | |
sudo yum check-update ca-certificates; (($?==100)) && sudo yum update -y ca-certificates || yum reinstall -y ca-certificates | |
sudo find /etc/pki/ca-trust/source{,/anchors} -maxdepth 1 -not -type d -exec ls -1 {} + | |
sudo update-ca-trust extract | |
# Update locate cert bak | |
sudo mv $HOME/cert.bak $HOME/cert/cert.bak-$localTime |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment