Skip to content

Commit 5c50d71

Browse files
author
root
committed
Fix orchestrator heredoc vars and add nftables SSH safety
1 parent 095ef51 commit 5c50d71

File tree

3 files changed

+61
-9
lines changed

3 files changed

+61
-9
lines changed

docs/perfsonar/tools_scripts/perfSONAR-install-nftables.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ PY
9494

9595
# Colors
9696
GREEN='\033[0;32m'
97+
RED='\033[0;31m'
9798
NC='\033[0m'
9899

99100
usage() {
@@ -627,6 +628,42 @@ derive_subnets_and_hosts_from_config() {
627628

628629
log "Derived SUBNETS: ${SUBNETS[*]:-none}"
629630
log "Derived HOSTS: ${HOSTS[*]:-none}"
631+
632+
# Safety check: warn if no SSH access will be allowed
633+
if [ "${#SUBNETS[@]}" -eq 0 ] && [ "${#HOSTS[@]}" -eq 0 ]; then
634+
log ""
635+
log "${RED}WARNING: No SSH access subnets or hosts configured!${NC}"
636+
log "${RED}This will BLOCK all SSH access to this host.${NC}"
637+
log ""
638+
log "The nftables rules derive SSH access from /etc/perfSONAR-multi-nic-config.conf"
639+
log "No valid IPv4/IPv6 addresses with subnets were found in the configuration."
640+
log ""
641+
log "To allow SSH access, you must either:"
642+
log " 1. Configure /etc/perfSONAR-multi-nic-config.conf with proper IP addresses and prefixes"
643+
log " 2. Manually edit /etc/nftables.d/perfsonar.nft after it's created"
644+
log " 3. Use --dry-run to preview without applying changes"
645+
log ""
646+
log "If you proceed, SSH will be BLOCKED and you may lose access to this host!"
647+
log "Ensure you have console access before continuing."
648+
log ""
649+
650+
if [ "$AUTO_YES" != true ]; then
651+
read -r -p "Do you want to proceed anyway? [y/N]: " ans
652+
case "$ans" in
653+
[Yy]|[Yy][Ee][Ss])
654+
log "User confirmed proceeding despite SSH lockout risk"
655+
;;
656+
*)
657+
log "Aborted by user to prevent SSH lockout"
658+
exit 1
659+
;;
660+
esac
661+
else
662+
log "${RED}AUTO_YES enabled but no SSH access configured - ABORTING to prevent lockout${NC}"
663+
log "Configure /etc/perfSONAR-multi-nic-config.conf first or run without --yes"
664+
exit 1
665+
fi
666+
fi
630667
}
631668

632669
confirm_or_exit() {

docs/perfsonar/tools_scripts/perfSONAR-orchestrator.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,13 +208,13 @@ step_auto_update_compose() {
208208
set -e
209209
COMPOSE_DIR=/opt/perfsonar-tp
210210
LOGFILE=/var/log/perfsonar-auto-update.log
211-
log() { echo \"$(date -Iseconds) $*\" | tee -a \"$LOGFILE\"; }
212-
cd \"$COMPOSE_DIR\"
211+
log() { echo \"\$(date -Iseconds) \$*\" | tee -a \"\$LOGFILE\"; }
212+
cd \"\$COMPOSE_DIR\"
213213
log \"Checking for image updates...\"
214214
# Pull latest images and detect if any were actually updated
215-
if podman-compose pull 2>&1 | tee -a \"$LOGFILE\" | grep -q -E 'Downloaded newer image|Pulling from'; then
215+
if podman-compose pull 2>&1 | tee -a \"\$LOGFILE\" | grep -q -E 'Downloaded newer image|Pulling from'; then
216216
log \"New images found - recreating containers...\"
217-
podman-compose up -d 2>&1 | tee -a \"$LOGFILE\"
217+
podman-compose up -d 2>&1 | tee -a \"\$LOGFILE\"
218218
log \"Containers updated successfully\"
219219
else
220220
log \"No updates available\"

docs/personas/quick-deploy/install-perfsonar-testpoint.md

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ If replacing an existing instance, you may want to back up `/etc/perfsonar/` fil
2424
`lsregistrationdaemon.conf`, and any container volumes. We have a script named`perfSONAR-update-lsregistration.sh` to
2525
extract/save/restore registration config that you may want to use.
2626

27-
??? info "Quick capture of existing lsregistration config (if you have a src)"
27+
??? info "Quick capture of existing lsregistration config (if you have a prior installation)"
2828

2929
Download a temp copy:
3030
```bash
@@ -33,10 +33,17 @@ extract/save/restore registration config that you may want to use.
3333
-o /tmp/update-lsreg.sh
3434
chmod 0755 /tmp/update-lsreg.sh
3535
```
36-
Use the downloaded tool to extract a restore script:
36+
37+
**For container-based installations (testpoint):**
3738
```bash
3839
/tmp/update-lsreg.sh extract --output /root/restore-lsreg.sh
3940
```
41+
42+
**For RPM-based/local installations (toolkit or older hosts):**
43+
```bash
44+
/tmp/update-lsreg.sh extract --output /root/restore-lsreg.sh --local
45+
```
46+
4047
Note: Repository clone instructions are in Step 2.
4148
**Note:** All shell commands assume an interactive root shell.
4249

@@ -123,14 +130,22 @@ chmod 0755 /tmp/perfSONAR-orchestrator.sh
123130
124131
**Flags:**
125132
126-
- `--option {A|B}` — A = testpoint only; B = testpoint + Let's Encrypt
127-
- `--fqdn NAME` — primary FQDN for certificates (Option B)
128-
- `--email ADDRESS` — email for Let's Encrypt (Option B)
133+
- `--option {A|B}` — **Deployment mode:** A = testpoint only (default); B = testpoint with Let's Encrypt certificate automation
134+
- `--fqdn NAME` — primary FQDN for certificates (required for `--option B`)
135+
- `--email ADDRESS` — email for Let's Encrypt notifications (required for `--option B`)
129136
- `--non-interactive` — skip pauses, auto-confirm
130137
- `--yes` — auto-confirm internal script prompts
131138
- `--dry-run` — preview steps without executing
132139
- `--auto-update` — install and enable a systemd timer that pulls container images daily and restarts containers only if updated (creates `/usr/local/bin/perfsonar-auto-update.sh`, a systemd service and timer)
133140
141+
!!! tip "Deployment Mode Terminology"
142+
The orchestrator uses `--option A` or `--option B` to select the deployment mode:
143+
144+
- **Option A**: Testpoint only (no automatic certificate management)
145+
- **Option B**: Testpoint with Let's Encrypt automation (requires `--fqdn` and `--email`)
146+
147+
This is the same as "Path A" and "Path B" mentioned in other sections of this guide.
148+
134149
**If you choose this path, skip to [Step 7](#step-7-register-and-configure-with-wlcgosg)** (the orchestrator completes Steps 2–6 for you).
135150

136151
---

0 commit comments

Comments
 (0)