cfengine  3.15.4
About: CFEngine is a configuration management system for configuring and maintaining Unix-like computers (using an own high level policy language). Community version.
  Fossies Dox: cfengine-3.15.4.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

cf-key.c File Reference
#include <generic_agent.h>
#include <dbm_api.h>
#include <lastseen.h>
#include <dir.h>
#include <scope.h>
#include <files_copy.h>
#include <files_interfaces.h>
#include <hash.h>
#include <keyring.h>
#include <eval_context.h>
#include <crypto.h>
#include <known_dirs.h>
#include <man.h>
#include <signals.h>
#include <string_lib.h>
#include <file_lib.h>
#include <cleanup.h>
#include <cf-key-functions.h>
Include dependency graph for cf-key.c:

Go to the source code of this file.

Macros

#define TIMESTAMP_VAL   1234
 

Typedefs

typedef void(* CfKeySigHandler) (int signum)
 

Functions

static GenericAgentConfigCheckOpts (int argc, char **argv)
 
static void handleShowKeysSignal (int signum)
 
static void SetupSignalsForCfKey (CfKeySigHandler sighandler)
 
int main (int argc, char *argv[])
 
static void PrintHelp ()
 

Variables

bool SHOWHOSTS = false
 
bool NO_TRUNCATE = false
 
bool FORCEREMOVAL = false
 
bool REMOVEKEYS = false
 
bool LICENSE_INSTALL = false
 
char LICENSE_SOURCE [254] = ""
 
const char * remove_keys_host = NULL
 
static char * print_digest_arg = NULL
 
static char * trust_key_arg = NULL
 
static char * KEY_PATH = NULL
 
static int KEY_SIZE = 2048
 
bool LOOKUP_HOSTS = true
 
static const char *const CF_KEY_SHORT_DESCRIPTION
 
static const char *const CF_KEY_MANPAGE_LONG_DESCRIPTION
 
static const struct option OPTIONS []
 
static const char *const HINTS []
 
bool cf_key_interrupted = false
 

Macro Definition Documentation

◆ TIMESTAMP_VAL

#define TIMESTAMP_VAL   1234

Definition at line 71 of file cf-key.c.

Typedef Documentation

◆ CfKeySigHandler

typedef void(* CfKeySigHandler) (int signum)

Definition at line 120 of file cf-key.c.

Function Documentation

◆ CheckOpts()

◆ handleShowKeysSignal()

static void handleShowKeysSignal ( int  signum)
static

Definition at line 123 of file cf-key.c.

References cf_key_interrupted.

Referenced by main().

◆ main()

◆ PrintHelp()

static void PrintHelp ( )
static

Definition at line 258 of file cf-key.c.

References FileWriter(), FileWriterDetach(), HINTS, NULL, OPTIONS, and WriterWriteHelp().

Referenced by CheckOpts().

◆ SetupSignalsForCfKey()

static void SetupSignalsForCfKey ( CfKeySigHandler  sighandler)
static

Definition at line 130 of file cf-key.c.

References HandleSignalsForAgent().

Referenced by main().

Variable Documentation

◆ cf_key_interrupted

bool cf_key_interrupted = false

Definition at line 121 of file cf-key.c.

Referenced by handleShowKeysSignal(), and ShowHost().

◆ CF_KEY_MANPAGE_LONG_DESCRIPTION

const char* const CF_KEY_MANPAGE_LONG_DESCRIPTION
static
Initial value:
=
"The CFEngine key generator makes key pairs for remote authentication.\n"

Definition at line 68 of file cf-key.c.

Referenced by CheckOpts().

◆ CF_KEY_SHORT_DESCRIPTION

const char* const CF_KEY_SHORT_DESCRIPTION
static
Initial value:
=
"make private/public key-pairs for CFEngine authentication"

Definition at line 65 of file cf-key.c.

Referenced by CheckOpts().

◆ FORCEREMOVAL

bool FORCEREMOVAL = false

Definition at line 48 of file cf-key.c.

Referenced by CheckOpts(), and main().

◆ HINTS

const char* const HINTS[]
static
Initial value:
=
{
"Print the help message",
"Print basic information about key generation",
"Enable debugging output",
"Output verbose information about the behaviour of cf-key",
"Output the version of the software",
"Specify how detailed logs should be. Possible values: 'error', 'warning', 'notice', 'info', 'verbose', 'debug'",
"Specify an alternative output file than the default.",
"Specify a RSA key size in bits, the default value is 2048.",
"Show lastseen hostnames and IP addresses",
"Don't truncate -s / --show-hosts output",
"Remove keys for specified hostname/IP/MD5/SHA (cf-key -r SHA=12345, cf-key -r MD5=12345, cf-key -r host001, cf-key -r 203.0.113.1)",
"Force removal of keys",
"Install license file on Enterprise server (CFEngine Enterprise Only)",
"Print digest of the specified public key",
"Make cf-serverd/cf-agent trust the specified public key. Argument value is of the form [[USER@]IPADDR:]FILENAME where FILENAME is the local path of the public key for client at IPADDR address.",
"Enable colorized output. Possible values: 'always', 'auto', 'never'. If option is used, the default value is 'auto'",
"Log timestamps on each line of log output",
"Do not lookup host names",
}
#define NULL
Definition: getopt1.c:56

Definition at line 95 of file cf-key.c.

Referenced by CheckOpts(), and PrintHelp().

◆ KEY_PATH

char* KEY_PATH = NULL
static

Definition at line 55 of file cf-key.c.

Referenced by CheckOpts(), and main().

◆ KEY_SIZE

int KEY_SIZE = 2048
static

Definition at line 56 of file cf-key.c.

Referenced by CheckOpts(), and main().

◆ LICENSE_INSTALL

bool LICENSE_INSTALL = false

Definition at line 50 of file cf-key.c.

Referenced by CheckOpts(), and main().

◆ LICENSE_SOURCE

char LICENSE_SOURCE[254] = ""

Definition at line 51 of file cf-key.c.

Referenced by CheckOpts(), and main().

◆ LOOKUP_HOSTS

bool LOOKUP_HOSTS = true

Definition at line 57 of file cf-key.c.

Referenced by CheckOpts(), and ShowHost().

◆ NO_TRUNCATE

bool NO_TRUNCATE = false

Definition at line 47 of file cf-key.c.

Referenced by CheckOpts(), and main().

◆ OPTIONS

const struct option OPTIONS[]
static
Initial value:
=
{
{"help", no_argument, 0, 'h'},
{"inform", no_argument, 0, 'I'},
{"debug", no_argument, 0, 'd'},
{"verbose", no_argument, 0, 'v'},
{"version", no_argument, 0, 'V'},
{"log-level", required_argument, 0, 'g'},
{"output-file", required_argument, 0, 'f'},
{"key-type", required_argument, 0, 'T'},
{"show-hosts", no_argument, 0, 's'},
{"no-truncate", no_argument, 0, 'N'},
{"remove-keys", required_argument, 0, 'r'},
{"force-removal", no_argument, 0, 'x'},
{"install-license", required_argument, 0, 'l'},
{"print-digest", required_argument, 0, 'p'},
{"trust-key", required_argument, 0, 't'},
{"color", optional_argument, 0, 'C'},
{"timestamp", no_argument, 0, 1234 },
{"numeric", no_argument, 0, 'n'},
{NULL, 0, 0, '\0'}
}
#define no_argument
Definition: getopt.h:98
#define required_argument
Definition: getopt.h:99
#define optional_argument
Definition: getopt.h:100

Definition at line 68 of file cf-key.c.

Referenced by CheckOpts(), and PrintHelp().

◆ print_digest_arg

char* print_digest_arg = NULL
static

Definition at line 53 of file cf-key.c.

Referenced by CheckOpts(), and main().

◆ remove_keys_host

const char* remove_keys_host = NULL

Definition at line 52 of file cf-key.c.

Referenced by CheckOpts(), and main().

◆ REMOVEKEYS

bool REMOVEKEYS = false

Definition at line 49 of file cf-key.c.

Referenced by CheckOpts(), and main().

◆ SHOWHOSTS

bool SHOWHOSTS = false

Definition at line 46 of file cf-key.c.

Referenced by CheckOpts(), and main().

◆ trust_key_arg

char* trust_key_arg = NULL
static

Definition at line 54 of file cf-key.c.

Referenced by CheckOpts(), and main().