Monday, March 02, 2020

Passed AZ-900 Exam Today!


Officially Microsoft Certified Azure Fundamentals !!

Friday, February 14, 2020

Microsoft Ignite 2020


Tuesday, December 31, 2019

QBE CIO Award 2019


All the hard work is paid for ... QBE Cyber Security team has been recognized for exceptional performance!! 

Thursday, June 20, 2019

C# + Active Directory = Awesome!!


I have a need to review AD groups and local admin groups as part of the identity project -  to identity users who are having privileged access in AD or servers. I developed this tool to help with the quick search, detailed view, export, etc with UI.

Obviously this can be done with PowerShell, but I found there is limitation with PowerShell in regards to recursive lookup especially when dealing with foreign objects

As you can see below, there are different account type you can query, user, computer and group (with recursive option). You can also provide a different credential to query Active Directory as well as specifying a particular OU, LDAP filter and keyword doing the search.

  

The below UI provides the interface to query local groups in Windows machine. You can specify a single computer, computers in a particular OU or a text file containing a list of computers.
 

Friday, May 17, 2019

GoDaddy DNS Update Using API

I recently need to update my DNS entry which is hosted in GoDaddy. GoDaddy supports API call to update DNS entries, which is amazing!!

You need to generate the API key and secret.

create the file below and cronjob it!

#!/bin/bash

domain="domain.tld"
type="A"
name="@"
ttl="3600"
port="1"
weight="1"
key="my-api-key"
secret="my-api-secret"

headers="Authorization: sso-key $key:$secret"
echo "Headers = " $headers

result=$(curl -X GET -H "$headers" "https://api.godaddy.com/v1/domains/$domain/records/$type/$name")
echo "Result = " $result

dnsIP=$(echo $result | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b")
echo "DNS IP = " $dnsIP

ret=$(curl -s GET "http://ipinfo.io/json")
currentIP=$(echo $ret | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b")
echo "Current IP = " $currentIP

if [ $dnsIP != $currentIP ];
then
        echo "IP's are not equal, updating record"
        curl -X PUT "https://api.godaddy.com/v1/domains/$domain/records/$type/$name" \
                -H "accept: application/json" \
                -H "Content-Type: application/json" \
                -H "$headers" \
                -d "[ { \"data\": \"$currentIP\", \"port\": $port, \"priority\": 0, \"protocol\": \"string\", \"service\": \"string\", \"ttl\": $ttl, \"weight\": $weight } ]"
fi

if [ $dnsIP = $currentIP ];
then
        echo "IP's are equal, no update required"
fi