CodeCommitsIssuesPull requestsActionsInsightsSecurity
5bad44470a12c5be4d046d0fb121dd1598b1a399

Branches

Tags

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

Clone

HTTPS
SSH

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 'getHostApiKey' ) {
18 my $hostApiKey = Cpanel::LoadFile::loadfile($HOST_API_KEY_FILE) or do {
19 $logger->info("Failed to load Host API key: $!");
20 };
21 print $hostApiKey;
22 exit(0);
23}
24else {
25 print "Invalid function specified to APIKey adminbin";
26 exit(1);
27}
28
291; #Ah, perl