Code Update
This commit is contained in:
		@@ -41,8 +41,13 @@ wx-ssh-config-sync(){
 | 
				
			|||||||
    VAULT_STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://$VAULT_DOMAIN/v1/cli/data/$USERNAME/settings/ssh/config -X GET --header "X-Vault-Token: ${config["login",$ORG]}")
 | 
					    VAULT_STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://$VAULT_DOMAIN/v1/cli/data/$USERNAME/settings/ssh/config -X GET --header "X-Vault-Token: ${config["login",$ORG]}")
 | 
				
			||||||
    if [[ $VAULT_STATUS -eq 200 ]]
 | 
					    if [[ $VAULT_STATUS -eq 200 ]]
 | 
				
			||||||
    then
 | 
					    then
 | 
				
			||||||
        echo $(curl https://$VAULT_DOMAIN/v1/cli/data/$USERNAME/settings/ssh/config -X GET --header "X-Vault-Token: ${config["login",$ORG]}" -s | jq -r '.data.data.data') | base64 -d > ~/.ssh/config 2>&1
 | 
					        SSH1_CONFIG_MD5=$(curl https://$VAULT_DOMAIN/v1/cli/data/$USERNAME/settings/ssh/config -X GET --header "X-Vault-Token: ${config["login",$ORG]}" -s | jq -r '.data.data.data' | base64 -d | md5sum | base64)
 | 
				
			||||||
        chmod 700 ~/.ssh/config
 | 
					        SSH2_CONFIG_MD5=$(cat ~/.ssh/config | md5sum | base64)
 | 
				
			||||||
 | 
					        if [[ $SSH1_CONFIG_MD5 != $SSH2_CONFIG_MD5 ]]
 | 
				
			||||||
 | 
					        then
 | 
				
			||||||
 | 
					            echo $(curl https://$VAULT_DOMAIN/v1/cli/data/$USERNAME/settings/ssh/config -X GET --header "X-Vault-Token: ${config["login",$ORG]}" -s | jq -r '.data.data.data') | base64 -d > ~/.ssh/config 2>&1
 | 
				
			||||||
 | 
					            chmod 700 ~/.ssh/config
 | 
				
			||||||
 | 
					        fi
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										9
									
								
								wx
									
									
									
									
									
								
							
							
						
						
									
										9
									
								
								wx
									
									
									
									
									
								
							@@ -512,8 +512,13 @@ wx-ssh-config-sync(){
 | 
				
			|||||||
    VAULT_STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://$VAULT_DOMAIN/v1/cli/data/$USERNAME/settings/ssh/config -X GET --header "X-Vault-Token: ${config["login",$ORG]}")
 | 
					    VAULT_STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://$VAULT_DOMAIN/v1/cli/data/$USERNAME/settings/ssh/config -X GET --header "X-Vault-Token: ${config["login",$ORG]}")
 | 
				
			||||||
    if [[ $VAULT_STATUS -eq 200 ]]
 | 
					    if [[ $VAULT_STATUS -eq 200 ]]
 | 
				
			||||||
    then
 | 
					    then
 | 
				
			||||||
        echo $(curl https://$VAULT_DOMAIN/v1/cli/data/$USERNAME/settings/ssh/config -X GET --header "X-Vault-Token: ${config["login",$ORG]}" -s | jq -r '.data.data.data') | base64 -d > ~/.ssh/config 2>&1
 | 
					        SSH1_CONFIG_MD5=$(curl https://$VAULT_DOMAIN/v1/cli/data/$USERNAME/settings/ssh/config -X GET --header "X-Vault-Token: ${config["login",$ORG]}" -s | jq -r '.data.data.data' | base64 -d | md5sum | base64)
 | 
				
			||||||
        chmod 700 ~/.ssh/config
 | 
					        SSH2_CONFIG_MD5=$(cat ~/.ssh/config | md5sum | base64)
 | 
				
			||||||
 | 
					        if [[ $SSH1_CONFIG_MD5 != $SSH2_CONFIG_MD5 ]]
 | 
				
			||||||
 | 
					        then
 | 
				
			||||||
 | 
					            echo $(curl https://$VAULT_DOMAIN/v1/cli/data/$USERNAME/settings/ssh/config -X GET --header "X-Vault-Token: ${config["login",$ORG]}" -s | jq -r '.data.data.data') | base64 -d > ~/.ssh/config 2>&1
 | 
				
			||||||
 | 
					            chmod 700 ~/.ssh/config
 | 
				
			||||||
 | 
					        fi
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user