/usr/bin/metabase-profile is in libmetabase-fact-perl 0.025-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | #!/usr/bin/perl
use 5.006;
use strict;
use warnings;
package metabase_profile; # dzil needs this
# PODNAME: metabase-profile
# ABSTRACT: create a metabase profile
our $VERSION = '0.025';
use Getopt::Long;
use JSON::MaybeXS ();
use Metabase::User::Profile;
use Metabase::User::Secret;
use Pod::Usage;
use IO::Prompt::Tiny qw(prompt);
my ( %profile, $help, $output, $full_name, $email_address, $password );
my $result = GetOptions(
'help|h' => \$help,
'output|o:s' => \$output,
'name:s' => \$full_name,
'email:s' => \$email_address,
'secret:s' => \$password,
);
pod2usage( { -verbose => 2 } ) if !$result || $help;
# setup output file and confirm it doesn't exist
if ( !defined $output ) {
$output = "metabase_id.json";
}
if ( -f $output ) {
die "Won't over-write existing '$output' file. Aborting.\n";
}
# get profile information
$profile{full_name} = $full_name if defined $full_name;
$profile{email_address} = $email_address if defined $email_address;
$profile{password} = $password if defined $password;
my @prompts = (
full_name => 'full name',
email_address => 'email address',
password => 'password/secret',
);
while (@prompts) {
my ( $key, $phrase ) = splice( @prompts, 0, 2 );
next if $profile{$key};
chomp( my $answer = prompt("Enter $phrase\: ") );
$profile{$key} = $answer;
}
# create profile and secret objects
$password = delete $profile{password};
my $profile = Metabase::User::Profile->create(%profile);
my $secret = Metabase::User::Secret->new(
resource => $profile->resource,
content => $password,
);
# write output
print "Writing profile to '$output'\n";
open my $fh, ">", $output;
print {$fh}
JSON::MaybeXS->new(ascii => 1, pretty => 1)->encode( [ $profile->as_struct, $secret->as_struct, ] );
close $fh;
chmod 0600, $output;
__END__
=pod
=encoding UTF-8
=head1 NAME
metabase-profile - create a metabase profile
=head1 VERSION
version 0.025
=head1 SYNOPSIS
$ metabase-profile
Enter full name: John Doe
Enter email address: jdoe@example.com
Enter password/secret: zqxjkh
Writing profile to 'metabase_id.json'
=head1 USAGE
The metabase-profile program makes it easy to create a user profile for
submitting facts and reports to a Metabase server.
Valid options include:
--email ADDRESS user email address eg "jd@example.com"
--name FULLNAME full user name, eg "John Doe"
-o, --output FILENAME output filename
--secret PASSWORD password for authentication
-h, --help print man page
If no output file name is given, the default name 'metabase_id.json' will be
used. If the output filename (or default) exists, the program will abort
rather than overwrite the file. The output file will be in JSON and contain
the user profile and the user's shared secret.
Typically, when a Metabase server first receives a report from a new user
profile, the shared secret is recorded and will be used to authenticate
subsequent submissions. The output should not be shared publicly or
made group or world readable.
Use the resulting file according to the instructions of your Metabase
client program. You may wish to copy it across computers if you would like
to be identified consistently when submitting reports from different
locations.
=head1 AUTHORS
=over 4
=item *
David Golden <dagolden@cpan.org>
=item *
Ricardo Signes <rjbs@cpan.org>
=item *
H.Merijn Brand <hmbrand@cpan.org>
=back
=head1 COPYRIGHT AND LICENSE
This software is Copyright (c) 2016 by David Golden.
This is free software, licensed under:
The Apache License, Version 2.0, January 2004
=cut
|