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)  

cf3globals.c
Go to the documentation of this file.
1 /*
2  Copyright 2019 Northern.tech AS
3 
4  This file is part of CFEngine 3 - written and maintained by Northern.tech AS.
5 
6  This program is free software; you can redistribute it and/or modify it
7  under the terms of the GNU General Public License as published by the
8  Free Software Foundation; version 3.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software
17  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
18 
19  To the extent this program is licensed as part of the Enterprise
20  versions of CFEngine, the applicable Commercial Open Source License
21  (COSL) may apply to this file if you as a licensee so wish it. See
22  included file COSL.txt.
23 */
24 
25 #include <cf3.defs.h>
26 
27 /*****************************************************************************/
28 /* flags */
29 /*****************************************************************************/
30 
31 
32 /*****************************************************************************/
33 /* operational state */
34 /*****************************************************************************/
35 
36 bool FIPS_MODE = false; /* GLOBAL_P */
37 
38 struct utsname VSYSNAME; /* GLOBAL_E, initialized later */
39 
40 int CFA_MAXTHREADS = 10; /* GLOBAL_P */
41 int CF_PERSISTENCE = 10; /* GLOBAL_P */
42 
43 AgentType THIS_AGENT_TYPE; /* GLOBAL_C, initialized later */
44 
45 /*****************************************************************************/
46 /* Internal data structures */
47 /*****************************************************************************/
48 
49 long LASTSEENEXPIREAFTER = SECONDS_PER_WEEK; /* GLOBAL_P */
50 
51 /*****************************************************************************/
52 /* Compatibility infrastructure */
53 /*****************************************************************************/
54 
55 bool DONTDO = false; /* GLOBAL_A */
56 
57 /* NB! Check use before changing sizes */
58 char VFQNAME[CF_MAXVARSIZE] = ""; /* GLOBAL_E GLOBAL_P */
59 char VUQNAME[CF_MAXVARSIZE] = ""; /* GLOBAL_E */
60 char VDOMAIN[CF_MAXVARSIZE] = ""; /* GLOBAL_E GLOBAL_P */
61 
62 /*
63  Default value for copytype attribute. Loaded by cf-agent from body control
64 */
65 const char *DEFAULT_COPYTYPE = NULL; /* GLOBAL_P */
66 
67 /*
68  Keys for the agent. Loaded by LoadSecretKeys.
69 
70  Used in network protocol and leaked to language.
71 */
72 RSA *PRIVKEY = NULL, *PUBKEY = NULL; /* GLOBAL_X */
73 
74 /*
75  First IP address discovered by DetectEnvironment (hence reloaded every policy
76  change).
77 
78  Used somewhere in cf-execd, superficially in old-style protocol handshake and
79  sporadically in other situations.
80 */
81 char VIPADDRESS[CF_MAX_IP_LEN] = ""; /* GLOBAL_E */
82 
83 /*
84  Edition-time constant (MD5 for community, something else for Enterprise)
85 
86  Used as a default hash everywhere (not only in network protocol)
87 */
88 HashMethod CF_DEFAULT_DIGEST; /* GLOBAL_C, initialized later */
89 int CF_DEFAULT_DIGEST_LEN; /* GLOBAL_C, initialized later */
90 
91 /*
92  Holds the "now" time captured at the moment of policy (re)load.
93 
94  TODO: This variable should be internal to timeout.c, not exposed.
95  It should only be set by SetStartTime() and read by GetStartTime().
96 
97  Utilized everywhere "now" start time is needed
98 */
99 time_t CFSTARTTIME; /* GLOBAL_E, initialized later */
100 
101 /*
102  Set in cf-agent/cf-runagent (from control body).
103 
104  Used as a timeout for socket operations in network code.
105 */
106 time_t CONNTIMEOUT = 30; /* seconds */ /* GLOBAL_A GLOBAL_P */
107 
108 /*
109  Internal detail of timeout operations. Due to historical reasons
110  is defined here, not in libpromises/timeout.c
111  */
112 pid_t ALARM_PID = -1; /* GLOBAL_X */
113 
114 /*
115  Set in cf-agent (from control body).
116 
117  Used as a default value for maxfilesize attribute in policy
118 */
119 int EDITFILESIZE = 100000; /* GLOBAL_P */
120 
121 /*
122  Set in cf-agent (from control body) and GenericAgentInitialize.
123 
124  Used as a default value for ifelapsed attribute in policy.
125 */
126 int VIFELAPSED = 1; /* GLOBAL_P */
127 
128 /*
129  Set in cf-agent (from control body) and GenericAgentInitialize.
130 
131  Used as a default value for expireafter attribute in policy.
132 */
133 int VEXPIREAFTER = 120; /* GLOBAL_P */
134 
135 /*
136  Set in cf-agent/cf-serverd (from control body).
137 
138  Utilized in server/client code to bind sockets.
139 */
140 char BINDINTERFACE[CF_MAXVARSIZE]; /* GLOBAL_P */
141 
142 /*
143  Set in cf-*.c:CheckOpts and GenericAgentConfigParseArguments.
144 
145  Utilized in generic_agent.c for
146  - cf_promises_validated filename
147  - GenericAgentCheckPolicy
148  - GenericAgentLoadPolicy (ReadPolicyValidatedFile)
149 */
150 bool MINUSF = false; /* GLOBAL_A */
#define SECONDS_PER_WEEK
Definition: cf3.defs.h:73
AgentType
Definition: cf3.defs.h:400
bool DONTDO
Definition: cf3globals.c:55
int EDITFILESIZE
Definition: cf3globals.c:119
char BINDINTERFACE[1024]
Definition: cf3globals.c:140
time_t CONNTIMEOUT
Definition: cf3globals.c:106
char VUQNAME[1024]
Definition: cf3globals.c:59
char VIPADDRESS[64]
Definition: cf3globals.c:81
RSA * PRIVKEY
Definition: cf3globals.c:72
HashMethod CF_DEFAULT_DIGEST
Definition: cf3globals.c:88
int VIFELAPSED
Definition: cf3globals.c:126
time_t CFSTARTTIME
Definition: cf3globals.c:99
int CF_PERSISTENCE
Definition: cf3globals.c:41
char VFQNAME[1024]
Definition: cf3globals.c:58
long LASTSEENEXPIREAFTER
Definition: cf3globals.c:49
pid_t ALARM_PID
Definition: cf3globals.c:112
bool FIPS_MODE
Definition: cf3globals.c:36
bool MINUSF
Definition: cf3globals.c:150
struct utsname VSYSNAME
Definition: cf3globals.c:38
char VDOMAIN[1024]
Definition: cf3globals.c:60
const char * DEFAULT_COPYTYPE
Definition: cf3globals.c:65
AgentType THIS_AGENT_TYPE
Definition: cf3globals.c:43
RSA * PUBKEY
Definition: cf3globals.c:72
int VEXPIREAFTER
Definition: cf3globals.c:133
int CF_DEFAULT_DIGEST_LEN
Definition: cf3globals.c:89
int CFA_MAXTHREADS
Definition: cf3globals.c:40
#define CF_MAX_IP_LEN
Definition: cfnet.h:39
#define CF_MAXVARSIZE
Definition: definitions.h:36
#define NULL
Definition: getopt1.c:56
HashMethod
Definition: hash_method.h:36