aboutsummaryrefslogtreecommitdiff
path: root/libexec/nuageinit
Commit message (Collapse)AuthorAgeFilesLines
...
* Update Makefile.depend filesSimon J. Gerraty2024-10-142-0/+20
| | | | | | | After building packages we have a number of new and updated Makefile.depend files Reviewed by: stevek
* nuageinit: tests: CleanupJose Luis Duran2024-09-262-96/+83
| | | | | | | | | | - Export NUAGE_FAKE_ROOTDIR only once - Use the header section of the test to require the root user - Use the PWD environment variable - Set the root/sys shell as /bin/sh - Use RFC 5737 reserved IP addresses Signed-off-by: Jose Luis Duran <jlduran@gmail.com>
* nuageinit: Fix passwordsJose Luis Duran2024-09-262-7/+7
| | | | | | | | | | | | | | | | The hashed password usually contains a "$" sign, which, when used on a shell, must be escaped. Also, the plain text password may contain special characters that require escaping. Add a quick fix by enclosing it in single quotes. Note that if the plain text password contains a "'", it will still fail. This will be properly fixed in later commits. Some here documents require the document to be a string literal, especially when passing invalid characters. Enclose it in single quotes. Signed-off-by: Jose Luis Duran <jlduran@gmail.com>
* nuageinit: Standardize user-facing error messagesJose Luis Duran2024-09-262-4/+4
| | | | Signed-off-by: Jose Luis Duran <jlduran@gmail.com>
* nuageinit: Standardize warning/error messagesJose Luis Duran2024-09-265-26/+33
| | | | | | | | | | | Standardize the utilities from nuage.lua, to return nil on failure, plus an error message as a second result, and some value different from nil on success. Make warnmsg() and errmsg() append "nuageinit: " by default. Pass an optional second parameter as false to avoid printing this tag. Signed-off-by: Jose Luis Duran <jlduran@gmail.com>
* nuageinit: Replace os.execute with Lua librariesJose Luis Duran2024-09-261-5/+6
| | | | | | | Prefer posix.sys.stat's chmod() to os.execute(). While here, change the name of the locals to be more descriptive. Signed-off-by: Jose Luis Duran <jlduran@gmail.com>
* nuageinit: Lua check and lint filesJose Luis Duran2024-09-2614-208/+258
| | | | | | Mostly white space, style, and luacheck compliance. Signed-off-by: Jose Luis Duran <jlduran@gmail.com>
* nuageinit: improve debugging when mkdir failsBaptiste Daroussin2024-08-201-4/+1
|
* nuageinit: readd ssh key parsing when key is in meta_data.jsonBaptiste Daroussin2024-08-202-0/+54
| | | | | | | | in openstack when no user is specified but a sshkey is provided the information is stored in meta_data.json under "public_keys" PR: 280461 Reported by: tdb
* nuageinit: Fix testsJose Luis Duran2024-07-251-2/+2
| | | | | | | | | | | Commit 07d17ca189fcf3cc44b7706040b05ca8135c3b85 set the recommended permissions for the SSH authorized keys file and directory. The tests, however, were failing on CI. Use stat to check for the proper permissions. Fixes: 07d17ca189f nuageinit: Set recommended SSH permissions Reported by: Jenkins
* nuageinit: Fix the homedir variable nameJose Luis Duran2024-07-251-4/+4
| | | | cloud-init uses homedir, not home.
* nuageinit: Set recommended SSH permissionsJose Luis Duran2024-07-232-0/+4
| | | | | | | As stated in sshd(8), the recommended permissions for ~/.ssh are read/write/execute for the user, and not accessible by others; and the recommended permissions for ~/.ssh/authorized_keys are read/write for the user, and not accessible by others.
* nuageinit: Accept plain text passwordsJose Luis Duran2024-07-232-1/+2
| | | | | | | | | | | Per pw(8), when -H is set, the password should be supplied already encrypted in a form suitable for writing directly to the password database (passwd in cloud-init tems); -h provides a special interface by which interactive scripts can set an account password using pw(8) in plain text (plain_text_passwd in cloud-init terms). The default user (freebsd) is defined with a plain_text_passwd (freebsd), not with an encrypted one.
* nuageinit: check for both user_data and user-dataBaptiste Daroussin2024-06-272-4/+57
| | | | | | | | openstack, ec2 and other implementation of cloudinit disagrees on the name of the file "user-data" or "user_data", test both and use the first found PR: 279876
* nuageinit: fix authorized_key testBaptiste Daroussin2024-06-051-7/+7
| | | | | | | | After miss reading the cloudinit spec I ended up writting a wrong test for basic ssh key setup, nuageinit has been fixed, but not the test, here is the actual fix. Reported by: markj
* nuageinit: make addsshkey friendly for testsuiteBaptiste Daroussin2024-06-051-0/+4
|
* nuageinit: use pw(8) instead of getent(1)Baptiste Daroussin2024-06-051-6/+14
| | | | | | | pw(8) allows to seek for users in a custom rootdir, which makes it easier for a testsuite MFC After: 3 days
* fix (nuageinit): SSH keys are not handled in metadata but in userdataJeremy Collin2024-05-211-7/+0
| | | | MFC After: 1 day
* nuageinit: add basic support for cloudinit.Baptiste Daroussin2024-03-1515-0/+1599
this is a very early script to support cloudinit, it does not intend to be a full featured cloudinit client, but will support a good enough subset to be viable in most case. It support nocloud and openstack config-2 config drive mode (iso9660 or msdosfs) The following features are currently supported: - adding users (including a default user named 'freebsd' with password 'freebsd' - adding groups - adding ssh keys - static ipv4, static ipv6, dynamic ipv4 With this one is able to use the 'bring your own image feature" out of box. It is expected that the script grows the support of other clouds supporting cloud-init, contributions are welcomed. It is designed to be only run once via the firstboot mecanism. Sponsored by: OVHCloud MFC After: 3 weeks Differential Revision: https://reviews.freebsd.org/D44141