From: "Yann E. MORIN" <yann.morin.1998@free.fr>
To: Giulio Benetti <giulio.benetti@benettiengineering.com>
Cc: Giulio Benetti <giulio.benetti+tekvox@benettiengineering.com>,
James Autry <jautry@tekvox.com>,
Matthew Maron <matthewm@tekvox.com>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
buildroot@buildroot.org, Jim Reinhart <jimr@tekvox.com>
Subject: Re: [Buildroot] [PATCH] package/apache-utils: new package
Date: Sat, 16 Sep 2023 00:17:28 +0200 [thread overview]
Message-ID: <20230915221728.GP2571@scaer> (raw)
In-Reply-To: <8b5fbe25-dc3d-5117-d955-b2f63ed2bf85@benettiengineering.com>
Giulio, Thomas, All,
On 2023-09-14 22:11 +0200, Giulio Benetti spake thusly:
> On 14/09/23 21:49, Thomas Petazzoni wrote:
> >On Thu, 14 Sep 2023 21:17:26 +0200
> >Giulio Benetti <giulio.benetti@benettiengineering.com> wrote:
> >>From: Giulio Benetti <giulio.benetti+tekvox@benettiengineering.com>
> >>Build htdigest and htpasswd utilities only without building entire Apache
> >>package.
[--SNIP--]
> >Thanks for the proposal. I'm always a bit "meh" when it comes to adding
> >a new package that uses the same source code as another package. It
> >causes extra maintenance work (you need to update both packages, apply
> >patches to both, keep tracking of CVEs for both, etc.).
> I was unsure if deal with it this way and after searching I've found
> packages uboot and uboot-tools.
We can slightly loosen the restrictions for those special packages, like
the kernel or the bootloaders. U-Boot is a bootloader, so deviation is
kinda acceptable (and unavoidable).
> >What is the use case for needing this without the Apache server?
> I need htdigest to manipulate .htdigest file on target used by SWUpdate
> to deal with credentials.
ACK, valid need √ ;-)
> >Can we
> >change the Apache package to instead allow installing only those tools?
>
> Yes, I can modify by adding an option to package apache like
> BR2_PACKAGE_APACHE_BUILD_TOOLS_ONLY and then in apache.mk I do like:
> ifeq ($(BR2_PACKAGE_APACHE_BUILD_UTILS_ONLY),y)
> what I do in apache-utils package
> else
> what it's actually done in apache package
> endif
I am not too fond of that, and it is going to be a bit more complex that
that. Indeed, if building only the tools, we don't want to depend on all
the optional dependencies (zlib, lua, brottli...).
And introducing a whole-file ifeq-else-endif block is not much better
than a duplicate package; I even find it worse, because it obfuscate the
package's .mk...
> This is because I can't build only htdigest and htpasswd by using
> standard autotools-package infrastructure and I need to make specific
> targets under $(@D)/support. Otherwise it will try to build(and fail)
> to build a part of httpd.
I think it would be relatively trivial to provide your own htdigest with
a simple shell script:
#!/bin/sh
create=false
if [ "${1}" = "-c" ]; then
create=true
shift
fi
passwd_file="${1}"
realm="${2}"
user="${3}"
if create; then
> "${passwd_file}"
fi
if ! [ -f "${passwd_file}"; then
printf 'Could not open passwd file %s for reading.\n' "${passwd_file}"
printf 'Use -c option to create new one.\n'
exit 1
fi >&2
if grep -q "^${user}:${realm}:" "${passwd_file}"; then
printf 'Changing password for user %s in realm %s\n' "${user}" "${realm}"
sed -r -i -e "/^${user}:${realm}:/d" "${passwd_file}"
else
printf 'Adding user %s in realm %s\n' "${user}" "${realm}"
fi
exec 3>&1
exec >/dev/null
printf 'New password: ' >&3
read -r passwd
printf 'Re-type new password: ' >&3
read -r passwd2
exec >&3
exec 3>&-
if [ "${passwd}" != "${passwd2}" ]; then
printf "They don't match, sorry.\n"
exit 1
fi >&2
hash="$( printf '%s:%s:%s' "${user}" "${realm}" "${passwd}" |md5sum )"
printf "${user}:${realm}:${hash% -}" >>"${passwd_file}"
Totally untested, Use at your own risk...
htpasswd is quite a bit more complex, though., so if you really need it,
impersonating it is not going to be easy...
Bottom line: if only htdigest needed, then a script will help (not sure
we'd need such a package in Buildroot, though). Otherwise, I don;t have
a good idea yet...
Regards,
Yann E. MORIN.
> This is what I've found so far, but maybe I can dig deeper and maybe
> find a long sequence of:
> --disable-a
> --disable-b
> etc.
> to use autotools infrastructure.
>
> Best regards
> --
> Giulio Benetti
> CEO&CTO@Benetti Engineering sas
> _______________________________________________
> 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
next prev parent reply other threads:[~2023-09-15 22:17 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-14 19:17 [Buildroot] [PATCH] package/apache-utils: new package Giulio Benetti
2023-09-14 19:49 ` Thomas Petazzoni via buildroot
2023-09-14 20:11 ` Giulio Benetti
2023-09-15 22:17 ` Yann E. MORIN [this message]
2023-09-17 20:26 ` Giulio Benetti
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=20230915221728.GP2571@scaer \
--to=yann.morin.1998@free.fr \
--cc=buildroot@buildroot.org \
--cc=giulio.benetti+tekvox@benettiengineering.com \
--cc=giulio.benetti@benettiengineering.com \
--cc=jautry@tekvox.com \
--cc=jimr@tekvox.com \
--cc=matthewm@tekvox.com \
--cc=thomas.petazzoni@bootlin.com \
/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