RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2104464 - [osbuild] Image builder does not support the use of a dot inside a username
Summary: [osbuild] Image builder does not support the use of a dot inside a username
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: osbuild
Version: 8.6
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Ondřej Budai
QA Contact: Release Test Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-07-06 11:08 UTC by Christophe Besson
Modified: 2022-11-08 10:28 UTC (History)
4 users (show)

Fixed In Version: osbuild-62-1.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-11-08 09:37:27 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github osbuild osbuild pull 1075 0 None open stages/users: support a dot inside a username 2022-07-20 08:21:29 UTC
Red Hat Issue Tracker RHELPLAN-127084 0 None None None 2022-07-06 11:32:19 UTC
Red Hat Knowledge Base (Solution) 6966458 0 None None None 2022-07-06 11:34:49 UTC
Red Hat Product Errata RHSA-2022:7548 0 None None None 2022-11-08 09:38:01 UTC

Description Christophe Besson 2022-07-06 11:08:06 UTC
Description of problem:
Image builder does not support the use of a dot inside a username, whereas it seems to be valid as per IEEE Std 1003.1-2001 which allows letters, digits, underscores, periods, at signs (@) and dashes.

Version-Release number of selected component (if applicable):
osbuild-53-2.el8
osbuild-composer-46.3-1.el8_6

How reproducible:
Always

Steps to Reproduce:
1. Push the below blueprint

name = "dotuser"
description = "reproducer user with a dot"
version = "0.0.1"
modules = []
groups = []
distro = ""

[[customizations.user]]
name = "foo.bar"
password = "$6$R4EexOTlkvDDwsK8$WkL4pU.JGHSO9LmpI/SMKYbunZU.t7BYLsZs1B9m0SeOH4RBICGlbScNRl0jUri3CBwasAd/sdZMkDp4SGoBq."

2. Start a compose


Actual results:
osbuild-composer fails to build the image very quickly (during some pre-checks I guess). The compose log is empty and the composer does not show any relevant error.

Jul 06 12:57:43 localhost.localdomain osbuild-composer[65518]: time="2022-07-06T12:57:43+02:00" level=info msg="Removing unresponsive job: 7e30f983-5de4-478b-ba9f-1531ad831845\n" func="github.com/osbuild/osbuild-composer/internal/worker.(*Server).WatchHeartbeats" file="/builddir/build/BUILD/osbuild-composer-46.3/_build/src/github.com/osbuild/osbuild-composer/internal/worker/server.go:87"
Jul 06 12:57:43 localhost.localdomain osbuild-composer[65518]: time="2022-07-06T12:57:43+02:00" level=error msg="Error finishing unresponsive job: error finishing job: job ws canceled" func="github.com/osbuild/osbuild-composer/internal/worker.(*Server).WatchHeartbeats" file="/builddir/build/BUILD/osbuild-composer-46.3/_build/src/github.com/osbuild/osbuild-composer/internal/worker/server.go:90"

Additional info:
- stracing the composer shows it does not report properly the error causing the issue:

27710 09:24:44.445774 write(1<pipe:[138414]>, "{\"type\": \"https://osbuild.org/validation-error\", \"title\": \"JSON Schema validation failed\", \"success\": false, \"errors\": [{\"message\": \"'foo.bar' does not match any of the regexes: '^[A-Za-z0-9_][A-Za-z0-9_-]{0,31}$'\", \"path\": [\"pipelines\", 1, \"stages\", 6, \"options\", \"users\"]}]}\n", 277) = 277 <0.000041>

- the regex in question comes from the JSON schema of the org.osbuild.users stage (/usr/lib/osbuild/stages/org.osbuild.users). Modifying the line 29 by inserting \\\. into the regular expression in order to allow the dot inside a username works around the issue:

	 21 SCHEMA = """
	 22 "additionalProperties": false,
	 23 "properties": {
	 24   "users": {
	 25     "additionalProperties": false,
	 26     "type": "object",
	 27     "description": "Keys are usernames, values are objects giving user info.",
	 28     "patternProperties": {
	 29       "^[A-Za-z0-9_][\\\.A-Za-z0-9_-]{0,31}$": {
	 30         "type": "object",
	 31         "properties": {

- note that I didn't check this updated regex is correct and still prevents an invalid name.

Comment 1 Ondřej Budai 2022-07-20 07:49:03 UTC
From IEEE Std 1003.1-2017:

 3.437 User Name:
A string that is used to identify a user; see also User Database. To be portable across systems conforming to POSIX.1-2017, the value is composed of characters from the portable filename character set. The <hyphen-minus> character should not be used as the first character of a portable user name.

 3.282 Portable Filename Character Set

The set of characters from which portable filenames are constructed.

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
a b c d e f g h i j k l m n o p q r s t u v w x y z
0 1 2 3 4 5 6 7 8 9 . _ -

The last three characters are the <period>, <underscore>, and <hyphen-minus> characters, respectively.

---

Based on these paragraphs, we are missing only <period>, thus I will add this into osbuild. If you found a document stating that we should support also at-symbol, I would be happy to add it as well.

Comment 2 Ondřej Budai 2022-07-20 08:21:30 UTC
Sent a patch upstream: https://github.com/osbuild/osbuild/pull/1075

Comment 9 errata-xmlrpc 2022-11-08 09:37:27 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Low: Image Builder security, bug fix, and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2022:7548


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