1
23.7 Legacy Series / Re: Wireguard interface not coming up on reboot, error in logs
« on: December 04, 2023, 08:38:02 pm »
Hey jbattermann. Did you solve this issue?
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
#!/bin/sh
. /etc/rc.subr
name="argotunnel"
rcvar="argotunnel_enable"
argotunnel_flags="tunnel --config /root/.cloudflared/config.yml"
command_args="run"
command="/usr/local/bin/cloudflared"
load_rc_config $name
run_rc_command "$1"
3. chmod +x /etc/rc.d/argotunnelargotunnel_enable='YES'
5. Create this script: /root/.cloudflared/automatic_restart.sh#!/bin/bash
SERVICE="cloudflared"
if pgrep -x "$SERVICE" >/dev/null
then
echo "$SERVICE is running"
else
echo "$SERVICE stopped"
/usr/sbin/daemon /etc/rc.d/argotunnel start
fi
6. Create a cron action: /usr/local/opnsense/service/conf/actions.d/actions_argotunnel.conf[start]
command:/bin/sh /root/.cloudflared/automatic_restart.sh
parametes:
type:script
message:starting cloudflared if necessary
description:Check and restart cloudflared
7. Restart cron servicesservice configd restart
8. Create a cron in the OPNsense UI with "Check and restart cloudflared” as command
Do you have DoT setup (https://1.1.1.1/help)?Yes! This is my result: https://1.1.1.1/help#eyJpc0NmIjoiTm8iLCJpc0RvdCI6IlllcyIsImlzRG9oIjoiTm8iLCJyZXNvbHZlcklwLTEuMS4xLjEiOiJZZXMiLCJyZXNvbHZlcklwLTEuMC4wLjEiOiJZZXMiLCJyZXNvbHZlcklwLTI2MDY6NDcwMDo0NzAwOjoxMTExIjoiTm8iLCJyZXNvbHZlcklwLTI2MDY6NDcwMDo0NzAwOjoxMDAxIjoiTm8iLCJkYXRhY2VudGVyTG9jYXRpb24iOiJCUlUiLCJpc1dhcnAiOiJObyIsImlzcE5hbWUiOiJDbG91ZGZsYXJlIiwiaXNwQXNuIjoiMTMzMzUifQ==
Did you add the above to Custom options with your gateway ID?Yes, you should add the above code into Custom Options, but change the xxxxxxxxx with your gateway ID from Cloudflare.
Under Miscellaneous do you have anything under DNS over TLS Servers?
Cadish, your example has a bunch of xxxxxxxxx in it, is that default or are we supposed to plug in some type of information there?Yes, the xxxxxxxxx is something you need to replace with your Gateway ID from Cloudflare. It's an ID which is linked to a Location that you've set. You can find it in your Cloudflare Teams Dashboard > Gateway > Locations > Edit (on a location). On that page, you can find the ID's to replace the xxxxxxxxx with.
# TLS Config
tls-cert-bundle: "/etc/ssl/cert.pem"
# Forwarding Config
forward-zone:
name: "."
forward-tls-upstream: yes
forward-addr: 172.64.36.1@853#xxxxxxxxx.cloudflare-gateway.com
forward-addr: 172.64.36.2@853#xxxxxxxxx.cloudflare-gateway.com
forward-addr: 2a06:98c1:54::28a@853#xxxxxxxxx.cloudflare-gateway.com
# DO NOT EDIT THIS FILE -- OPNsense auto-generated file
#
# User-defined crontab files can be loaded via /etc/cron.d
# or /usr/local/etc/cron.d and follow the same format as
# /etc/crontab, see the crontab(5) manual page.
SHELL=/bin/sh
PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
#minute hour mday month wday command
# Origin/Description: IDS/ids rule updates
45 23 * * * /usr/local/sbin/configctl ids update
# Origin/Description: cron/Check connection and reboot if necessary
*/5 * * * * /usr/local/sbin/configctl ping_check load