Private
Server IP : 195.201.23.43  /  Your IP : 3.141.40.192
Web Server : Apache
System : Linux webserver2.vercom.be 5.4.0-192-generic #212-Ubuntu SMP Fri Jul 5 09:47:39 UTC 2024 x86_64
User : kdecoratie ( 1041)
PHP Version : 7.1.33-63+ubuntu20.04.1+deb.sury.org+1
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/share/webmin/virtual-server/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /usr/share/webmin/virtual-server/list-backup-keys.pl
#!/usr/bin/perl

=head1 list-backup-keys.pl

Lists all available backup encryption keys.

When run with no flags, this command outputs a table of backup keys for
use by scheduled and manula backups.  To get a more parsable format with full
details for each shell, use the C<--multiline> parameter. Or to only output
key IDs, use the C<--id-only> flag.

=cut

package virtual_server;
if (!$module_name) {
	$main::no_acl_check++;
	$ENV{'WEBMIN_CONFIG'} ||= "/etc/webmin";
	$ENV{'WEBMIN_VAR'} ||= "/var/webmin";
	if ($0 =~ /^(.*)\/[^\/]+$/) {
		chdir($pwd = $1);
		}
	else {
		chop($pwd = `pwd`);
		}
	$0 = "$pwd/list-backup-keys.pl";
	require './virtual-server-lib.pl';
	$< == 0 || die "list-backup-keys.pl must be run as root";
	}

# Parse command-line args
while(@ARGV > 0) {
	local $a = shift(@ARGV);
	if ($a eq "--multiline") {
		$multi = 1;
		}
	elsif ($a eq "--id-only") {
		$idonly = 1;
		}
	elsif ($a eq "--help") {
		&usage();
		}
	else {
		&usage("Unknown parameter $a");
		}
	}

@keys = &list_backup_keys();
if ($multi) {
	# Show full details
	foreach $key (@keys) {
		print $key->{'id'},"\n";
		print "    Description: ",$key->{'desc'},"\n";
		if ($key->{'owner'}) {
			print "    Owner: ",$key->{'owner'},"\n";
			}
		print "    GPG key ID: ",$key->{'key'},"\n";
		print "    Created: ",&make_date($key->{'created'}),"\n";
		}
	}
elsif ($idonly) {
	# Just IDs
	foreach $key (@keys) {
		print $key->{'id'},"\n";
		}
	}
else {
	# One per line
	$fmt = "%-20.20s %-40.40s %-17.17s\n";
	printf $fmt, "Key ID", "Description", "Owner";
	printf $fmt, ("-" x 20), ("-" x 40), ("-" x 17);
	foreach $key (@keys) {
		printf $fmt, $key->{'id'},
			     $key->{'desc'},
			     $key->{'owner'} || "root";
		}
	}

sub usage
{
print "$_[0]\n\n" if ($_[0]);
print "Lists all available backup encryption keys.\n";
print "\n";
print "virtualmin list-backup-keys [--multiline]\n";
print "                            [--id-only]\n";
exit(1);
}

Private