mimugmail / opn-repo

OPNsense repo by mimugmail
Other
325 stars 24 forks source link

Update cloudflared #175

Closed baudneo closed 6 months ago

baudneo commented 11 months ago

Cloudflared allows remote tunnel management in newer versions of cloudflared. It would be great to have a binary that supports that option as CloudFlare is constantly breaking cloudflared management.

As an example, you can no longer login to cloudflared using cloudflared tunnel login which makes it impossible to use or manage any argo tunnels because local management is unsupported without tunnel login. A new binary would allow remote management tunnels to work.

mimugmail commented 11 months ago

I need some beta testers for Unifi upgrade, already have the updated pkg in beta channel

baudneo commented 11 months ago

How can I switch to the beta channel for mimugmail repo only?

mimugmail commented 11 months ago

You edit the mimugmail.conf and replace /repo with /transfer and search for updates again

mihakralj commented 10 months ago

switch to beta channel: sudo sed -i '' 's|/repo/|/transfer/|g' /usr/local/etc/pkg/repos/mimugmail.conf

switch to main channel: sudo sed -i '' 's|/transfer/|/repo/|g' /usr/local/etc/pkg/repos/mimugmail.conf

baudneo commented 10 months ago

Cloudflared is stuck on the same version except a minor bump to _4. Bsd is also stuck at this version so I am assuming it's dependant on freebsd and their releases?

I can't seem to compile it myself either, not much experience with bsd.

Salsa0780 commented 6 months ago

@baudneo running into the same problem not being able to run cloudflared service install Were you able to find a solution?

baudneo commented 6 months ago

@Salsa0780 I spun up a lxc in proxmox and have cloudflared hosted in a docker container.

Salsa0780 commented 6 months ago

@baudneo thanks for the quick reply! I did manage to get it working. It seems the issue is with cloudflared itself not providing service support for BSD/rc.d (only Systemd and SysV), instead of a problem with the build provided here. See here: https://github.com/cloudflare/cloudflared/blob/33baad35b8d2d99dda35617a25b73ad0bcc4e6f9/cmd/cloudflared/linux_service.go#L229C2-L229C2

I ended up following a combination of this reddit thread and this example repo to manually create the service. Seems there is already a somewhat fleshed out config file here as well: /usr/local/etc/rc.d/cloudflared

finally, I was able to connect it up to a remotely managed tunnel by base64 decoding the string provided in the web GUI and copying into the <tag-UUID>.json file:

import base64

# from cloudflare tunnels dashboard `sudo cloudflared service install eyJhIjoidGhpcy1pcy10aGUtYWNjb3VudFRhZyIsInQiOiJ0aGlzLWlzLXRoZS10dW5uZWwtdXVpZCIsInMiOiJ0aGlzLWlzLXRoZS10dW5uZWwtc2VjcmV0In0=`
tunnel_creds_b64 = "eyJhIjoidGhpcy1pcy10aGUtYWNjb3VudFRhZyIsInQiOiJ0aGlzLWlzLXRoZS10dW5uZWwtdXVpZCIsInMiOiJ0aGlzLWlzLXRoZS10dW5uZWwtc2VjcmV0In0="
plain_text = base64.b64decode(tunnel_creds_b64)
print(plain_text)
# > b'{"a":"this-is-the-accountTag","t":"this-is-the-tunnel-uuid","s":"this-is-the-tunnel-secret"}'
sammyke007 commented 5 months ago

I'm running cloudflared as explained here using the port:

https://www.jackpearce.co.uk/cloudflared-opnsense/

This port is outdated (2023.10) and don't get updated that quickly. Can I change it to using the cloudflared from your repo without problems?