Skip to content

Instantly share code, notes, and snippets.

@indraAsLesmana
Last active November 24, 2024 10:01
Show Gist options
  • Save indraAsLesmana/8ab6d68bfd4115463facaf5ac7ddab3a to your computer and use it in GitHub Desktop.
Save indraAsLesmana/8ab6d68bfd4115463facaf5ac7ddab3a to your computer and use it in GitHub Desktop.
Only tunneling locally with cloudflared to make wildcard DNS work
cloudflared tunnel create <NAME> // eg. h96max this will generate id and credentials file json
##config.yml @ /.cloudflared
tunnel: 7d9f46b3-xxxx-4df9-xxxx-cc0417xxxx
credentials-file: /home/indra/.cloudflared/7d9f46b3-xxxx-4df9-xxxx-cc0417xxxx.json
ingress:
- hostname: cl.tutor93.com
service: https://localhost:8000
- hostname: "*.tutor93.com"
service: https://localhost
originRequest:
noTLSVerify: true
- service: https://localhost
##
cloudflared tunnel route dns 7d9f46b3-xxxx-4df9-xxxx-cc0417xxxx *.tutor93.com
cloudflared tunnel route ip add 192.168.2.0/24 7d9f46b3-xxxx-4df9-xxxx-cc0417xxxx
cloudflared tunnel run 7d9f46b3-xxxx-4df9-xxxx-cc0417xxxx
cloudflared service uninstall
sudo cloudflared --config /home/indra/.cloudflared/config.yml service install
systemctl start cloudflared
systemctl status cloudflared
ref:
https://community.cloudflare.com/t/wildcard-subdomain-dns-and-tunneling/632608/3
https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/configure-tunnels/local-management/configuration-file/
https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/get-started/create-local-tunnel/
https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/configure-tunnels/local-management/as-a-service/linux/
tunnel: 07491850-a981-4ef8-ab0b-75ad134c9ad8
credentials-file: /root/.cloudflared/07491850-a981-4ef8-ab0b-75ad134c9ad8.json
ingress:
- hostname: lify.my.id
service: http://localhost:8000
- hostname: coolify.lify.my.id
service: http://localhost:8000
- hostname: ssh.lify.my.id
service: ssh://localhost:22
- hostname: "*.lify.com"
service: http://localhost
originRequest:
noTLSVerify: true
- service: http://localhost
save to ssh_config on host mechine
Host ssh.lify.my.id
ProxyCommand /opt/homebrew/bin/cloudflared access ssh --hostname %h
User indra
HostName ssh.lify.my.id
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_rsa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment