Files
algo/files/cloud-init/base.yml
Dan GuidoandClaude c9f0be9ac9 Fix SSH configuration indentation in cloud-init template
The sshd_config file was being written with incorrect indentation due to
the indent filter having first=True, which added 6 spaces to the first
line of the template. This caused SSH daemon to fail parsing the config
file, preventing SSH connections on the configured port (4160).

Changed indent(width=6, first=True) to indent(width=6, first=False) to
ensure the SSH configuration is written without leading spaces on each
line, allowing sshd to properly parse the configuration.

Fixes SSH connection timeouts during DigitalOcean deployments.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-15 10:58:00 -04:00

45 lines
1.2 KiB
YAML

#cloud-config
# CRITICAL: The above line MUST be exactly "#cloud-config" (no space after #)
# This is required by cloud-init's YAML parser. Adding a space breaks parsing
# and causes all cloud-init directives to be skipped, resulting in SSH timeouts.
# See: https://github.com/trailofbits/algo/issues/14800
output: {all: '| tee -a /var/log/cloud-init-output.log'}
package_update: true
package_upgrade: true
packages:
- sudo
{% if performance_preinstall_packages | default(false) %}
# Universal tools always needed by Algo (performance optimization)
- git
- screen
- apparmor-utils
- uuid-runtime
- coreutils
- iptables-persistent
- cgroup-tools
{% endif %}
users:
- default
- name: algo
homedir: /home/algo
sudo: ALL=(ALL) NOPASSWD:ALL
groups: adm,netdev
shell: /bin/bash
lock_passwd: true
ssh_authorized_keys:
- "{{ lookup('file', SSH_keys.public) }}"
write_files:
- path: /etc/ssh/sshd_config
content: |
{{ lookup('template', 'files/cloud-init/sshd_config') | indent(width=6, first=False) }}
runcmd:
- set -x
- ufw --force reset
- sudo apt-get remove -y --purge sshguard || true
- systemctl restart sshd.service