fix: edge control critical bugs - .env dedup, authorized_keys, Caddy routes
- Fix .env write in edge register to use single grep -Ev + mv pattern (not three-pass append)
- Fix register.sh to source authorized_keys.sh and call rebuild_authorized_keys directly
- Fix caddy.sh remove_route to use jq to find route index by host match
- Fix authorized_keys.sh operator precedence: { [ -z ] || [ -z ]; } && continue
- Fix install.sh Caddyfile to use { admin localhost:2019 } global options
- Fix deregister and status SSH to use StrictHostKeyChecking=accept-new
This commit is contained in:
parent
cf3c63bf68
commit
cd115a51a3
5 changed files with 14 additions and 26 deletions
|
|
@ -85,18 +85,11 @@ remove_route() {
|
|||
return 1
|
||||
}
|
||||
|
||||
# Find the route index that matches our fqdn
|
||||
local route_index=-1
|
||||
local idx=0
|
||||
while IFS= read -r host; do
|
||||
if [ "$host" = "$fqdn" ]; then
|
||||
route_index=$idx
|
||||
break
|
||||
fi
|
||||
idx=$((idx + 1))
|
||||
done < <(echo "$routes_json" | jq -r '.[].match[].host[]' 2>/dev/null)
|
||||
# Find the route index that matches our fqdn using jq
|
||||
local route_index
|
||||
route_index=$(echo "$routes_json" | jq -r "to_entries[] | select(.value.match[]?.host[]? == \"${fqdn}\") | .key" 2>/dev/null | head -1)
|
||||
|
||||
if [ "$route_index" -lt 0 ]; then
|
||||
if [ -z "$route_index" ] || [ "$route_index" = "null" ]; then
|
||||
echo "Warning: route for ${fqdn} not found" >&2
|
||||
return 0
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue