Я хочу поиграть с марионеткой, поэтому я создал небольшую тестовую среду, состоящую из 4 виртуальных машин.
DNS настроен правильно, он правильно отвечает на все прямые и обратные запросы.
Вот набор команд, которые я выполнил на обоих vms ubuntu (базовая конфигурация)
sudo dpkg-reconfigure keyboard-configuration
sudo apt-get install -y vim openssh-server ntp
sudo dpkg-reconfigure tzdata
vi /etc/hostname (set to puppet / puppetclient)
sudo reboot now
wget https://apt.puppetlabs.com/puppetlabs-release-pc1-xenial.deb
sudo dpkg -i puppetlabs-release-pc1-xenial.deb
sudo apt-get update
А потом по мастеру:
sudo apt-get -y install puppetserver
sudo /opt/puppetlabs/bin/puppet resource service puppetserver ensure=running enable=true
sudo service puppetserver restart
Puppetserver-service работает нормально (после назначения виртуальной машине 6 ГБ ОЗУ;))
На клиенте:
sudo apt-get install puppet-agent
sudo /opt/puppetlabs/bin/puppet resource service puppet ensure=running enable=true
Затем на клиенте я делаю:
puppet agent --server puppet.puppet.intra --waitforcert 60 --test
На это отвечает
Error: Could not request certificate: The CSR retrieved from the master does not match the agent's public key.
CSR fingerprint: 82:F5:08:CC:98:8A:D1:8F:EC:3D:B0:F7:5B:EB:43:FC:FC:0D:95:30:E8:6F:7F:81:9E:1B:02:CB:A4:01:0E:50
CSR public key: Public-Key: (4096 bit)
Modulus:
...
Exponent: 65537 (0x10001)
Agent public key: Public-Key: (4096 bit)
Modulus:
...
Exponent: 65537 (0x10001)
To fix this, remove the CSR from both the master and the agent and then start a puppet run, which will automatically regenerate a CSR.
On the master:
puppet cert clean puppetclient.puppet.intra
On the agent:
1a. On most platforms: find /home/administrator/.puppetlabs/etc/puppet/ssl -name puppetclient.puppet.intra.pem -delete
1b. On Windows: del "\home\administrator\.puppetlabs\etc\puppet\ssl\certs\puppetclient.puppet.intra.pem" /f
2. puppet agent -t
Конечно, я выполнил предложенные шаги по устранению неполадок, но безрезультатно. Далее я проверил:
Что я делаю не так?
С уважением, Кристиан
редактировать
I just realized something: It seems like the problem only occurs when I try to run puppet as a different user than I installed it with. I wanted to run puppet agent -t as root with sudo on an OS X client and got the error message described earlier. When I run puppet as the user I installed it with, the error doesn't occur. How can I fix this?
TL; DR: используйте sudo все время или войдите в систему как root (хотя не рекомендуется)
Хорошо, похоже, это была моя ошибка: я не уверен на 100 процентов, но, возможно, я установил марионетку как root (через sudo), выполнил CSR как обычный пользователь, а затем снова попытался запустить ее как root.
Похоже, мне следовало использовать sudo / root все время, потому что после того, как я удалил сертификаты с клиента и сервера, вот так:
To fix this, remove the CSR from both the master and the agent and then start a puppet run, which will automatically regenerate a CSR.
On the master:
puppet cert clean puppetclient.puppet.intra
On the agent:
1a. On most platforms: find /home/administrator/.puppetlabs/etc/puppet/ssl -name puppetclient.puppet.intra.pem -delete
1b. On Windows: del "\home\administrator\.puppetlabs\etc\puppet\ssl\certs\puppetclient.puppet.intra.pem" /f
2. puppet agent -t
А затем переделал CSR как root, теперь все вроде работает нормально.