Quantcast
Channel: Debian User Forums
Viewing all articles
Browse latest Browse all 3423

[SSHD][Banner]Auto generating SSH Banner from Issue Files

$
0
0
Hi All,

I was tinkering around with trying to generate an SSH Banner file that mirrors the text produced by agetty when it processes Issue files.

Code:

# /usr/sbin/agetty --issue-file /etc/issue.net:/etc/issue.d --show-issueDebian GNU/Linux 12IP4 (ens33): 192.168.77.147
So far so good. My naive thought was to put this into a cron entry but of course it fails because agetty insists on having a terminal to get attributes from in order to expand the variables it may encounter in the issue files.

My cron entry to run that command every four hours:

Code:

0 0-23/4 * * * root /usr/sbin/agetty --issue-file /etc/issue.net:/etc/issue.d --show-issue > /etc/ssh/sshd_config.d/50Banner.txt 2>&1
produces:

Code:

agetty: failed to get terminal attributes: Inappropriate ioctl for device: Inappropriate ioctl for device
Of course I can manually run the command from a terminal window but I thought there must be some way I can get this to work as a background task not requiring a terminal session.

Has anyone come up with a technique that works for scheduling the reprocessing of issue files to produce the expanded text equivalent?

Statistics: Posted by shawnb — 2024-03-01 19:38 — Replies 2 — Views 78



Viewing all articles
Browse latest Browse all 3423

Trending Articles