Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.7.5: parse_ssh_config failing in ssh_util.py #2496

Closed
ubuntu-server-builder opened this issue May 10, 2023 · 7 comments
Closed

0.7.5: parse_ssh_config failing in ssh_util.py #2496

ubuntu-server-builder opened this issue May 10, 2023 · 7 comments
Labels
launchpad Migrated from Launchpad

Comments

@ubuntu-server-builder
Copy link
Collaborator

This bug was originally filed in Launchpad as LP: #1391303

Launchpad details
affected_projects = []
assignee = oddbloke
assignee_name = Dan Watkins
date_closed = 2016-08-10T14:59:13.818546+00:00
date_created = 2014-11-10T20:07:05.209384+00:00
date_fix_committed = 2014-11-22T02:14:49.111073+00:00
date_fix_released = 2016-08-10T14:59:13.818546+00:00
id = 1391303
importance = undecided
is_complete = True
lp_url = https://bugs.launchpad.net/cloud-init/+bug/1391303
milestone = None
owner = mah042
owner_name = Mark Horstman
private = False
status = fix_released
submitter = mah042
submitter_name = Mark Horstman
tags = ['cloud-init-0.7.7']
duplicates = []

Launchpad user Mark Horstman(mah042) wrote on 2014-11-10T20:07:05.209384+00:00

I've been successfully using cloud-init 0.7.4 in a centos 6.5 image I created under an icehouse environment we're running. When I recently created a new centos 6.5 image and yum installed cloud-init (from http://download.fedoraproject.org/pub/epel/6/x86_64) , I got 0.7.5 (cloud-init.x86_64 0:0.7.5-10.el6.centos.2). 0.7.5 is failing in places 0.7.4 wasn't like setting up the ssh keys for the user. I turned on DEBUG for cloud-init console logging in /etc/cloud/cloud.cfg.d/05_logging.cfg:

[handler_consoleHandler]
class=StreamHandler
level=DEBUG
formatter=arg0Formatter
args=(sys.stderr,)

and here's /var/log/cloud-init-output.log http://pastebin.ubuntu.com/8869713/

Attached is a zip file containing copies of my /etc/ssh/sshd_config temporary keys I used that were generated via the OpenStack gui.

@ubuntu-server-builder ubuntu-server-builder added the launchpad Migrated from Launchpad label May 10, 2023
@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Mark Horstman(mah042) wrote on 2014-11-10T20:07:05.209384+00:00

Launchpad attachments: files.zip

@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Mark Horstman(mah042) wrote on 2014-11-10T22:07:03.310794+00:00

It seems to have something to do with the last line I added to /etc/ssh/sshd_config:
PermitRootLogin=no

If I remove that line, parse_ssh_config() in ssh_util.py no longer fails

@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Anthony D'Atri(aad-r) wrote on 2014-11-10T23:50:56+00:00

I've experienced issues with 2.7.4 and a similar append of lines to sshd_config. cloud-init appears to eat a terminal newline, leaving the file without one, which alone can cause problems that are only made worse by future edits like:

echo "PermitRootLogin without-password" >>/etc/ssh/sshd_config

in that this can result in the last line of the file looking like:

ServerAliveInterval 300PermitRootLogin without-password

which prevents sshd from starting at next reboot. I've taken to echoing several blank lines onto the end of the file to avoid this.

--aad

It seems to have something to do with the last line I added to /etc/ssh/sshd_config:
PermitRootLogin=no

If I remove that line, parse_ssh_config() in ssh_util.py no longer fails

--
You received this bug notification because you are subscribed to cloud-
init.
Matching subscriptions: cloud-init
https://bugs.launchpad.net/bugs/1391303

Title:
0.7.5: parse_ssh_config failing in ssh_util.py

Status in Init scripts for use on cloud images:
New

Bug description:
I've been successfully using cloud-init 0.7.4 in a centos 6.5 image I
created under an icehouse environment we're running. When I recently
created a new centos 6.5 image and yum installed cloud-init (from
http://download.fedoraproject.org/pub/epel/6/x86_64) , I got 0.7.5
(cloud-init.x86_64 0:0.7.5-10.el6.centos.2). 0.7.5 is failing in
places 0.7.4 wasn't like setting up the ssh keys for the user. I
turned on DEBUG for cloud-init console logging in
/etc/cloud/cloud.cfg.d/05_logging.cfg:

[handler_consoleHandler]
class=StreamHandler
level=DEBUG
formatter=arg0Formatter
args=(sys.stderr,)

and here's /var/log/cloud-init-output.log
http://pastebin.ubuntu.com/8869713/

Attached is a zip file containing copies of my /etc/ssh/sshd_config
temporary keys I used that were generated via the OpenStack gui.

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1391303/+subscriptions

@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Mark Horstman(mah042) wrote on 2014-11-11T15:40:40.073528+00:00

It would seem cloud-init doesn't like the "=" in "PermitRootLogin=no" in /etc/ssh/sshd_config. Also, something, I assume cloud-init, is removing the last from /etc/ssh/sshd_config.

If I change the /etc/ssh/sshd_config line I added from:
PermitRootLogin=no
to:
PermitRootLogin no

it no longer fails. Sshd does not complain about the "=".

It would seem cloud-init can't deal with "=" as var/val assignments in /etc/ssh/sshd_config and it's erroneously removing the last from the file (/etc/ssh/sshd_config).

This is strictly a guess based upon the behavior observed through trial and error, I have not examined the source code.

@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Dan Watkins(oddbloke) wrote on 2014-11-12T13:26:37.971075+00:00

I'm looking at fixing the '=' problem now.

@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Dan Watkins(oddbloke) wrote on 2014-11-12T13:57:13.038010+00:00

The attached branch should fix the '=' problem.

@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Scott Moser(smoser) wrote on 2016-08-10T14:59:12.810658+00:00

This is fixed in cloud-init 0.7.7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
launchpad Migrated from Launchpad
Projects
None yet
Development

No branches or pull requests

1 participant