Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 2017903

Summary: [RFE] gnome-shell-extension-heads-up-display body from file
Product: Red Hat Enterprise Linux 9 Reporter: Pat Riehecky <riehecky>
Component: gnome-shell-extensionsAssignee: Ray Strode [halfline] <rstrode>
Status: CLOSED MIGRATED QA Contact: Michael Boisvert <mboisver>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: CentOS StreamCC: bstinson, jadahl, jkoten, jwboyer, misterbonnie, rstrode, tpelka, tpopela
Target Milestone: rcKeywords: FutureFeature, MigratedToJIRA, Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-09-15 16:55:00 UTC Type: Story
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Pat Riehecky 2021-10-27 16:44:38 UTC
Description of problem:

Sites with required warning banners can use gnome-shell-extension-heads-up-display to set a notice.  However, this notice usually needs to be set in multiple places (/etc/issue.net, cockpit's login screen, etc).  If gnome-shell-extension-heads-up-display could read the body text from a known file, I could more easily keep them in sync.

Version-Release number of selected component (if applicable):


How reproducible:
100%

Steps to Reproduce:
1. Look for an easy way to de-dupe NOTICE TO USER messages with gnome-shell-extension-heads-up-display
2.
3.

Actual results:
Need to duplicate (and keep in sync) the message in multiple places

Expected results:
Way to centralize the "notice to users"

Additional info:

Comment 2 Ray Strode [halfline] 2021-12-06 19:35:23 UTC
Are you enabling the feature using the gnome-extensions settings ui? (the gnome-extensions-app command) ?

Assuming yes, you can actually configure this in a config file using dconf. For instance, by creating a file called

/etc/dconf/db/local.d/99-banner.conf

To know what to put in it, create a fresh user, go into the settings UI and enable the extension and set the message,
then run, 

$ dconf dump /

It will show all the settings the user has set that differ from defaults. In particular it could show, for example:

[org/gnome/shell/extensions]
enabled-extensions=['heads-up-display.github.com']

[org/gnome/shell/extensions/heads-up-display]
message-body='This machine is the property of the US Government.\n\nUnauthorized access is strictly prohibited.\n\nAbusers will be prosecuted to the fullest extent of the law.\n'
message-heading='CLASSIFIED SYSTEM'
show-when-locked=false
show-when-unlocked=true
show-when-unlocking=true

By putting that in /etc/dconf/db/local.d/99-banner.conf and running "dconf update" after making changes, the setting can be controlled from the file. 

You could imagine taking this a step further, by computing the setting from /etc/motd... Say with a script, update-message-banner.sh, like so:

#!/bin/bash
cat << EOF > "/etc/dconf/db/local.d/99-banner.conf"
[org/gnome/shell/extensions]
enabled-extensions=['heads-up-display.github.com']

[org/gnome/shell/extensions/heads-up-display]
message-heading="$(head -n1 /etc/motd)"
message-body="$(tail -n+2 /etc/motd | sed -z 's/\n/\\n/g')"
show-when-locked=true
show-when-unlocked=true
show-when-unlocking=true
EOF
dconf update

That script would take the first line of /etc/motd and put it in the heading and all other lines in the body of the banner.  Then you would just need to run "update-message-banner.sh" any time /etc/motd changes by running the script from systemd with a path monitoring unit. e.g., /etc/systemd/system/motd.path

[Unit] 
Wants=update-message-banner.service 

[Path] 
PathChanged=/etc/motd

and

/etc/systemd/system/update-message-banner.servce

[Service]  
Type=simple  
ExecStart=/usr/local/bin/update-message-banner.sh

Does that meet your needs?

If so great, let's close this out.

If not, I guess we could add some new setting "message-file" or "message-command" that makes it read from a file or run a command directly from within gnome-shell, but that setting would then conflict with message-header/message-body. We would have to establish a precedence or something like that to know which settings to honor and which to ignore if both the old ones and the new one are set.

The downside of reading it at runtime is it may require changes to SELinux policy to e.g. allow the login screen to read the file depending on which file is getting read.

Comment 3 Pat Riehecky 2021-12-07 14:17:15 UTC
Hello,

That comes close to what I'm looking for.  I might be able to tweak this into shape....

Ideally, a "message-file" with an inotify on the file would be much less setup.

Comment 4 Ray Strode [halfline] 2021-12-07 15:17:06 UTC
I guess we could make the precedence explicit by adding two new keys:

1. message-file
2. message-source

where the latter could be a string to say whether to honor message-file or message-header/message-body. 

Would you want the file format to be 

---
Heading
The message body goes here.
---

or

---
Heading

The message body goes here.
---

or something different? 

One concern I have is the nature of the banner (it's size, placement on screen, etc) means that not all messages are a good fit for it. By adding a file browser to the preferences dialog, the extension potentially makes it easy for the user to put a wall of text on their screen. Nothing catastrophic, but it's a bit of a UI niggle.

Comment 6 Pat Riehecky 2021-12-07 15:20:55 UTC
A format something like:

---
Heading

The message body goes here.
---

Would be great!

Comment 8 Ray Strode [halfline] 2022-02-23 14:56:46 UTC
I don't think this is going to make 9.0 at this point, proposing for a future update.

Comment 17 RHEL Program Management 2023-09-15 16:53:09 UTC
Issue migration from Bugzilla to Jira is in process at this time. This will be the last message in Jira copied from the Bugzilla bug.

Comment 18 RHEL Program Management 2023-09-15 16:55:00 UTC
This BZ has been automatically migrated to the issues.redhat.com Red Hat Issue Tracker. All future work related to this report will be managed there.

Due to differences in account names between systems, some fields were not replicated.  Be sure to add yourself to Jira issue's "Watchers" field to continue receiving updates and add others to the "Need Info From" field to continue requesting information.

To find the migrated issue, look in the "Links" section for a direct link to the new issue location. The issue key will have an icon of 2 footprints next to it, and begin with "RHEL-" followed by an integer.  You can also find this issue by visiting https://issues.redhat.com/issues/?jql= and searching the "Bugzilla Bug" field for this BZ's number, e.g. a search like:

"Bugzilla Bug" = 1234567

In the event you have trouble locating or viewing this issue, you can file an issue by sending mail to rh-issues. You can also visit https://access.redhat.com/articles/7032570 for general account information.