Florian
12/06/2022, 2:46 PMcruelsmith
12/06/2022, 2:47 PMLumiere
12/06/2022, 2:48 PMbastelfreak
12/06/2022, 2:48 PMLumiere
12/06/2022, 2:49 PMbastelfreak
12/06/2022, 2:49 PMLumiere
12/06/2022, 2:49 PMLumiere
12/06/2022, 2:49 PMLumiere
12/06/2022, 2:51 PMFlorian
12/06/2022, 2:54 PMLumiere
12/06/2022, 3:04 PMLumiere
12/06/2022, 3:05 PMSlackbot
12/06/2022, 3:20 PMMoe
12/06/2022, 3:26 PM# init.pp
class profile_cmdbautomation (
Hash[String[1],Hash[String[1],Sensitive[String[1]]]] $tokens,
) {
$tokens.each |String[1] $api_user, Struct[{
'client_key' => Sensitive[String[1]],
'secret_key' => Sensitive[String[1]],
}] $credentials| {
file { "/opt/token/${api_user}.json":
ensure => file,
path => "/opt/token/${api_user}.json",
content => "{\"client_key\":\"${credentials['client_key']}\",\"secret_key\":\"${credentials['secret_key']}\"}",
}
}
}
Here is the yaml code that goes along with it:
---
# node.yaml
lookup_options:
'profile_test::tokens':
'^.+$':
client_key:
convert_to: 'Sensitive'
secret_key:
convert_to: 'Sensitive'
profile_test::tokens:
user-1:
client_key: ENC[PKCS7,MIIBmQYJKoZI[...]8+zLmit3+61U+aBflVU=]
secret_key: ENC[PKCS7,MIIBuQYJKoZI[...]GRT1NTmy26NVlqmUJg==]
user-2:
client_key: ENC[PKCS7,MIIBmQYJKoZI[...]syUwZKvnmjnnHipKahc=]
secret_key: ENC[PKCS7,MIIBuQYJKoZI[...]rmLfzBi+4zTlvWWmTg==]
user-3:
client_key: ENC[PKCS7,MIIBmQYJKoZI[...]IJaRT6Ny1TTSaHIEYmk=]
secret_key: ENC[PKCS7,MIIBuQYJKoZI[...]x/tdRWBpRBJXWd9xcA==]
I thought I am smart and use a regex to get all entries in the hash (and it seems to be working?!) but it's not converting it.
Is the lookup_option even capable of drilling down into a hash?Moe
12/06/2022, 3:29 PMexpects a Sensitive[String] value, got String. I am using the Hiera lookup_options function to convert_to: Sensitive but it's not working.
I'll start a tread to post my example code I came up with to reproduce the problem. Maybe you can spot where I'm "holding it wrong".Moe
12/06/2022, 3:38 PMSensitive parts in the manifest - Puppet happily decrypt the ENC strings.
The logic works, it's just that I want to check whether the key holds data of the type Sensitive and I'm not sure I can check for that.Moe
12/06/2022, 3:47 PM# init.pp
class profile_test (
Hash[String[1],Hash[String[1],Sensitive[String[1]]]] $tokens,
) {
$tokens.each |String[1] $api_user, Struct[{
'client_key' => Sensitive[String[1]],
'secret_key' => Sensitive[String[1]],
}] $credentials| {
file { "/opt/token/${api_user}.json":
ensure => file,
path => "/opt/token/${api_user}.json",
content => "{\"client_key\":\"${credentials['client_key']}\",\"secret_key\":\"${credentials['secret_key']}\"}",
}
}
}
Here is the yaml code that goes along with it:
---
# node.yaml
lookup_options:
'profile_test::tokens':
'^.+$':
client_key:
convert_to: 'Sensitive'
secret_key:
convert_to: 'Sensitive'
profile_test::tokens:
user-1:
client_key: ENC[PKCS7,MIIBmQYJKoZI[...]8+zLmit3+61U+aBflVU=]
secret_key: ENC[PKCS7,MIIBuQYJKoZI[...]GRT1NTmy26NVlqmUJg==]
user-2:
client_key: ENC[PKCS7,MIIBmQYJKoZI[...]syUwZKvnmjnnHipKahc=]
secret_key: ENC[PKCS7,MIIBuQYJKoZI[...]rmLfzBi+4zTlvWWmTg==]
user-3:
client_key: ENC[PKCS7,MIIBmQYJKoZI[...]IJaRT6Ny1TTSaHIEYmk=]
secret_key: ENC[PKCS7,MIIBuQYJKoZI[...]x/tdRWBpRBJXWd9xcA==]
I thought I am smart and use a regex to get all entries in the hash (and it seems to be working?!) but it's not converting it.
Is the lookup_option even capable of drilling down into a hash?Moe
12/06/2022, 4:22 PM---
# node.yaml
lookup_options:
'profile_test::api_password':
convert_to: 'Sensitive'
profile_test::api_password: ENC[PKCS7,MIIBuQYJKoZI[...]x/tdRWBpRBJXWd9xcA==]
# init.pp
class profile_test (
Sensitive $api_password,
){
notify ("Encrypted string: ${api_password}")
}
"just" works.ramindk
12/06/2022, 4:23 PMAndrew
12/06/2022, 4:32 PMjolokia and am running into a permission issue. Any ideas?
Error message:
[root@puppetserver01 puppetlabs]# curl localhost:8080/metrics/v2/list
Forbidden request: /metrics/v2/list (method :get). Please see the server logs for details
`metrics.conf`:
metrics {
metrics-webservice: {
jolokia: {
enabled: true # uncomment this line to disable jolokia metrics
servlet-init-params: {
# Specify a custom security policy:
# <https://jolokia.org/reference/html/security.html>
policyLocation: "file:///etc/puppetlabs/puppetdb/jolokia-access.xml"
}
}
}
}
`jolokia-access.xml`:
<?xml version="1.0" encoding="utf-8"?>
<restrict>
<remote>
<host>127.0.0.1</host>
</remote>
<http>
<method>post</method>
<method>get</method>
</http>
<commands>
<command>read</command>
<command>list</command>
</commands>
<allow>
<mbean>
<name>java.lang:type=Memory</name>
<operation>gc</operation>
</mbean>
</allow>
<deny>
<mbean>
<name>com.mchange.v2.c3p0:type=PooledDataSource,*</name>
<attribute>properties</attribute>
</mbean>
</deny>
</restrict>Dr Bunsen Honeydew
12/06/2022, 5:45 PMDoug
12/06/2022, 7:13 PMDr Bunsen Honeydew
12/06/2022, 7:13 PMpuppetlabs-postgresql module at https://forge.puppet.com/puppetlabs/postgresql?src=slack&channel=puppetSlackbot
12/06/2022, 7:15 PMsmortex
12/06/2022, 7:39 PMChris Allen
12/06/2022, 7:47 PM$list is the array of packages and $package is just a single element of that array.Chris Allen
12/06/2022, 7:48 PM$list is the array of packages and $package is just a single element of that array.Slackbot
12/06/2022, 8:08 PMnatemccurdy
12/06/2022, 8:56 PM.<function>) of calling functions:
https://puppet.com/docs/puppet/7/lang_functions.html#chained-function-callsnatemccurdy
12/06/2022, 9:29 PMin wouldn't consider those as the same. 'micosoft-edge' in ["Opera Stable 93.0.4585.37", "Microsoft Edge"] will never be true.