Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Yann E. MORIN" <yann.morin.1998@free.fr>
To: Will Eccles <will@eccles.dev>
Cc: buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH] package/openssh: reset umask when init script exits
Date: Thu, 21 Oct 2021 19:46:16 +0200	[thread overview]
Message-ID: <20211021174616.GD2400@scaer> (raw)
In-Reply-To: <20211018203038.32453-1-will@eccles.dev>

Will, All,

On 2021-10-18 16:30 -0400, Will Eccles spake thusly:
> S50sshd updates umask to 077, but does not reset it when it exits. This
> results in the root user's umask being configured incorrectly (assuming
> a default of 022 or otherwise). This patch adds a trap to reset umask
> when the script exits. This is convenient on systems where, for example,
> configs such as /etc/profile may not be sourced by the root user. It may
> also prevent issues with other init scripts which may inherit this umask
> unintentionally, leading to improper permissions elsewhere in the
> system.
> 
> Signed-off-by: Will Eccles <will@eccles.dev>

Besides what Arnout said (and which I agree with), I am not so sure this
patch is even technically correct... See below...

> ---
> Backport to: 2021.02.6, 2021.08.1
> (These are the releases on buildroot.org as of this writing, but as far
> as I can tell, even releases as far back as 2012 have the same problem.)
> ---
>  package/openssh/S50sshd | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/package/openssh/S50sshd b/package/openssh/S50sshd
> index 22da41d1ca..94cf4c14e8 100644
> --- a/package/openssh/S50sshd
> +++ b/package/openssh/S50sshd
> @@ -6,6 +6,8 @@
>  # Make sure the ssh-keygen progam exists
>  [ -f /usr/bin/ssh-keygen ] || exit 0
>  
> +# Reset uname at exit
> +trap "uname $(uname)" EXIT

This does not even do what you said it does. This is 'uname', not
'umask'...

Furthermore, the above code would fail anyway:

    $ uname $(uname); echo $?
    uname: extra operand ‘Linux’
    Try 'uname --help' for more information.
    1

So, if this very patch makes it work for you, then your issue is not
about umask being set below...

Regards,
Yann E. MORIN.

>  umask 077
>  
>  start() {
> -- 
> 2.33.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  parent reply	other threads:[~2021-10-21 17:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-18 20:30 [Buildroot] [PATCH] package/openssh: reset umask when init script exits Will Eccles
2021-10-19 20:25 ` Arnout Vandecappelle
2021-10-19 21:42   ` Will Eccles
2021-10-20 12:08     ` Arnout Vandecappelle
2021-10-20 13:57       ` Will Eccles
2021-10-21 17:46 ` Yann E. MORIN [this message]
2021-10-21 19:21   ` Will Eccles

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=20211021174616.GD2400@scaer \
    --to=yann.morin.1998@free.fr \
    --cc=buildroot@buildroot.org \
    --cc=will@eccles.dev \
    /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