ssh-generator: generate /etc/issue.d/ with VSOCK ssh info data
I find myself trying to log into a fresh ParticleOS VM started via systemd-vmspawn all the time, but I don't know its CID. Let's show it on the getty screen, to make it immediately visible.
This commit is contained in:
@@ -134,6 +134,7 @@ static int write_socket_unit(
|
||||
const char *unit,
|
||||
const char *listen_stream,
|
||||
const char *comment,
|
||||
const char *extra,
|
||||
bool with_ssh_access_target_dependency) {
|
||||
|
||||
int r;
|
||||
@@ -172,6 +173,9 @@ static int write_socket_unit(
|
||||
"PollLimitBurst=50\n",
|
||||
listen_stream);
|
||||
|
||||
if (extra)
|
||||
fputs(extra, f);
|
||||
|
||||
r = fflush_and_check(f);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to write %s SSH socket unit: %m", comment);
|
||||
@@ -245,6 +249,8 @@ static int add_vsock_socket(
|
||||
"sshd-vsock.socket",
|
||||
"vsock::22",
|
||||
"AF_VSOCK",
|
||||
"ExecStartPost=-/usr/lib/systemd/systemd-ssh-issue --make-vsock\n"
|
||||
"ExecStopPre=-/usr/lib/systemd/systemd-ssh-issue --rm-vsock\n",
|
||||
/* with_ssh_access_target_dependency= */ true);
|
||||
if (r < 0)
|
||||
return r;
|
||||
@@ -280,6 +286,7 @@ static int add_local_unix_socket(
|
||||
"sshd-unix-local.socket",
|
||||
"/run/ssh-unix-local/socket",
|
||||
"AF_UNIX Local",
|
||||
/* extra= */ NULL,
|
||||
/* with_ssh_access_target_dependency= */ false);
|
||||
if (r < 0)
|
||||
return r;
|
||||
@@ -336,6 +343,7 @@ static int add_export_unix_socket(
|
||||
"sshd-unix-export.socket",
|
||||
"/run/host/unix-export/ssh",
|
||||
"AF_UNIX Export",
|
||||
/* extra= */ NULL,
|
||||
/* with_ssh_access_target_dependency= */ true);
|
||||
if (r < 0)
|
||||
return r;
|
||||
@@ -387,6 +395,7 @@ static int add_extra_sockets(
|
||||
socket ?: "sshd-extra.socket",
|
||||
*i,
|
||||
*i,
|
||||
/* extra= */ NULL,
|
||||
/* with_ssh_access_target_dependency= */ true);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
Reference in New Issue
Block a user