Skip to content

Commit fbe7ced

Browse files
committed
ci: validate /etc/hosts DNS bypass approach
1 parent 964c500 commit fbe7ced

1 file changed

Lines changed: 57 additions & 0 deletions

File tree

.github/workflows/diag-hosts.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Validate /etc/hosts DNS bypass for Bunny
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
validate:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Install rclone
11+
run: curl -fsSL https://rclone.org/install.sh | sudo bash
12+
13+
- name: Configure rclone for Bunny S3 (share zone)
14+
env:
15+
ENDPOINT: ${{ secrets.BUNNY_S3_ENDPOINT }}
16+
ACCESS: ${{ secrets.BUNNY_S3_ACCESS_KEY }}
17+
SECRET: ${{ secrets.BUNNY_S3_SECRET_KEY }}
18+
run: |
19+
mkdir -p ~/.config/rclone
20+
cat > ~/.config/rclone/rclone.conf <<EOF
21+
[bunny]
22+
type = s3
23+
provider = Other
24+
env_auth = false
25+
access_key_id = ${ACCESS}
26+
secret_access_key = ${SECRET}
27+
endpoint = ${ENDPOINT}
28+
force_path_style = true
29+
acl = private
30+
EOF
31+
32+
- name: Pin endpoint host in /etc/hosts
33+
env:
34+
ENDPOINT: ${{ secrets.BUNNY_S3_ENDPOINT }}
35+
run: |
36+
HOST=$(echo "$ENDPOINT" | sed -E 's#^https?://##; s#[/:].*##')
37+
echo "Endpoint host: $HOST"
38+
IP=""
39+
for attempt in 1 2 3 4 5; do
40+
IP=$(getent ahostsv4 "$HOST" 2>/dev/null | awk '{print $1}' | sort -u | head -1)
41+
if [ -n "$IP" ]; then echo "Resolved (attempt $attempt): $IP"; break; fi
42+
echo "Attempt $attempt: resolution failed, retrying..."
43+
sleep 2
44+
done
45+
if [ -z "$IP" ]; then
46+
echo "WARN: never resolved; falling back to known Bunny storage IP 109.61.89.53"
47+
IP="109.61.89.53"
48+
fi
49+
echo "$IP $HOST" | sudo tee -a /etc/hosts >/dev/null
50+
echo "Pinned in /etc/hosts:"
51+
grep "$HOST" /etc/hosts
52+
53+
- name: rclone lsd with /etc/hosts pin
54+
env:
55+
BUCKET: ${{ secrets.BUNNY_S3_BUCKET }}
56+
run: |
57+
timeout 60 rclone lsd "bunny:${BUCKET}" --fast-list --verbose 2>&1 | tail -20 || echo "rclone lsd FAILED (exit $?)"

0 commit comments

Comments
 (0)