Skip to content

Commit b88ca54

Browse files
committed
fix: ensure ttyd password is always 16 characters
Use more base64 bytes before filtering to guarantee 16 alphanumeric chars
1 parent 52d3ede commit b88ca54

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/lib/gcp.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -995,8 +995,8 @@ echo "✓ Frontend service started on port 3000" >> /var/log/startup.log
995995
# Start ttyd web terminal service
996996
echo "Starting ttyd web terminal..." >> /var/log/startup.log
997997
998-
# Generate a random password for ttyd authentication
999-
TTYD_PASSWORD=$(openssl rand -base64 12 | tr -dc 'a-zA-Z0-9' | head -c 16)
998+
# Generate a random password for ttyd authentication (use more bytes to ensure 16 chars after filtering)
999+
TTYD_PASSWORD=$(openssl rand -base64 24 | tr -dc 'a-zA-Z0-9' | head -c 16)
10001000
10011001
# Store the password in VM metadata for the dashboard to retrieve
10021002
curl -X PUT "http://metadata.google.internal/computeMetadata/v1/instance/attributes/ttyd-password" \\

0 commit comments

Comments
 (0)