/
defaults.rb
2177 lines (2058 loc) · 94 KB
/
defaults.rb
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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
require 'puppet/util/platform'
module Puppet
def self.default_diffargs
if (Facter.value(:kernel) == "AIX" && Facter.value(:kernelmajversion) == "5300")
""
else
"-u"
end
end
def self.default_digest_algorithm
'sha256'
end
def self.valid_digest_algorithms
Puppet::Util::Platform.fips_enabled? ?
%w[sha256 sha384 sha512 sha224] :
%w[sha256 sha384 sha512 sha224 md5]
end
def self.default_file_checksum_types
Puppet::Util::Platform.fips_enabled? ?
%w[sha256 sha384 sha512 sha224] :
%w[sha256 sha384 sha512 sha224 md5]
end
def self.valid_file_checksum_types
Puppet::Util::Platform.fips_enabled? ?
%w[sha256 sha256lite sha384 sha512 sha224 sha1 sha1lite mtime ctime] :
%w[sha256 sha256lite sha384 sha512 sha224 sha1 sha1lite md5 md5lite mtime ctime]
end
def self.default_basemodulepath
if Puppet::Util::Platform.windows?
path = ['$codedir/modules']
installdir = ENV["FACTER_env_windows_installdir"]
if installdir
path << "#{installdir}/puppet/modules"
end
path.join(File::PATH_SEPARATOR)
else
'$codedir/modules:/opt/puppetlabs/puppet/modules'
end
end
def self.default_vendormoduledir
if Puppet::Util::Platform.windows?
installdir = ENV["FACTER_env_windows_installdir"]
if installdir
"#{installdir}\\puppet\\vendor_modules"
else
nil
end
else
'/opt/puppetlabs/puppet/vendor_modules'
end
end
############################################################################################
# NOTE: For information about the available values for the ":type" property of settings,
# see the docs for Settings.define_settings
############################################################################################
AS_DURATION = %q{This setting can be a time interval in seconds (30 or 30s), minutes (30m), hours (6h), days (2d), or years (5y).}
# @api public
# @param args [Puppet::Settings] the settings object to define default settings for
# @return void
def self.initialize_default_settings!(settings)
settings.define_settings(:main,
:confdir => {
:default => nil,
:type => :directory,
:desc => "The main Puppet configuration directory. The default for this setting
is calculated based on the user. If the process is running as root or
the user that Puppet is supposed to run as, it defaults to a system
directory, but if it's running as any other user, it defaults to being
in the user's home directory.",
},
:codedir => {
:default => nil,
:type => :directory,
:desc => "The main Puppet code directory. The default for this setting
is calculated based on the user. If the process is running as root or
the user that Puppet is supposed to run as, it defaults to a system
directory, but if it's running as any other user, it defaults to being
in the user's home directory.",
},
:vardir => {
:default => nil,
:type => :directory,
:owner => "service",
:group => "service",
:desc => "Where Puppet stores dynamic and growing data. The default for this
setting is calculated specially, like `confdir`_.",
},
### NOTE: this setting is usually being set to a symbol value. We don't officially have a
### setting type for that yet, but we might want to consider creating one.
:name => {
:default => nil,
:desc => "The name of the application, if we are running as one. The
default is essentially $0 without the path or `.rb`.",
}
)
settings.define_settings(:main,
:logdir => {
:default => nil,
:type => :directory,
:mode => "0750",
:owner => "service",
:group => "service",
:desc => "The directory in which to store log files",
},
:log_level => {
:default => 'notice',
:type => :enum,
:values => ["debug","info","notice","warning","err","alert","emerg","crit"],
:desc => "Default logging level for messages from Puppet. Allowed values are:
* debug
* info
* notice
* warning
* err
* alert
* emerg
* crit
",
:hook => proc {|value| Puppet::Util::Log.level = value },
:call_hook => :on_initialize_and_write,
},
:disable_warnings => {
:default => [],
:type => :array,
:desc => "A comma-separated list of warning types to suppress. If large numbers
of warnings are making Puppet's logs too large or difficult to use, you
can temporarily silence them with this setting.
If you are preparing to upgrade Puppet to a new major version, you
should re-enable all warnings for a while.
Valid values for this setting are:
* `deprecations` --- disables deprecation warnings.
* `undefined_variables` --- disables warnings about non existing variables.
* `undefined_resources` --- disables warnings about non existing resources.",
:hook => proc do |value|
values = munge(value)
valid = %w[deprecations undefined_variables undefined_resources]
invalid = values - (values & valid)
if not invalid.empty?
raise ArgumentError, _("Cannot disable unrecognized warning types '%{invalid}'.") % { invalid: invalid.join(',') } +
' ' + _("Valid values are '%{values}'.") % { values: valid.join(', ') }
end
end
},
:merge_dependency_warnings => {
:default => false,
:type => :boolean,
:desc => "Whether to merge class-level dependency failure warnings.
When a class has a failed dependency, every resource in the class
generates a notice level message about the dependency failure,
and a warning level message about skipping the resource.
If true, all messages caused by a class dependency failure are merged
into one message associated with the class.
",
},
:strict => {
:default => :warning,
:type => :symbolic_enum,
:values => [:off, :warning, :error],
:desc => "The strictness level of puppet. Allowed values are:
* off - do not perform extra validation, do not report
* warning - perform extra validation, report as warning (default)
* error - perform extra validation, fail with error
The strictness level is for both language semantics and runtime
evaluation validation. In addition to controlling the behavior with
this master switch some individual warnings may also be controlled
by the disable_warnings setting.
No new validations will be added to a micro (x.y.z) release,
but may be added in minor releases (x.y.0). In major releases
it expected that most (if not all) strictness validation become
standard behavior.",
:hook => proc do |value|
munge(value)
value.to_sym
end
},
:disable_i18n => {
:default => true,
:type => :boolean,
:desc => "If true, turns off all translations of Puppet and module
log messages, which affects error, warning, and info log messages,
as well as any translations in the report and CLI.",
:hook => proc do |value|
if value
require 'puppet/gettext/stubs'
Puppet::GettextConfig.disable_gettext
end
end
}
)
settings.define_settings(:main,
:priority => {
:default => nil,
:type => :priority,
:desc => "The scheduling priority of the process. Valid values are 'high',
'normal', 'low', or 'idle', which are mapped to platform-specific
values. The priority can also be specified as an integer value and
will be passed as is, e.g. -5. Puppet must be running as a privileged
user in order to increase scheduling priority.",
},
:trace => {
:default => false,
:type => :boolean,
:desc => "Whether to print stack traces on some errors. Will print
internal Ruby stack trace interleaved with Puppet function frames.",
:hook => proc do |value|
# Enable or disable Facter's trace option too
Facter.trace(value) if Facter.respond_to? :trace
end
},
:puppet_trace => {
:default => false,
:type => :boolean,
:desc => "Whether to print the Puppet stack trace on some errors.
This is a noop if `trace` is also set.",
},
:profile => {
:default => false,
:type => :boolean,
:desc => "Whether to enable experimental performance profiling",
},
:versioned_environment_dirs => {
:default => false,
:type => :boolean,
:desc => "Whether or not to look for versioned environment directories,
symlinked from `$environmentpath/<environment>`. This is an experimental
feature and should be used with caution."
},
:static_catalogs => {
:default => true,
:type => :boolean,
:desc => "Whether to compile a [static catalog](https://puppet.com/docs/puppet/latest/static_catalogs.html#enabling-or-disabling-static-catalogs),
which occurs only on a Puppet Server master when the `code-id-command` and
`code-content-command` settings are configured in its `puppetserver.conf` file.",
},
:settings_catalog => {
:default => true,
:type => :boolean,
:desc => "Whether to compile and apply the settings catalog",
},
:strict_environment_mode => {
:default => false,
:type => :boolean,
:desc => "Whether the agent specified environment should be considered authoritative,
causing the run to fail if the retrieved catalog does not match it.",
},
:autoflush => {
:default => true,
:type => :boolean,
:desc => "Whether log files should always flush to disk.",
:hook => proc { |value| Log.autoflush = value }
},
:syslogfacility => {
:default => "daemon",
:desc => "What syslog facility to use when logging to syslog.
Syslog has a fixed list of valid facilities, and you must
choose one of those; you cannot just make one up."
},
:statedir => {
:default => "$vardir/state",
:type => :directory,
:mode => "01755",
:desc => "The directory where Puppet state is stored. Generally,
this directory can be removed without causing harm (although it
might result in spurious service restarts)."
},
:rundir => {
:default => nil,
:type => :directory,
:mode => "0755",
:owner => "service",
:group => "service",
:desc => "Where Puppet PID files are kept."
},
:genconfig => {
:default => false,
:type => :boolean,
:desc => "When true, causes Puppet applications to print an example config file
to stdout and exit. The example will include descriptions of each
setting, and the current (or default) value of each setting,
incorporating any settings overridden on the CLI (with the exception
of `genconfig` itself). This setting only makes sense when specified
on the command line as `--genconfig`.",
},
:genmanifest => {
:default => false,
:type => :boolean,
:desc => "Whether to just print a manifest to stdout and exit. Only makes
sense when specified on the command line as `--genmanifest`. Takes into account arguments specified
on the CLI.",
},
:configprint => {
:default => "",
:deprecated => :completely,
:desc => "Prints the value of a specific configuration setting. If the name of a
setting is provided for this, then the value is printed and puppet
exits. Comma-separate multiple values. For a list of all values,
specify 'all'. This setting is deprecated, the 'puppet config' command replaces this functionality.",
},
:color => {
:default => "ansi",
:type => :string,
:desc => "Whether to use colors when logging to the console. Valid values are
`ansi` (equivalent to `true`), `html`, and `false`, which produces no color."
},
:mkusers => {
:default => false,
:type => :boolean,
:desc => "Whether to create the necessary user and group that puppet agent will run as.",
},
:manage_internal_file_permissions => {
:default => ! Puppet::Util::Platform.windows?,
:type => :boolean,
:desc => "Whether Puppet should manage the owner, group, and mode of files it uses internally.
**Note**: For Windows agents, the default is `false` for versions 4.10.13 and greater, versions 5.5.6 and greater, and versions 6.0 and greater.",
},
:onetime => {
:default => false,
:type => :boolean,
:desc => "Perform one configuration run and exit, rather than spawning a long-running
daemon. This is useful for interactively running puppet agent, or
running puppet agent from cron.",
:short => 'o',
},
:path => {
:default => "none",
:desc => "The shell search path. Defaults to whatever is inherited
from the parent process.
This setting can only be set in the `[main]` section of puppet.conf; it cannot
be set in `[server]`, `[agent]`, or an environment config section.",
:call_hook => :on_define_and_write,
:hook => proc do |value|
Puppet::Util.set_env('PATH', '') if Puppet::Util.get_env('PATH').nil?
Puppet::Util.set_env('PATH', value) unless value == 'none'
paths = Puppet::Util.get_env('PATH').split(File::PATH_SEPARATOR)
Puppet::Util::Platform.default_paths.each do |path|
Puppet::Util.set_env('PATH', Puppet::Util.get_env('PATH') + File::PATH_SEPARATOR + path) unless paths.include?(path)
end
value
end
},
:libdir => {
:type => :directory,
:default => "$vardir/lib",
:desc => "An extra search path for Puppet. This is only useful
for those files that Puppet will load on demand, and is only
guaranteed to work for those cases. In fact, the autoload
mechanism is responsible for making sure this directory
is in Ruby's search path\n"
},
:environment => {
:default => "production",
:desc => "The environment in which Puppet is running. For clients,
such as `puppet agent`, this determines the environment itself, which
Puppet uses to find modules and much more. For servers, such as `puppet master`,
this provides the default environment for nodes that Puppet knows nothing about.
When defining an environment in the `[agent]` section, this refers to the
environment that the agent requests from the master. The environment doesn't
have to exist on the local filesystem because the agent fetches it from the
master. This definition is used when running `puppet agent`.
When defined in the `[user]` section, the environment refers to the path that
Puppet uses to search for code and modules related to its execution. This
requires the environment to exist locally on the filesystem where puppet is
being executed. Puppet subcommands, including `puppet module` and
`puppet apply`, use this definition.
Given that the context and effects vary depending on the
[config section](https://puppet.com/docs/puppet/latest/config_file_main.html#config-sections)
in which the `environment` setting is defined, do not set it globally.",
:short => "E"
},
:environmentpath => {
:default => "$codedir/environments",
:desc => "A search path for directory environments, as a list of directories
separated by the system path separator character. (The POSIX path separator
is ':', and the Windows path separator is ';'.)
This setting must have a value set to enable **directory environments.** The
recommended value is `$codedir/environments`. For more details, see
<https://puppet.com/docs/puppet/latest/environments_about.html>",
:type => :path,
},
:always_retry_plugins => {
:type => :boolean,
:default => true,
:desc => <<-'EOT'
Affects how we cache attempts to load Puppet resource types and features. If
true, then calls to `Puppet.type.<type>?` `Puppet.feature.<feature>?`
will always attempt to load the type or feature (which can be an
expensive operation) unless it has already been loaded successfully.
This makes it possible for a single agent run to, e.g., install a
package that provides the underlying capabilities for a type or feature,
and then later load that type or feature during the same run (even if
the type or feature had been tested earlier and had not been available).
If this setting is set to false, then types and features will only be
checked once, and if they are not available, the negative result is
cached and returned for all subsequent attempts to load the type or
feature. This behavior is almost always appropriate for the server,
and can result in a significant performance improvement for types and
features that are checked frequently.
EOT
},
:diff_args => {
:default => lambda { default_diffargs },
:desc => "Which arguments to pass to the diff command when printing differences between
files. The command to use can be chosen with the `diff` setting.",
},
:diff => {
:default => (Puppet::Util::Platform.windows? ? "" : "diff"),
:desc => "Which diff command to use when printing differences between files. This setting
has no default value on Windows, as standard `diff` is not available, but Puppet can use many
third-party diff tools.",
},
:show_diff => {
:type => :boolean,
:default => false,
:desc => "Whether to log and report a contextual diff when files are being replaced.
This causes partial file contents to pass through Puppet's normal
logging and reporting system, so this setting should be used with
caution if you are sending Puppet's reports to an insecure
destination. This feature currently requires the `diff/lcs` Ruby
library.",
},
:daemonize => {
:type => :boolean,
:default => (Puppet::Util::Platform.windows? ? false : true),
:desc => "Whether to send the process into the background. This defaults
to true on POSIX systems, and to false on Windows (where Puppet
currently cannot daemonize).",
:short => "D",
:hook => proc do |value|
if value and Puppet::Util::Platform.windows?
raise "Cannot daemonize on Windows"
end
end
},
:maximum_uid => {
:default => 4294967290,
:desc => "The maximum allowed UID. Some platforms use negative UIDs
but then ship with tools that do not know how to handle signed ints,
so the UIDs show up as huge numbers that can then not be fed back into
the system. This is a hackish way to fail in a slightly more useful
way when that happens.",
},
:route_file => {
:default => "$confdir/routes.yaml",
:desc => "The YAML file containing indirector route configuration.",
},
:node_terminus => {
:type => :terminus,
:default => "plain",
:desc => <<-'EOT',
Which node data plugin to use when compiling node catalogs.
When Puppet compiles a catalog, it combines two primary sources of info: the main manifest,
and a node data plugin (often called a "node terminus," for historical reasons). Node data
plugins provide three things for a given node name:
1. A list of classes to add to that node's catalog (and, optionally, values for their
parameters).
2. Which Puppet environment the node should use.
3. A list of additional top-scope variables to set.
The three main node data plugins are:
* `plain` --- Returns no data, so that the main manifest controls all node configuration.
* `exec` --- Uses an
[external node classifier (ENC)](https://puppet.com/docs/puppet/latest/nodes_external.html),
configured by the `external_nodes` setting. This lets you pull a list of Puppet classes
from any external system, using a small glue script to perform the request and format the
result as YAML.
* `classifier` (formerly `console`) --- Specific to Puppet Enterprise. Uses the PE console
for node data."
EOT
},
:node_cache_terminus => {
:type => :terminus,
:default => nil,
:desc => "How to store cached nodes.
Valid values are (none), 'json', 'msgpack', or 'yaml'.",
},
:data_binding_terminus => {
:type => :terminus,
:default => "hiera",
:desc =>
"This setting has been deprecated. Use of any value other than 'hiera' should instead be configured
in a version 5 hiera.yaml. Until this setting is removed, it controls which data binding terminus
to use for global automatic data binding (across all environments). By default this value is 'hiera'.
A value of 'none' turns off the global binding.",
:call_hook => :on_initialize_and_write,
:hook => proc do |value|
if Puppet[:strict] != :off
s_val = value.to_s # because sometimes the value is a symbol
unless s_val == 'hiera' || s_val == 'none' || value == '' || value.nil?
#TRANSLATORS 'data_binding_terminus' is a setting and should not be translated
message = _("Setting 'data_binding_terminus' is deprecated.")
#TRANSLATORS 'hiera' should not be translated
message += ' ' + _("Convert custom terminus to hiera 5 API.")
Puppet.deprecation_warning(message)
end
end
end
},
:hiera_config => {
:default => lambda do
config = nil
codedir = settings[:codedir]
if codedir.is_a?(String)
config = File.expand_path(File.join(codedir, 'hiera.yaml'))
config = nil unless Puppet::FileSystem.exist?(config)
end
config = File.expand_path(File.join(settings[:confdir], 'hiera.yaml')) if config.nil?
config
end,
:desc => "The hiera configuration file. Puppet only reads this file on startup, so you must restart the puppet server every time you edit it.",
:type => :file,
},
:binder_config => {
:default => nil,
:desc => "The binder configuration file. Puppet reads this file on each request to configure the bindings system.
If set to nil (the default), a $confdir/binder_config.yaml is optionally loaded. If it does not exists, a default configuration
is used. If the setting :binding_config is specified, it must reference a valid and existing yaml file.",
:type => :file,
},
:catalog_terminus => {
:type => :terminus,
:default => "compiler",
:desc => "Where to get node catalogs. This is useful to change if, for instance,
you'd like to pre-compile catalogs and store them in memcached or some other easily-accessed store.",
},
:catalog_cache_terminus => {
:type => :terminus,
:default => nil,
:desc => "How to store cached catalogs. Valid values are 'json', 'msgpack' and 'yaml'. The agent application defaults to 'json'."
},
:facts_terminus => {
:default => 'facter',
:desc => "The node facts terminus.",
},
:trusted_external_command => {
:default => nil,
:type => :file_or_directory,
:desc => "The external trusted facts script or directory to use.
This setting's value can be set to the path to an executable command that
can produce external trusted facts or to a directory containing those
executable commands. The command(s) must:
* Take the name of a node as a command-line argument.
* Return a JSON hash with the external trusted facts for this node.
* For unknown or invalid nodes, exit with a non-zero exit code.
If the setting points to an executable command, then the external trusted
facts will be stored in the 'external' key of the trusted facts hash. Otherwise
for each executable file in the directory, the external trusted facts will be
stored in the `<basename>` key of the `trusted['external']` hash. For example,
if the files foo.rb and bar.sh are in the directory, then `trusted['external']`
will be the hash `{ 'foo' => <foo.rb output>, 'bar' => <bar.sh output> }`.",
},
:default_file_terminus => {
:type => :terminus,
:default => "rest",
:desc => "The default source for files if no server is given in a
uri, e.g. puppet:///file. The default of `rest` causes the file to be
retrieved using the `server` setting. When running `apply` the default
is `file_server`, causing requests to be filled locally."
},
:http_proxy_host => {
:default => "none",
:desc => "The HTTP proxy host to use for outgoing connections. The proxy will be bypassed if
the server's hostname matches the NO_PROXY environment variable or `no_proxy` setting. Note: You
may need to use a FQDN for the server hostname when using a proxy. Environment variable
http_proxy or HTTP_PROXY will override this value. ",
},
:http_proxy_port => {
:default => 3128,
:desc => "The HTTP proxy port to use for outgoing connections",
},
:http_proxy_user => {
:default => "none",
:desc => "The user name for an authenticated HTTP proxy. Requires the `http_proxy_host` setting.",
},
:http_proxy_password =>{
:default => "none",
:hook => proc do |value|
if settings[:http_proxy_password] =~ /[@!# \/]/
raise "Passwords set in the http_proxy_password setting must be valid as part of a URL, and any reserved characters must be URL-encoded. We received: #{value}"
end
end,
:desc => "The password for the user of an authenticated HTTP proxy.
Requires the `http_proxy_user` setting.
Note that passwords must be valid when used as part of a URL. If a password
contains any characters with special meanings in URLs (as specified by RFC 3986
section 2.2), they must be URL-encoded. (For example, `#` would become `%23`.)",
},
:no_proxy => {
:default => "localhost, 127.0.0.1",
:desc => "List of host or domain names that should not go through `http_proxy_host`. Environment variable no_proxy or NO_PROXY will override this value. Names can be specified as an FQDN `host.example.com`, wildcard `*.example.com`, dotted domain `.example.com`, or suffix `example.com`.",
},
:http_keepalive_timeout => {
:default => "4s",
:type => :duration,
:desc => "The maximum amount of time a persistent HTTP connection can remain idle in the connection pool, before it is closed. This timeout should be shorter than the keepalive timeout used on the HTTP server, e.g. Apache KeepAliveTimeout directive.
#{AS_DURATION}"
},
:http_debug => {
:default => false,
:type => :boolean,
:desc => "Whether to write HTTP request and responses to stderr. This should never be used in a production environment."
},
:http_connect_timeout => {
:default => "2m",
:type => :duration,
:desc => "The maximum amount of time to wait when establishing an HTTP connection. The default
value is 2 minutes.
#{AS_DURATION}",
},
:http_read_timeout => {
:default => "10m",
:type => :duration,
:desc => "The time to wait for data to be read from an HTTP connection. If nothing is
read after the elapsed interval then the connection will be closed. The default value is 10 minutes.
#{AS_DURATION}",
},
:http_user_agent => {
:default => "Puppet/#{Puppet.version} Ruby/#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL} (#{RUBY_PLATFORM})",
:desc => "The HTTP User-Agent string to send when making network requests."
},
:filetimeout => {
:default => "15s",
:type => :duration,
:desc => "The minimum time to wait between checking for updates in
configuration files. This timeout determines how quickly Puppet checks whether
a file (such as manifests or puppet.conf) has changed on disk. The default will
change in a future release to be 'unlimited', requiring a reload of the Puppet
service to pick up changes to its internal configuration. Currently we do not
accept a value of 'unlimited'. To reparse files within an environment in
Puppet Server please use the environment_cache endpoint",
:hook => proc do |val|
unless [0, 15, '15s'].include?(val)
Puppet.deprecation_warning(<<-WARNING)
Fine grained control of filetimeouts is deprecated. In future
releases this value will only determine if file content is cached.
Valid values are 0 (never cache) and 15 (15 second minimum wait time).
WARNING
end
end
},
:environment_timeout => {
:default => "0",
:type => :ttl,
:desc => "How long the Puppet server should cache data it loads from an
environment.
A value of `0` will disable caching. This setting can also be set to
`unlimited`, which will cache environments until the server is restarted
or told to refresh the cache. All other values will result in Puppet
server evicting expired environments. The expiration time is computed
based on either when the environment was created or last accessed, see
`environment_timeout_mode`.
You should change this setting once your Puppet deployment is doing
non-trivial work. We chose the default value of `0` because it lets new
users update their code without any extra steps, but it lowers the
performance of your Puppet server. We recommend either:
* Setting this to `unlimited` and explicitly refreshing your Puppet server
as part of your code deployment process.
* Setting this to a number that will keep your most actively used
environments cached, but allow testing environments to fall out of the
cache and reduce memory usage. A value of 3 minutes (3m) is a reasonable
value. This option requires setting `environment_timeout_mode` to
`from_last_used`.
Once you set `environment_timeout` to a non-zero value, you need to tell
Puppet server to read new code from disk using the `environment-cache` API
endpoint after you deploy new code. See the docs for the Puppet Server
[administrative API](https://puppet.com/docs/puppetserver/latest/admin-api/v1/environment-cache.html).
",
:hook => proc do |val|
if Puppet[:environment_timeout_mode] == :from_created
unless [0, 'unlimited', Float::INFINITY].include?(val)
Puppet.deprecation_warning("Evicting environments based on their creation time is deprecated, please set `environment_timeout_mode` to `from_last_used` instead.")
end
end
end
},
:environment_timeout_mode => {
:default => :from_created,
:type => :symbolic_enum,
:values => [:from_created, :from_last_used],
:desc => "How Puppet interprets the `environment_timeout` setting when
`environment_timeout` is neither `0` nor `unlimited`. If set to
`from_created`, then the environment will be evicted `environment_timeout`
seconds from when it was created. If set to `from_last_used` then the
environment will be evicted `environment_timeout` seconds from when it
was last used."
},
:environment_data_provider => {
:desc => "The name of a registered environment data provider used when obtaining environment
specific data. The three built in and registered providers are 'none' (no data), 'function' (data
obtained by calling the function 'environment::data()') and 'hiera' (data obtained using a data
provider configured using a hiera.yaml file in root of the environment).
Other environment data providers may be registered in modules on the module path. For such
custom data providers see the respective module documentation. This setting is deprecated.",
:hook => proc { |value|
unless value.nil? || Puppet[:strict] == :off
#TRANSLATORS 'environment_data_provider' is a setting and should not be translated
Puppet.deprecation_warning(_("Setting 'environment_data_provider' is deprecated."))
end
}
},
:prerun_command => {
:default => "",
:desc => "A command to run before every agent run. If this command returns a non-zero
return code, the entire Puppet run will fail.",
},
:postrun_command => {
:default => "",
:desc => "A command to run after every agent run. If this command returns a non-zero
return code, the entire Puppet run will be considered to have failed, even though it might have
performed work during the normal run.",
},
:freeze_main => {
:default => false,
:type => :boolean,
:desc => "Freezes the 'main' class, disallowing any code to be added to it. This
essentially means that you can't have any code outside of a node,
class, or definition other than in the site manifest.",
},
:preview_outputdir => {
:default => '$vardir/preview',
:type => :directory,
:mode => "0750",
:owner => "service",
:group => "service",
:desc => "The directory where catalog previews per node are generated."
}
)
settings.define_settings(:module_tool,
:module_repository => {
:default => 'https://forgeapi.puppet.com',
:desc => "The module repository",
},
:module_working_dir => {
:default => (Puppet::Util::Platform.windows? ? Dir.tmpdir() : '$vardir/puppet-module'),
:desc => "The directory into which module tool data is stored",
},
:forge_authorization => {
:default => nil,
:desc => "The authorization key to connect to the Puppet Forge. Leave blank for unauthorized or license based connections",
},
:module_groups => {
:default => nil,
:desc => "Extra module groups to request from the Puppet Forge. This is an internal setting, and users should never change it.",
}
)
settings.define_settings(
:main,
# We have to downcase the fqdn, because the current ssl stuff (as opposed to in master) doesn't have good facilities for
# manipulating naming.
:certname => {
:default => lambda { Puppet::Settings.default_certname.downcase },
:desc => "The name to use when handling certificates. When a node
requests a certificate from the CA puppet master, it uses the value of the
`certname` setting as its requested Subject CN.
This is the name used when managing a node's permissions in
Puppet Server's [auth.conf](https://puppet.com/docs/puppetserver/latest/config_file_auth.html).
In most cases, it is also used as the node's name when matching
[node definitions](https://puppet.com/docs/puppet/latest/lang_node_definitions.html)
and requesting data from an ENC. (This can be changed with the `node_name_value`
and `node_name_fact` settings, although you should only do so if you have
a compelling reason.)
A node's certname is available in Puppet manifests as `$trusted['certname']`. (See
[Facts and Built-In Variables](https://puppet.com/docs/puppet/latest/lang_facts_and_builtin_vars.html)
for more details.)
* For best compatibility, you should limit the value of `certname` to
only use lowercase letters, numbers, periods, underscores, and dashes. (That is,
it should match `/\A[a-z0-9._-]+\Z/`.)
* The special value `ca` is reserved, and can't be used as the certname
for a normal node.
**Note:** You must set the certname in the main section of the puppet.conf file. Setting it in a different section causes errors.
Defaults to the node's fully qualified domain name.",
:hook => proc { |value| raise(ArgumentError, _("Certificate names must be lower case")) unless value == value.downcase }},
:dns_alt_names => {
:default => '',
:desc => <<EOT,
A comma-separated list of alternate DNS names for Puppet Server. These are extra
hostnames (in addition to its `certname`) that the server is allowed to use when
serving agents. Puppet checks this setting when automatically creating a
certificate for Puppet agent or Puppet Server. These can be either IP or DNS, and the type
should be specified and followed with a colon. Untyped inputs will default to DNS.
In order to handle agent requests at a given hostname (like
"puppet.example.com"), Puppet Server needs a certificate that proves it's
allowed to use that name; if a server shows a certificate that doesn't include
its hostname, Puppet agents will refuse to trust it. If you use a single
hostname for Puppet traffic but load-balance it to multiple Puppet Servers, each
of those servers needs to include the official hostname in its list of extra
names.
**Note:** The list of alternate names is locked in when the server's
certificate is signed. If you need to change the list later, you can't just
change this setting; you also need to regenerate the certificate. For more
information on that process, see the [cert regen docs]
(https://puppet.com/docs/puppet/latest/ssl_regenerate_certificates.html).
To see all the alternate names your servers are using, log into your CA server
and run `puppetserver ca list --all`, then check the output for `(alt names: ...)`.
Most agent nodes should NOT have alternate names; the only certs that should
have them are Puppet Server nodes that you want other agents to trust.
EOT
},
:csr_attributes => {
:default => "$confdir/csr_attributes.yaml",
:type => :file,
:desc => <<EOT
An optional file containing custom attributes to add to certificate signing
requests (CSRs). You should ensure that this file does not exist on your CA
puppet master; if it does, unwanted certificate extensions may leak into
certificates created with the `puppetserver ca generate` command.
If present, this file must be a YAML hash containing a `custom_attributes` key
and/or an `extension_requests` key. The value of each key must be a hash, where
each key is a valid OID and each value is an object that can be cast to a string.
Custom attributes can be used by the CA when deciding whether to sign the
certificate, but are then discarded. Attribute OIDs can be any OID value except
the standard CSR attributes (i.e. attributes described in RFC 2985 section 5.4).
This is useful for embedding a pre-shared key for autosigning policy executables
(see the `autosign` setting), often by using the `1.2.840.113549.1.9.7`
("challenge password") OID.
Extension requests will be permanently embedded in the final certificate.
Extension OIDs must be in the "ppRegCertExt" (`1.3.6.1.4.1.34380.1.1`),
"ppPrivCertExt" (`1.3.6.1.4.1.34380.1.2`), or
"ppAuthCertExt" (`1.3.6.1.4.1.34380.1.3`) OID arcs. The ppRegCertExt arc is
reserved for four of the most common pieces of data to embed: `pp_uuid` (`.1`),
`pp_instance_id` (`.2`), `pp_image_name` (`.3`), and `pp_preshared_key` (`.4`)
--- in the YAML file, these can be referred to by their short descriptive names
instead of their full OID. The ppPrivCertExt arc is unregulated, and can be used
for site-specific extensions. The ppAuthCert arc is reserved for two pieces of
data to embed: `pp_authorization` (`.1`) and `pp_auth_role` (`.13`). As with
ppRegCertExt, in the YAML file, these can be referred to by their short
descriptive name instead of their full OID.
EOT
},
:certdir => {
:default => "$ssldir/certs",
:type => :directory,
:mode => "0755",
:owner => "service",
:group => "service",
:desc => "The certificate directory."
},
:ssldir => {
:default => "$confdir/ssl",
:type => :directory,
:mode => "0771",
:owner => "service",
:group => "service",
:desc => "Where SSL certificates are kept."
},
:ssl_lockfile => {
:default => "$ssldir/ssl.lock",
:type => :string,
:desc => "A lock file to indicate that the ssl bootstrap process is currently in progress.",
},
:publickeydir => {
:default => "$ssldir/public_keys",
:type => :directory,
:mode => "0755",
:owner => "service",
:group => "service",
:desc => "The public key directory."
},
:requestdir => {
:default => "$ssldir/certificate_requests",
:type => :directory,
:mode => "0755",
:owner => "service",
:group => "service",
:desc => "Where host certificate requests are stored."
},
:privatekeydir => {
:default => "$ssldir/private_keys",
:type => :directory,
:mode => "0750",
:owner => "service",
:group => "service",
:desc => "The private key directory."
},
:privatedir => {
:default => "$ssldir/private",
:type => :directory,
:mode => "0750",
:owner => "service",
:group => "service",
:desc => "Where the client stores private certificate information."
},
:passfile => {
:default => "$privatedir/password",
:type => :file,
:mode => "0640",
:owner => "service",
:group => "service",
:desc => "Where puppet agent stores the password for its private key.
Generally unused."
},
:hostcsr => {
:default => "$requestdir/$certname.pem",
:type => :file,
:mode => "0644",
:owner => "service",
:group => "service",
:desc => "Where individual hosts store their certificate request (CSR)
while waiting for the CA to issue their certificate."
},
:hostcert => {
:default => "$certdir/$certname.pem",
:type => :file,
:mode => "0644",
:owner => "service",
:group => "service",
:desc => "Where individual hosts store and look for their certificates."
},
:hostprivkey => {
:default => "$privatekeydir/$certname.pem",
:type => :file,
:mode => "0640",
:owner => "service",
:group => "service",
:desc => "Where individual hosts store and look for their private key."
},
:hostpubkey => {
:default => "$publickeydir/$certname.pem",
:type => :file,
:mode => "0644",
:owner => "service",
:group => "service",
:desc => "Where individual hosts store and look for their public key."
},
:localcacert => {
:default => "$certdir/ca.pem",
:type => :file,
:mode => "0644",
:owner => "service",
:group => "service",
:desc => "Where each client stores the CA certificate."
},
:ca_fingerprint => {
:default => nil,
:type => :string,
:desc => "The expected fingerprint of the CA certificate. If specified, the agent
will compare the CA certificate fingerprint that it downloads against this value
and reject the CA certificate if the values do not match. This only applies
during the first download of the CA certificate."
},
:ssl_trust_store => {
:default => nil,
:type => :file,
:desc => "A file containing CA certificates in PEM format that puppet should trust
when making HTTPS requests. This **only** applies to https requests to non-puppet
infrastructure, such as retrieving file metadata and content from https file sources,