Month: June 2020

TrueImage DS918+

TrueImage can’t be installed on DS918+

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

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.

[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() {
  for DEPLOY_ENV in "${DEPLOY_ENVS[@]}"
      IFS=':' read -r -a DEPLOY_ENV_ARRAY <<< "$DEPLOY_ENV"
      yaml="$(sed "s/DEPLOY_ENV/${DEPLOY_ENV}/g" <<< "$yaml_orig")"
      yaml="$(sed "s/DEPLOY_ACCOUNT/${DEPLOY_ACCOUNT}/g" <<< "$yaml")"
      echo "$yaml"
   echo "  - wait"

build_pipeline_step "$(cat <<EOF
    commands: "echo hello DEPLOY_ENV"

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>" "<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>" \
    "<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"))'

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.