CodeCommitsIssuesPull requestsActionsInsightsSecurity
c26601ca35463157cb5ea5cbbffb5f60ab988e34

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

APIKey

29lines · modecode

1#!/usr/local/cpanel/3rdparty/bin/perl
2
3use strict;
4use Cpanel::AdminBin::Serializer ();
5use Cpanel::Logger ();
6use Cpanel::PwCache ();
7use Cpanel::LoadFile ();
8
9my $HOST_API_KEY_FILE = "/root/.cpanel/datastore/cf_api";
10
11my $stdin = <STDIN>;
12chomp $stdin;
13my ( $uid, $function, $data ) = split( / /, $stdin, 3 );
14
15my $logger = Cpanel::Logger->new();
16
17if ( $function eq 'get_host_api_key' ) {
18 my $host_api_key = Cpanel::LoadFile::loadfile($HOST_API_KEY_FILE) or do {
19 $logger->info("Failed to load Host API key: $!");
20 };
21 print $host_api_key;
22 exit(0);
23}
24else {
25 print "Invalid function specified to APIKey adminbin";
26 exit(1);
27}
28
291; #Ah, perl