#!/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 || sudo 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