Open austeregrim opened 1 year ago
This is (depending upon your experience and knowledge of terminals) surprisingly complicated.
I think it would require running a curses session to draw the banners, create a UNIX pipe, create a pseudoterminal, and run your normal shell in that pseudoterminal. Then you've got to pass input and render output. I've sorta tried to write a program for this off-and-on, but the C library that I wanted to use is essentially undocumented and I'm busy/stupid.
It would be easier to set your prompt to display a classification. You could also use GNU screen or tmux, but then you'd have to ensure you're running in screen or tmux.
If that meets your project requirements, that's fine. As a user, I'd be upset if the system locked my prompt, but that's assuming a general purpose deployment rather than a specific use-case. I've seen requirements for classification banners at the top and bottom of the screen for all logged in sessions that just seem to have forgotten that secure shell and pseudoterminal consoles still exist.
In environments with classification, I actually do run tmux
and have it show the classification level, but that's not imposed on me and I'm not sure how I could get it to have bars at the top and bottom of the screen. TBF I haven't put in a decent amount of time looking at the configuration options for tmux
(screen
's is now dead to me as my muscle memory is now irrevocably converted to tmux
controls).
I don't think he suggested locking the prompt, but the prompt can be changed in the shell config? I think I'm misinterpreting "locking" the prompt.. maybe he's suggesting as a default config, not necessarily locking the config.
The requirements are definitely to have banner at the top of the screen, a shell line prompt would not suffice. As the display needs to be identifiable that it's showing a higher class of data. (Potentially, so a person walking an uncleared individual by can ask that them to close what they're doing.) Personally I use byobu regularly, which has a semi-customizable banner at the bottom of the screen. My first thought was to look at byobu to modify that display function... but I'm relatively an idiot when it comes to looking at other's code.
Not to question the regulation or policy, but solely asking for a feature to be added. It doesn't make sense to me that text sessions have never needed a banner (of course the display itself should be properly labeled), and I know this may also be out of the scope of this banner application... but I hope my request doesn't fall on deaf ears. :-)
I'd like to see classification-banner enforce a banner in console/terminal sessions along with the GUI sessions, using the same configuration in the conf file. Applying the same colors (when able), and same texts.
Presumably the banner should be at the top and bottom of the display, but top line should be sufficient.
I've looked for other solutions and whenever you search for a banner it's just configuring the MOTD or something that is shown once on starting the session, not persistent throughout the session. I'm open to suggestions on how to do it otherwise, maybe I'm just dumb and I can configure it in bash shell config