Categories
Uncategorized

TrueImage DS918+

Googled this and realised DS918+ is not supported for this.

Reddit users talking about install docker DSM inside DSM to bypass the restriction and I thought if it runs on Docker then it’s not CPU arch type issue, just some config level restriction. Which turns out to be true.

To bypass it, download the docker package from below URL and get a hex editor.

https://archive.synology.com/download/Package/spk/AcronisTrueImage/1.0.0000/AcronisTrueImage-dockerx64-1.0.0000.spk

Open the file and edit archtype dockerx64 to x86_64 then ensure backfill the reduced characters into places like description as it does have size check.

Manually install the package file from the package manager. It will prompt for crc check error, but you can ignore and continue.

Categories
Uncategorized

[BASH] Repeat Build Step

When you need to print out YAML build step for multiple environments.

DEPLOY_ENVS=(staging:account1 staging2:account2)

build_pipeline_step() {
  yaml_orig=$1
  for DEPLOY_ENV in "${DEPLOY_ENVS[@]}"
    do
      IFS=':' read -r -a DEPLOY_ENV_ARRAY <<< "$DEPLOY_ENV"
      DEPLOY_ENV=${DEPLOY_ENV_ARRAY[0]}
      DEPLOY_ACCOUNT=${DEPLOY_ENV_ARRAY[1]}
      yaml="$(sed "s/DEPLOY_ENV/${DEPLOY_ENV}/g" <<< "$yaml_orig")"
      yaml="$(sed "s/DEPLOY_ACCOUNT/${DEPLOY_ACCOUNT}/g" <<< "$yaml")"
      echo "$yaml"
    done
   echo "  - wait"
}

build_pipeline_step "$(cat <<EOF
  - label: 'DEPLOY_ENV - DEPLOY_ACCOUNT'
    commands: "echo hello DEPLOY_ENV"
EOF
)"
Categories
Uncategorized

CloudFlare Log Search

  1. Get the Zone ID
    Select domain name from the dashboard then zone ID will show on bottom right corner.
  2. Get the API Key
    Select log search template to give minimum privilege
  3. (Optional) Look up the fields available
curl -s -H "X-Auth-Email: <EMAIL>" -H "Authorization: Bearer <API KEY>" "https://api.cloudflare.com/client/v4/zones/<Zone ID>/logs/received/fields" | jq .

4. Run Log Search (modify date & time bit as you need)

curl -s \
    -H "X-Auth-Email: <EMAIL>" \
    -H "Authorization: Bearer <API KEY>" \
    "https://api.cloudflare.com/client/v4/zones/<ZONE ID>/logs/received?start=2020-06-18T17:21:37Z&amp;end=2020-06-18T17:38:01Z&amp;fields=ClientRequestPath,ClientIP,ClientRequestUserAgent,EdgeResponseStatus,OriginResponseStatus,EdgeStartTimestamp,EdgeEndTimestamp" > temp.txt

5. Filter Logs (Adjust the condition as you need)

cat temp.txt | jq 'select(.ClientIP == "<IP>" and .ClientRequestPath == "<ENDPOINT>") | .EdgeStartTimestamp |= (. / 1000000000 | strftime("%Y-%m-%d %H:%M:%S UTC")) | .EdgeEndTimestamp |= (. / 1000000000 | strftime("%Y-%m-%d %H:%M:%S UTC"))'

Categories
Uncategorized

AWS TGW VPN using Unify UDM

Transit Gateway (TGW) is a managed cloud router service provided by AWS and it supports direct VPN attachment.

The setup is little bit tricky as UDM doesn’t support BGP.

1. Create a Customer Gateway
Select Dynamic routing and enter your router public IP

2. Create VPN Profile
Select your local transit gateway & customer gateway just created.
Routing options need to be static for this one.

3. Add UDM IP ranges into VPC routing table
Set the target as local transit gateway

4. Also add UDM IP ranges into transit gateway routing table
attachments are two VPN endpoints created above

5. Add VPN profile in UDM
Ensure ‘Dynamic Routing’ is enabled in advance option
It seems like remote subnets defined here is for routing table so if you try to make 2nd tunnel with the same remote subnets then it will reject it.

6. Test
Your VPN profile will now show up as “UP” and traffic should be routable for both directions. Check your security group if it doesn’t work.
In Network Manager, your VPN status will show up as impaired as 2nd tunnel is not set.