Skip to content

root-ubuntu: ask for the hostname; /etc/hosts + cloud-init keep it - #146

Merged
ralyodio merged 1 commit into
masterfrom
root-ubuntu-hostname
Oct 6, 2026
Merged

ralyodio merged 1 commit into
masterfrom
root-ubuntu-hostname

Conversation

@ralyodio

@ralyodio ralyodio commented Oct 6, 2026

Copy link
Copy Markdown
Contributor
  • An interactive run asks Hostname for this box, its full DNS name (e.g. box1.example.com) [current]:. Unattended runs only rename the box when BOX_HOSTNAME is set.
  • Sets the name with hostnamectl and writes one 127.0.1.1 <fqdn> <short> line in /etc/hosts, so sudo doesn't print "unable to resolve host".
  • Writes /etc/cloud/cloud.cfg.d/99-preserve-hostname.cfg so cloud-init doesn't reset the name at boot.
  • A TS_HOSTNAME nobody set explicitly follows the new short name.
  • Fixes the existing "carries no personal identifiers" failure: a comment named a person.

Tested: bash -n; test/root-ubuntu.test.ts 184/184 (was 183/184 on master); a stubbed run of set_box_hostname covering rename, a no-op rerun, and an invalid name.

🤖 Generated with Claude Code

… across reboots

A stock image names the box after the image ("ubuntu", "user") and every
prompt repeats it. An interactive run now asks for the full DNS name
(BOX_HOSTNAME for unattended runs), sets it with hostnamectl, maps it and the
short name to 127.0.1.1, tells cloud-init to preserve it, and lets an unchosen
TS_HOSTNAME follow. Also drops a personal name from a comment, which the
script's own privacy test was failing on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown

ThreatCrush Security Scan

32 finding(s)

HIGH/CRITICAL: 7 | MEDIUM: 12 | LOW: 13

Severity Rule Location
HIGH py-ssrf-outbound-request dev2/dev2-site:147
HIGH py-ssrf-outbound-request dev2/dev2-site:884
HIGH py-ssrf-outbound-request dev2/dev2-site:1573
HIGH sh-remote-script-execution root-ubuntu.sh:3248
HIGH sh-remote-script-execution root-ubuntu.sh:3249
HIGH sh-remote-script-execution root-ubuntu.sh:5137
HIGH sh-remote-script-execution root-ubuntu.sh:5141
MEDIUM sql-template-interpolation dev2/dev2-site:1110
MEDIUM sql-template-interpolation dev2/dev2-site:1187
MEDIUM sh-remote-script-execution root-ubuntu.sh:5314
MEDIUM redos-nested-quantifier src/domain-free.ts:56
MEDIUM redos-nested-quantifier src/emoji.ts:167
MEDIUM redos-nested-quantifier src/icon.ts:166
MEDIUM redos-nested-quantifier src/mail.ts:1047
MEDIUM sql-template-interpolation src/users-dump.ts:487
MEDIUM sql-string-concatenation src/users-dump.ts:507
MEDIUM sql-template-interpolation src/users-dump.ts:540
MEDIUM sql-string-concatenation src/users-dump.ts:574
MEDIUM redos-nested-quantifier src/wcag.ts:556
LOW secret-generic-credential src/credentials.ts:36
LOW secret-generic-credential src/credentials.ts:53
LOW secret-generic-credential src/credentials.ts:56
LOW secret-generic-credential src/user-export.ts:687
LOW secret-generic-credential src/user-export.ts:693
LOW secret-generic-api-key test/credentials.test.ts:208
LOW secret-generic-credential test/mail.test.ts:141
LOW secret-generic-credential test/proxy.test.ts:52
LOW secret-generic-credential test/proxy.test.ts:68
LOW secret-generic-credential test/shorten.test.ts:36
LOW secret-database-url test/users-dump.test.ts:108
LOW secret-database-url test/users-dump.test.ts:119
LOW secret-database-url test/users-dump.test.ts:120

Snippets are redacted; ThreatCrush never prints matched credential material.

@ralyodio
ralyodio merged commit 5c22744 into master Oct 6, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant