Skip to content

VMAccess: Add Azure Linux / Mariner support to sshd_config reset#2174

Open
jonathanbrenes wants to merge 1 commit into
Azure:masterfrom
jonathanbrenes:fix/vmaccess-azurelinux-sshd-config
Open

VMAccess: Add Azure Linux / Mariner support to sshd_config reset#2174
jonathanbrenes wants to merge 1 commit into
Azure:masterfrom
jonathanbrenes:fix/vmaccess-azurelinux-sshd-config

Conversation

@jonathanbrenes
Copy link
Copy Markdown

Problem

As preparation for the release of Azure Linux 4.0, this patch adds support for Azure Linux and CBL-Mariner to the VMAccess extension's sshd_config reset functionality.

When az vm user reset-ssh is triggered on Azure Linux (or CBL-Mariner), _get_default_ssh_config_filename() falls through to the generic default resource file because NAME="Azure Linux" does not match any of the existing distro regexes (centos, debian, fedora, red hat, suse, ubuntu).

The default resource file is a Debian/Ubuntu-era sshd_config that causes the following problems on Azure Linux:

  • SFTP broken: wrong Subsystem path (/usr/lib/openssh/sftp-server instead of /usr/libexec/openssh/sftp-server)
  • Multiple deprecated directive warnings from sshd -t
  • Unable to load host key: /etc/ssh/ssh_host_dsa_key (DSA removed)
  • Include directive dropped: Include /etc/ssh/sshd_config.d/*.conf removed, causing all drop-in config snippets (cloud-init, Azure) to be silently lost
  • PasswordAuthentication explicitly set to yes
  • PermitRootLogin uses old without-password syntax

Fix

  1. Added azure\s?linux|mariner regex to _get_default_ssh_config_filename() returning azurelinux_default. This matches:

    • Azure Linux: NAME="Azure Linux"
    • CBL-Mariner: NAME="Common Base Linux Mariner"
  2. Added VMAccess/resources/azurelinux_default: stock Azure Linux sshd_config with no deprecated directives, correct SFTP path, and Include directive preserved.

Testing

Tested on an Azure Linux VM:

Check Before (default) After (azurelinux_default)
sshd -t errors 6 warnings/errors 0
SFTP Subsystem path /usr/lib/openssh/sftp-server (wrong) /usr/libexec/openssh/sftp-server (correct)
Include directive Missing Present
DSA host key reference Present (file doesn't exist) Absent
PasswordAuthentication yes Commented out (default: no)
sshd restart Clean (after warnings) Clean

Files Changed

  • VMAccess/vmaccess.py — added Azure Linux / Mariner match in _get_default_ssh_config_filename()
  • VMAccess/resources/azurelinux_default — new sshd_config template for Azure Linux

…g_filename

As preparation for the release of Azure Linux 4.0, this patch adds
support for Azure Linux and CBL-Mariner to the VMAccess extension's
sshd_config reset functionality.

When 'az vm user reset-ssh' is triggered on Azure Linux (or
CBL-Mariner), _get_default_ssh_config_filename() falls through to the
generic 'default' resource file because NAME="Azure Linux" does not
match any of the existing distro regexes (centos, debian, fedora,
red hat, suse, ubuntu).

The 'default' resource file is a Debian/Ubuntu-era sshd_config that
causes the following problems on Azure Linux:

- SFTP broken: wrong Subsystem path (/usr/lib/openssh/sftp-server
  instead of /usr/libexec/openssh/sftp-server)
- Multiple deprecated directive warnings from sshd -t
- Unable to load host key: /etc/ssh/ssh_host_dsa_key (DSA removed)
- Include /etc/ssh/sshd_config.d/*.conf directive dropped, causing
  all sshd_config.d snippets (cloud-init, Azure) to be silently lost
- PasswordAuthentication explicitly set to yes
- PermitRootLogin uses old 'without-password' syntax

Changes:
1. Add 'azure\s?linux|mariner' regex to _get_default_ssh_config_filename()
   returning 'azurelinux_default'. This matches:
   - Azure Linux: NAME="Azure Linux"
   - CBL-Mariner: NAME="Common Base Linux Mariner"

2. Add resources/azurelinux_default: stock Azure Linux sshd_config.
   Clean config with no deprecated directives, correct SFTP path,
   and Include directive preserved.

Tested on an Azure Linux VM:
- sshd -t: 0 errors (vs 6 with 'default')
- SFTP Subsystem: /usr/libexec/openssh/sftp-server (correct)
- Include /etc/ssh/sshd_config.d/*.conf: preserved
- sshd restart: clean
@jonathanbrenes jonathanbrenes requested review from a team, D1v38om83r and nkuchta as code owners May 19, 2026 19:29
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