File: cf_serverd.cf

package info (click to toggle)
cfengine3 3.6.2-4
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 20,256 kB
  • ctags: 9,613
  • sloc: ansic: 116,129; sh: 12,366; yacc: 1,088; makefile: 1,006; lex: 391; perl: 197; xml: 21; sed: 4
file content (173 lines) | stat: -rw-r--r-- 6,628 bytes parent folder | download
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
###############################################################################
# This part is for cf-serverd
#
# General IP access policy for the connection protocol
#  i.e. access to the server itself.
# Access to specific files must be granted in addition.
###############################################################################

body server control

{
      # List of ciphers the server accepts. For Syntax help see man page
      # for "openssl ciphers". Default is "AES256-GCM-SHA384:AES256-SHA"
      #allowciphers          => "AES256-GCM-SHA384:AES256-SHA";

      # List of hosts that may connect (change the ACL in def.cf)
      allowconnects         => { "127.0.0.1" , "::1", @(def.acl) };

      # Out of them, which ones should be allowed to have more than one
      # connection established at the same time?
      allowallconnects      => { "127.0.0.1" , "::1", @(def.acl) };

      # Out of the hosts in allowconnects, trust new keys only from the
      # following ones.  SEE COMMENTS IN def.cf
      trustkeysfrom         => { @(def.trustkeysfrom) };

      ## List of hosts that we'll accept connections not using latest protocol
      ## (absence of this option means allow all, empty list means allow none)
      # allowlegacyconnects   => { };

      # Maximum number of concurrent connections.
      # Suggested value >= total number of hosts
      maxconnections        => "200";

      allowusers            => { "root" };

      # Allow connections from nodes which are out-of-sync
      denybadclocks         => "false";

    windows::
      cfruncommand => "$(sys.cf_agent) -f \"$(sys.update_policy_path)\" & $(sys.cf_agent)";

    hpux::
      cfruncommand => "$(def.cf_runagent_shell) -c \"$(sys.cf_agent) -f $(sys.update_policy_path)\" ; $(sys.cf_agent)";

    aix::
      cfruncommand => "$(def.cf_runagent_shell) -c \"$(sys.cf_agent) -f $(sys.update_policy_path)\" ; $(sys.cf_agent)";

    solaris::
      cfruncommand => "$(def.cf_runagent_shell) -c \"$(sys.cf_agent) -f $(sys.update_policy_path)\" ; $(sys.cf_agent)"; 

    !(windows|hpux|aix|solaris)::
      cfruncommand => "$(def.cf_runagent_shell) -c \"$(sys.cf_agent) -f $(sys.update_policy_path)\" ; $(sys.cf_agent)";

}

###############################################################################

bundle server access_rules()

{
  vars:
    enterprise::      
      "query_types" slist => {"delta", "rebase", "full"};

  access:

    any::

      "$(def.dir_masterfiles)"
      handle => "server_access_grant_access_policy",
      comment => "Grant access to the policy updates",
      admit => { @(def.acl) };

      "$(def.dir_software)"
      handle => "server_access_grant_access_datafiles",
      comment => "Grant access to software updates",
      admit => { @(def.acl) };

      "$(def.dir_bin)"
      handle => "server_access_grant_access_binary",
      comment => "Grant access to binary for cf-runagent",
      admit => { @(def.acl) };

      "$(def.dir_modules)"
      handle => "server_access_grant_access_modules",
      comment => "Grant access to modules directory",
      admit => { @(def.acl) };

      "$(def.dir_plugins)"
      handle => "server_access_grant_access_plugins",
      comment => "Grant access to plugins directory",
      admit => { @(def.acl) };

    !windows::
      "$(def.cf_runagent_shell)"
      handle => "server_access_grant_access_shell_cmd",
      comment => "Grant access to shell for cfruncommand",
      admit => { @(def.policy_servers) };

    policy_server.ha_enabled::
      "$(sys.workdir)/ppkeys"
      handle => "server_access_grant_access_ppkeys_hubs",
      comment => "Grant access to ppkeys for HA hubs",
      admit => { @(def.policy_servers) };

      # Allow slave hub to synchronize cf_robot and appsettings content.
      # Files are containing configuration that must be the same on all hubs.
      "$(sys.workdir)/httpd/htdocs/application/config/cf_robot.php"
      handle => "server_access_grant_access_cf_robot",
      comment => "Grant access to cf_robot file for HA hubs",
      admit => { @(def.policy_servers) };

      "$(sys.workdir)/share/GUI/application/config/appsettings.php"
      handle => "server_access_grant_access_appsettings",
      comment => "Grant access to appsettings for HA hubs",
      admit => { @(def.policy_servers) };
      
      # Allow access to notification_scripts directory so passive hub
      # will be able to synchronize its content. Once passive hub will
      # be promoted to act as a master all the custom scripts will be
      # accessible.
      "/opt/cfengine/notification_scripts"
      handle => "server_access_grant_access_notification scripts",
      comment => "Grant access tonotification scripts",
      admit => { @(def.policy_servers) };

      # When HA is enabled clients are updating active hub IP address
      # using data stored in master_hub.dat file.
      "$(sys.workdir)/state/master_hub.dat"
      handle => "server_access_grant_access_policy_server_dat",
      comment => "Grant access to policy_server.dat",
      admit => { @(def.acl) };

      # Hubs keys working in HA configuration are stored in ppkeys_hubs directory.
      # In order to perform failover while active hub is down clients needs to
      # have all hubs keys. This gives ability to connect to slave hub promoted to active role
      # once active is down.
      "$(sys.workdir)/ppkeys_hubs"
      handle => "server_access_grant_access_to_clients",
      comment => "Grant access to hubs' keys to clients",
      admit => { @(def.acl) };

    windows::
      "c:\program files\cfengine\bin\cf-agent.exe"
      handle => "server_access_grant_access_agent",
      comment => "Grant access to the agent (for cf-runagent)",
      admit   => { @(def.policy_servers) };

    !policy_server.enterprise::
      "$(query_types)"
      handle => "server_access_grant_$(query_types)_for_hosts",
      comment => "Grant $(query_types) reporting query for the hub on the hosts",
      resource_type => "query",
      report_data_select => default_data_select_host,
      admit => { @(def.policy_servers) };

    policy_server.enterprise::
      "$(query_types)"
      handle => "server_access_grant_$(query_types)_for_hub",
      comment => "Grant $(query_types) reporting query for the hub on the policy server",
      resource_type => "query",
      report_data_select => default_data_select_policy_hub,
      admit => { @(def.policy_servers) };

  roles:

      # Use roles to allow specific remote cf-runagent users to
      # define certain soft-classes when running cf-agent on this host

      ".*" authorize => { "root" };

}