Bug 1248837 - cloud-init log file should log user creation and password updating action
cloud-init log file should log user creation and password updating action
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: cloud-init (Show other bugs)
7.0
Unspecified Unspecified
unspecified Severity unspecified
: pre-dev-freeze
: ---
Assigned To: Lars Kellogg-Stedman
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-07-30 19:51 EDT by Julie
Modified: 2015-08-04 13:31 EDT (History)
10 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-08-04 13:23:23 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Cloud_init_log (33.37 KB, image/png)
2015-07-30 19:55 EDT, Julie
no flags Details

  None (edit)
Description Julie 2015-07-30 19:51:12 EDT
In run once, user can use cloud-init to create a new user/set user password or change existing user password. This is, however, no logged in /var/log/cloud-init-output.log. Based on the feedback from our customer (SPARQ Solutions), I would like to request this major action logged.
Comment 1 Julie 2015-07-30 19:55:17 EDT
Created attachment 1057870 [details]
Cloud_init_log

Did not log user creating and updating password
Comment 2 Oved Ourfali 2015-08-02 01:18:08 EDT
Sounds like a bug in cloud-init, and not in RHEV-M.
Setting as "virt" to get a formal answer about that.
Comment 3 Omer Frenkel 2015-08-02 04:48:51 EDT
indeed, cloud init log is owned by cloud init, moving.

Julie, could you provide the guest os version and cloud-init version?
Comment 5 Julie 2015-08-02 05:50:55 EDT
(In reply to Omer Frenkel from comment #3)
> indeed, cloud init log is owned by cloud init, moving.
> 
> Julie, could you provide the guest os version and cloud-init version?

[test@cloud-init1 ~]$ cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 6.6 (Santiago)
[test@cloud-init1 ~]$ rpm -qa cloud-init
cloud-init-0.7.5-2.el6.x86_64

Cheers,
Julie
Comment 6 Lars Kellogg-Stedman 2015-08-04 13:23:23 EDT
cloud-init already logs this information.  It may not show up in /var/log/cloud-init.log, but it's available in the system journal.

Using this input:

    #cloud-config

    users:
      - default
      - name: lars
        gecos: Lars Kellogg-Stedman
        plain_txt_passwd: secret

I see this in the journal:

    # journalctl | grep lars
    Aug 04 12:22:55 citest.localdomain cloud-init[470]: [CLOUDINIT] __init__.py[DEBUG]: Adding user lars
    Aug 04 12:22:55 citest.localdomain cloud-init[470]: [CLOUDINIT] util.py[DEBUG]: Running hidden command to protect sensitive input/output logstring: ['useradd', 'lars', '--comment', 'Lars Kellogg-Stedman', '-m']
    Aug 04 12:22:55 citest.localdomain useradd[3349]: new group: name=lars, GID=1000
    Aug 04 12:22:55 citest.localdomain useradd[3349]: new user: name=lars, UID=1000, GID=1000, home=/home/lars, shell=/bin/bash
    Aug 04 12:22:56 citest.localdomain cloud-init[470]: [CLOUDINIT] util.py[DEBUG]: Running command ['passwd', '-l', 'lars'] with allowed return codes [0] (shell=False, capture=True)
    Aug 04 12:22:58 citest.localdomain cloud-init[3614]: ci-info: no authorized ssh keys fingerprints found for user lars.
    [root@citest ~]# grep lars /var/log/cloud-init.log 
    Aug  4 12:22:58 localhost cloud-init: ci-info: no authorized ssh keys fingerprints found for user lars.

Note that in the above we see both output from cloud-init itself as well as from the 'useradd' command, which also generates log entries when creating new users and groups.

For systems not running journald, these messages should be available in the system log, typically '/var/log/messages'.
Comment 7 Lars Kellogg-Stedman 2015-08-04 13:31:51 EDT
Note that for password changes with an existing account, I see:

Aug 04 13:29:28 citest.localdomain cloud-init[476]: [CLOUDINIT] __init__.py[INFO]: User operator already exists, skipping.
Aug 04 13:29:28 citest.localdomain cloud-init[476]: [CLOUDINIT] util.py[DEBUG]: Running command ['passwd', '-l', 'operator'] with allowed return codes [0] (shell=False, capture=True)

Note You need to log in before you can comment on or make changes to this bug.