Skip to content

Instantly share code, notes, and snippets.

@shirou
Created June 18, 2023 04:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shirou/095077c72767e246da5056f6753598f1 to your computer and use it in GitHub Desktop.
Save shirou/095077c72767e246da5056f6753598f1 to your computer and use it in GitHub Desktop.
#cloud-config
repo_update: true
repo_upgrade: all
packages:
- socat
write_files:
- content: |
[Unit]
Description=Socat Port forward
Wants=network-online.target
After=network-online.target
[Service]
Type=simple
ExecStart=/usr/bin/socat -d tcp4-listen:5432,reuseaddr,fork TCP:foo.example.com:5432
Restart=always
[Install]
WantedBy=multi-user.target
path: /etc/systemd/system/portforward.service
owner: root:root
runcmd:
- sudo systemctl start portforward
- sudo systemctl enable portforward
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment