Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@zmingxie
zmingxie / snat_dnat_advantech.md
Created November 12, 2022 01:17 — forked from tomasinouk/snat_dnat_advantech.md
examples of SNAT, DNAT with iptables for Advantech, Conel routers, with comments (probably will work on other routers where iptables can be manipulated, care needs to be taken on applying these commands after reboot).

Some examples of SNAT, DNAT with iptables with comments

mainly used in start-up script

How to test 'safely'

When we play with iptables aka firewall we might end up in situation, where we execute rule, which has unforseen impact - lock yourself out. Recovering from this situation is necessity.

How to:

  • Enable reboot via SMS.
  • Test all commands in shell first before putting them into Start-up script. This way the command will be wiped out, when unit is rebooted.

masquarade all outgoing packets to be WLAN0 IP

@zmingxie
zmingxie / nomad-vault.sh
Created July 30, 2021 15:43 — forked from greenbrian/nomad-vault.sh
Nomad + Vault agent
#!/usr/bin/env bash
if [ -f /mnt/ramdisk/token ]; then
exec env VAULT_TOKEN=$(vault unwrap -field=token $(jq -r '.token' /mnt/ramdisk/token)) \
/usr/local/bin/nomad agent \
-config=/etc/nomad.d \
-vault-tls-skip-verify=true
else
echo "Nomad service failed due to missing Vault token"
exit 1
@zmingxie
zmingxie / terraform.yaml
Created March 16, 2021 16:21
Terraform GitHub Action
name: 'Terraform'
on:
push:
branches:
- master
paths:
- ".github/workflows/terraform.yaml"
- "terraform/**"
pull_request:
@zmingxie
zmingxie / keybase.md
Created August 3, 2020 16:10
keybase.io

Keybase proof

I hereby claim:

  • I am zmingxie on github.
  • I am mxie (https://keybase.io/mxie) on keybase.
  • I have a public key ASAQG9nbKt9p3EKNIoG_3EoqEfEXVOi-rST_XP-iIutTlAo

To claim this, I am signing this object:

@zmingxie
zmingxie / aws-ssm-ec2-proxy-command.sh
Last active June 28, 2022 14:22
AWS SSM SSH Proxy Command
#!/usr/bin/env sh
######## Usage #################################################################
#
# #1 Install the AWS CLI
# https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html
#
# #2 Install the Session Manager Plugin for the AWS CLI
# https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-install-plugin.html
#