I am currently working on multiple Kickstart configs for my company to allow for easy VM deployment. I cannot find any documentation showing how to have Kickstart generate a root password. Is it possible? If not, can I pipe in output from python
or the likes into the rootpw
option?
Asked
Active
Viewed 840 times
3
FireFaced
- 33
- 4
-
Do you mean create a new, random root password each time run the kickstart script or do you need a method of passing the same root password securely into the kickstart script? – Brett Levene Jun 24 '17 at 21:18
-
A new, random one that is sent via a GPG encrypted email or printed to the screen, whichever is more practical – FireFaced Jun 24 '17 at 21:20
-
I looked at the documentation, and it seems that a post-install script would do the task. – FireFaced Jun 24 '17 at 21:30
-
You can do it via a pre install script, but it would require user input and hence defeat the purpose of an unattended install. I did something similar, the difference being I copied an entire python script over into /tmp and symlinked to the appropriate run level. It gives you a bit more flexibility imo. – Brett Levene Jun 24 '17 at 21:33
-
It looks like a post install script would work best for what I want to do, so I'm going to set that up. I'll post it later for reference for anyone who wants to do the same thing. – FireFaced Jun 24 '17 at 21:38
1 Answers
0
what I do in this situation is generate a 100char long string and then strip randomly out of it from the beginning and the end and then just grab the first X (15 in my case) chars
[...kickstart...]
%post
HOWLONG=15 ## the number of characters
NEWPW=$(< /dev/urandom tr -dc A-Za-z0-9 | head -c100 | head -c$((20+($RANDOM%20))) | tail -c$((20+($RANDOM%20))) | head -c${HOWLONG});
echo "${NEWPW}" | passwd --stdin root
[... rest of the %post block ...]
%end
[...kickstart...]
MatteoBee
- 116
- 4