Wednesday, October 16, 2019

Clone Solaris Guest DOM to another CDOM

Clone Guest DOM to another CDOM

1. Shutdown source Guest DOM
2. Create snapshot of source guest DOM disk
zfs snapshot -r rpool/vdisks/gdom001/gdom001-disk0@clone
3. Send source snapshot to destination, destination pool and zfs can be redefined
On destination:
 zfs create -V 100gb vpool/vdisks/gdom002/gdom002-disk0

On source
 zfs send rpool/vdisks/gdom001/gdom001-disk0@clone | ssh dsthost zfs recv -F vpool/vdisks/gdom002/gdom002-disk0

4. Create new guest DOM with the disk cloned
# ldm add-domain gdom002
add whole core
# ldm set-core 1 gdom002

# ldm add-mem 32G gdom002
# ldm add-vnet vnet0 primary-vsw0 gdom002
# ldm add-vdsdev /dev/zvol/dsk/vpool/vdisks/gdom002/gdom002-disk0 gdom002_disk0@primary-vds0
# ldm add-vdisk disk0 gdom002_disk0@primary-vds0 gdom002
# zfs snapshot vpool/vdisks/gdom002-disk0@version_1
# ldm set-var auto-boot\?=true gdom002
# ldm set-var boot-device=disk0 gdom002
# ldm bind-domain gdom002
# ldm list-domain gdom002
# ldm start gdom002

Friday, October 11, 2019

RedHat 7 Rejoin AD Domain

RedHat 7

# Unjoin AD Directory
realm leave org.ad.goweekend.ca

# Join AD Directory
realm join org.ad.goweekend.ca -U <user Name>

systemctl restart smb
systemctl restart nmb
systemctl restart sssd

Solaris PF Flows


Packet Processing


image:Graphic shows the flow of a packet through the OpenBSD Packet Firewall.


Thursday, October 3, 2019

Check URL Status with Curl

if [ $# -lt 1 ]; then
  echo "%%TCS-E-PARAMETER, url is not found."
  exit $LINENO
fi

tgtUrl=$1

urlRexp="https{0,1}://.{1}"

if [[ ! $tgtUrl =~ $urlRexp ]]; then
  echo "%%TCS-E-PARAMETER, target url must start with https://"
  exit $LINENO
fi

pid=$$


checkStatus=`curl -o /dev/null --silent --head --write-out '%{http_code}\n' $tgtUrl`

case $checkStatus in
        2*)
                echo "$checkStatus OK: $tgtUrl"
                exit 0
                ;;
        3*)
                echo "$checkStatus Redirection Happened to reach: $tgtUrl"
                exit 0
                ;;
        4*)
                echo "$checkStatus Client error to reach: $tgtUrl"
                exit $LINENO
                ;;
        5*)
                echo "$checkStatus Server error to reach: $tgtUrl"
                exit $LINENO
                ;;
        *)
                echo "$checkStatus No valid HTTP response code to: $tgtUrl"
                exit $LINENO
                ;;
esac