public inbox for initramfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Harald Hoyer <harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Liu ping fan <kernelfans-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Pingfan Liu <piliu-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] modules.d: introduce ssh-server module to provide service
Date: Wed, 21 Jun 2017 16:41:50 +0200	[thread overview]
Message-ID: <df37de69-8998-de90-d2cd-f3d619fff8d6@redhat.com> (raw)
In-Reply-To: <CAFgQCTtORd=carAxERPCh5GKhv7dmkGn1ios6-m885X1-JsrqA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On 12.06.2017 07:47, Liu ping fan wrote:
> Hi Harald, what is your opinion of such functionality?

yeah, nice, but some issues:

1) "inst" should be used instead of "inst_simple" for executables and *.so
2) That is a long hardcoded list of dependencies. Are they all needed?
3) The module should probably be renamed to rhel-7-ssh-server or a similar name
   to reflect, that it is most likely only working on this distribution variant
4) Does it have to be shipped in upstream dracut? Looks like this can live totally
   fine in a project, which lives outside of dracut.

> 
> Thanks and regards,
> Pingfan
> 
> On Wed, May 24, 2017 at 10:39 AM, Pingfan Liu <piliu-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:
>> When debugging a remote system, sometimes we may experience disk
>> failure. In this case, it makes debugging very unconformable if
>> there is no console server to forward the dmesg.
>> This new module install the sshd-required material in initramfs,
>> so later, sshd service can be started and let debugger login.
>>
>> Signed-off-by: Pingfan Liu <piliu-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
>> ---
>>  95ssh-server/module-setup.sh | 156 +++++++++++++++++++++++++++++++++++++++++++
>>  1 file changed, 156 insertions(+)
>>  create mode 100755 95ssh-server/module-setup.sh
>>
>> diff --git a/95ssh-server/module-setup.sh b/95ssh-server/module-setup.sh
>> new file mode 100755
>> index 0000000..65e1453
>> --- /dev/null
>> +++ b/95ssh-server/module-setup.sh
>> @@ -0,0 +1,156 @@
>> +#!/bin/bash
>> +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
>> +# ex: ts=8 sw=4 sts=4 et filetype=sh
>> +
>> +# fixme: assume user is root
>> +
>> +check() {
>> +
>> +    # If our prerequisites are not met, fail.
>> +    require_binaries sshd || return 1
>> +}
>> +
>> +depends() {
>> +    # We depend on network modules being loaded
>> +    echo network
>> +}
>> +
>> +
>> +copy_pam_conf()
>> +{
>> +    inst_simple /etc/pam.d/login
>> +    inst_simple /etc/pam.d/passwd
>> +    inst_simple /etc/pam.d/password-auth
>> +    inst_simple /etc/pam.d/password-auth-ac
>> +    inst_simple /etc/pam.d/sshd
>> +    inst_simple /etc/pam.d/sssd-shadowutils
>> +    inst_simple /etc/pam.d/system-auth
>> +    inst_simple /etc/pam.d/system-auth-ac
>> +    inst_simple /etc/pam.d/systemd-user
>> +    inst_simple /etc/pam.d/postlogin
>> +    inst_simple /etc/pam.d/postlogin-ac
>> +    inst_simple /etc/pam.d/remote
>> +    inst_simple /etc/pam.d/setup
>> +
>> +    inst_simple /etc/security/access.conf
>> +    inst_simple /etc/security/chroot.conf
>> +    inst_simple /etc/security/console.apps
>> +    inst_simple /etc/security/console.handlers
>> +    inst_simple /etc/security/console.perms
>> +    inst_simple /etc/security/console.perms.d
>> +    inst_simple /etc/security/group.conf
>> +    inst_simple /etc/security/limits.conf
>> +    inst_simple /etc/security/limits.d
>> +    inst_simple /etc/security/namespace.conf
>> +    inst_simple /etc/security/namespace.d
>> +    inst_simple /etc/security/namespace.init
>> +    inst_simple /etc/security/opasswd
>> +    inst_simple /etc/security/pam_env.conf
>> +    inst_simple /etc/security/sepermit.conf
>> +    inst_simple /etc/security/time.conf
>> +}
>> +
>> +copy_pam_binary()
>> +{
>> +    inst_simple /usr/lib64/security/pam_access.so
>> +    inst_simple /usr/lib64/security/pam_chroot.so
>> +    inst_simple /usr/lib64/security/pam_console.so
>> +    inst_simple /usr/lib64/security/pam_cracklib.so
>> +    inst_simple /usr/lib64/security/pam_debug.so
>> +    inst_simple /usr/lib64/security/pam_deny.so
>> +    inst_simple /usr/lib64/security/pam_echo.so
>> +    inst_simple /usr/lib64/security/pam_env.so
>> +    inst_simple /usr/lib64/security/pam_exec.so
>> +    inst_simple /usr/lib64/security/pam_faildelay.so
>> +    inst_simple /usr/lib64/security/pam_faillock.so
>> +    inst_simple /usr/lib64/security/pam_filter
>> +    inst_simple /usr/lib64/security/pam_filter.so
>> +    inst_simple /usr/lib64/security/pam_filter/upperLOWER
>> +    inst_simple /usr/lib64/security/pam_ftp.so
>> +    inst_simple /usr/lib64/security/pam_group.so
>> +    inst_simple /usr/lib64/security/pam_issue.so
>> +    inst_simple /usr/lib64/security/pam_keyinit.so
>> +    inst_simple /usr/lib64/security/pam_lastlog.so
>> +    inst_simple /usr/lib64/security/pam_limits.so
>> +    inst_simple /usr/lib64/security/pam_listfile.so
>> +    inst_simple /usr/lib64/security/pam_localuser.so
>> +    inst_simple /usr/lib64/security/pam_loginuid.so
>> +    inst_simple /usr/lib64/security/pam_mail.so
>> +    inst_simple /usr/lib64/security/pam_mkhomedir.so
>> +    inst_simple /usr/lib64/security/pam_motd.so
>> +    inst_simple /usr/lib64/security/pam_namespace.so
>> +    inst_simple /usr/lib64/security/pam_nologin.so
>> +    inst_simple /usr/lib64/security/pam_permit.so
>> +    inst_simple /usr/lib64/security/pam_postgresok.so
>> +    inst_simple /usr/lib64/security/pam_pwhistory.so
>> +    inst_simple /usr/lib64/security/pam_rhosts.so
>> +    inst_simple /usr/lib64/security/pam_rootok.so
>> +    inst_simple /usr/lib64/security/pam_securetty.so
>> +    inst_simple /usr/lib64/security/pam_selinux.so
>> +    inst_simple /usr/lib64/security/pam_selinux_permit.so
>> +    inst_simple /usr/lib64/security/pam_sepermit.so
>> +    inst_simple /usr/lib64/security/pam_shells.so
>> +    inst_simple /usr/lib64/security/pam_stress.so
>> +    inst_simple /usr/lib64/security/pam_succeed_if.so
>> +    inst_simple /usr/lib64/security/pam_tally2.so
>> +    inst_simple /usr/lib64/security/pam_time.so
>> +    inst_simple /usr/lib64/security/pam_timestamp.so
>> +    inst_simple /usr/lib64/security/pam_tty_audit.so
>> +    inst_simple /usr/lib64/security/pam_umask.so
>> +    inst_simple /usr/lib64/security/pam_unix.so
>> +    inst_simple /usr/lib64/security/pam_unix_acct.so
>> +    inst_simple /usr/lib64/security/pam_unix_auth.so
>> +    inst_simple /usr/lib64/security/pam_unix_passwd.so
>> +    inst_simple /usr/lib64/security/pam_unix_session.so
>> +    inst_simple /usr/lib64/security/pam_userdb.so
>> +    inst_simple /usr/lib64/security/pam_warn.so
>> +    inst_simple /usr/lib64/security/pam_wheel.so
>> +    inst_simple /usr/lib64/security/pam_xauth.so
>> +    inst_simple /usr/sbin/faillock
>> +    inst_simple /usr/sbin/mkhomedir_helper
>> +    inst_simple /usr/sbin/pam_console_apply
>> +    inst_simple /usr/sbin/pam_tally2
>> +    inst_simple /usr/sbin/pam_timestamp_check
>> +    inst_simple /usr/sbin/pwhistory_helper
>> +    inst_simple /usr/sbin/unix_chkpwd
>> +    inst_simple /usr/sbin/unix_update
>> +}
>> +
>> +
>> +inst_pam()
>> +{
>> +    copy_pam_binary
>> +    copy_pam_conf
>> +}
>> +
>> +inst_sshd()
>> +{
>> +    inst_simple /usr/sbin/sshd
>> +    inst_simple /usr/libexec/openssh/sshd-keygen
>> +    inst_simple /etc/ssh/sshd_config
>> +    inst_simple /etc/ssh/ssh_host_rsa_key.pub
>> +    inst_simple /etc/ssh/ssh_host_rsa_key
>> +    inst_simple /etc/ssh/ssh_host_ecdsa_key
>> +    inst_simple /etc/ssh/ssh_host_ecdsa_key.pub
>> +    inst_simple /etc/ssh/ssh_host_ed25519_key
>> +    inst_simple /etc/ssh/ssh_host_ed25519_key.pub
>> +    inst_dir /var/empty/sshd
>> +    grep -E '^sshd:' /etc/passwd >> "$initdir/etc/passwd"
>> +    grep -E '^sshd:' /etc/group >> "$initdir/etc/group"
>> +    grep -E '^root:' /etc/passwd >> "$initdir/etc/passwd"
>> +    grep -E '^root:' /etc/group >> "$initdir/etc/group"
>> +    grep -E '^root:' /etc/shadow >> "$initdir/etc/shadow"
>> +    inst_simple   /root/.ssh/authorized_keys
>> +    chmod 600 -R ${initdir}/etc/ssh/
>> +    inst_simple /etc/sysconfig/sshd
>> +    inst_simple /usr/lib/systemd/system/sshd-keygen@.service
>> +    inst_simple /usr/lib/systemd/system/sshd-keygen.target
>> +    inst_simple /usr/lib/systemd/system/sshd.service
>> +    inst_simple /usr/lib/systemd/system/sshd@.service
>> +    inst_simple /usr/lib/systemd/system/sshd.socket
>> +}
>> +
>> +install() {
>> +    inst_sshd
>> +    inst_pam
>> +}
>> --
>> 2.7.4
>>

  parent reply	other threads:[~2017-06-21 14:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-24  2:39 [PATCH] modules.d: introduce ssh-server module to provide service Pingfan Liu
     [not found] ` <1495593594-26460-1-git-send-email-piliu-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-05-24  3:04   ` Dracut GitHub Import Bot
2017-05-26  3:23   ` Dave Young
     [not found]     ` <20170526032330.GA4475-0VdLhd/A9Pl+NNSt+8eSiB/sF2h8X+2i0E9HWUfgJXw@public.gmane.org>
2017-05-27  4:44       ` Pingfan Liu
2017-06-12  5:47   ` Liu ping fan
     [not found]     ` <CAFgQCTtORd=carAxERPCh5GKhv7dmkGn1ios6-m885X1-JsrqA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-06-21 14:41       ` Harald Hoyer [this message]
     [not found]         ` <df37de69-8998-de90-d2cd-f3d619fff8d6-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-06-21 15:14           ` Daniel Molkentin
     [not found]             ` <7871761b-2b6a-edd6-da43-35c17bebcd92-l3A5Bk7waGM@public.gmane.org>
2017-06-22  2:13               ` Pingfan Liu
2017-06-22  2:23           ` Pingfan Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=df37de69-8998-de90-d2cd-f3d619fff8d6@redhat.com \
    --to=harald-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=kernelfans-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=piliu-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox