Support using remote user

This commit is contained in:
Jamie Cameron
2022-10-25 13:38:38 -07:00
parent 8cdd3eeeab
commit b7758a8bcd
3 changed files with 29 additions and 0 deletions

20
xterm/acl_security.pl Normal file
View File

@@ -0,0 +1,20 @@
require 'xterm-lib.pl';
# acl_security_form(&options)
# Output HTML for editing security options for the xterm module
sub acl_security_form
{
my ($o) = @_;
print &ui_table_row($text{'acl_user'},
&ui_opt_textbox("user", $o->{'user'} eq '*' ? undef : $o->{'user'},
20, $text{'acl_sameuser'}));
}
sub acl_security_save
{
my ($o) = @_;
$o->{'user'} = $in{'user_def'} ? '*' : $in{'user'};
}

View File

@@ -5,6 +5,7 @@
# XXX don't grant to new users
# XXX ACL to run as remote user
# XXX Virtualmin integration?
# XXX how to launch a login shell?
require './xterm-lib.pl';
@@ -46,6 +47,10 @@ if (!-r $shellserver_cmd) {
&cron::create_wrapper($shellserver_cmd, $module_name, "shellserver.pl");
}
my $user = $access{'user'};
if ($user eq "*") {
$user = $remote_user;
}
getpwnam($user) || &error(&text('index_euser', $user));
my $tmpdir = &tempname_dir();
$ENV{'SESSION_ID'} = $main::session_id;
&system_logged("$shellserver_cmd $port $user >$tmpdir/ws-$port.out 2>&1 </dev/null &");

View File

@@ -1,2 +1,6 @@
index_title=Interactive Shell
index_cpan=The Perl module <tt>$1</tt> needed to accept Websockets connections is not available, but you can install it automatically using Webmin's <a href='$2'>Perl Modules</a> module.
index_euser=User $1 to run the shell as does not exist!
acl_user=Run shell as Unix user
acl_sameuser=Same as Webmin login