280 Commits

Author SHA1 Message Date
Auke Kok 402d6a6255 v38 v38 2019-09-23 10:10:20 -07:00
Auke Kok 922b303f1b Don't create an abbreviated AWS user-data. 2019-09-23 10:09:46 -07:00
Auke Kok c351cb4ea5 v37 v37 2019-09-23 09:47:25 -07:00
jwang 2c7059fa5d fix wrong retcode check for write_lines function
write_lines return 0 means succeed, thus !write_lines go into error
handling path, which is not expected.

Signed-off-by: jwang <jing.j.wang@intel.com>
2019-09-12 10:47:53 -07:00
Auke Kok d2451d23ec Create write_lines() function to replace problematic duplicate code.
Create a new function for both sections of code needing to output
remainder stream bytes into output file. This makes error handling simpler
and easier to focus on the errors here in tencent.

I've adapted the code to use the OCI model of outputting the needed
data since OCI code written by William handles the output slightly
different based on previous experiences with OCI and I think this may
just help the Tencent case as well.

Also change some types to reduce casting. All in all this slightly
cleans up the code a bit.
2019-08-16 13:01:13 -07:00
Auke Kok 51e7f96ba3 Catch empty user_data file - nothing possible to do. 2019-08-15 16:11:17 -07:00
Auke Kok 57c3c60066 Check return value of write(). 2019-08-15 15:04:42 -07:00
Auke Kok d54043ce45 Handle write() exception. 2019-08-15 14:47:14 -07:00
Auke Kok 160ec7394e Don't run strlen() if buf is NULL.
Change the order here to make sure we're not running strlen
for no reason.
2019-08-15 14:05:31 -07:00
Auke Kok bdad5c2818 Update man pages to reflect the ucd-data-fetch program. 2019-08-07 14:59:30 -07:00
Auke Kok 01d4102d99 ucd-data-fetch: Support HTTP/1.1, allow HTTP/1.0 responses.
We do not want to break anything where HTTP/1.0 is only supported,
so we advertise 1.1 but allow responses from 1.0 capable server
as well as 1.1 capable servers.
2019-08-07 13:29:32 -07:00
Auke Kok 31e30b5b29 Start of unification of aws/oci/tencent data fetcher.
Instead of keep duplicating existing code, we can make this program
a little bit more versatile and cover all 3 use cases and add some
extensibility for further additions.

A static table describes what needs fetching and from where. The
rest is logically the same and so the delta isn't so bad.

We add tencent cloud support on top of this.
2019-08-06 15:29:12 -07:00
Auke Kok 908e95fd7c v36 v36 2019-04-11 14:20:26 -07:00
Julio Montes b1073ea8d4 disk: maximize rootfs partition
Other cloud-config implementations like cloud-init resizes automatically the
rootfs to the maximum allowed, ucd should do the same.

fixes #34

Signed-off-by: Julio Montes <julio.montes@intel.com>
2019-04-11 23:18:28 +02:00
Auke Kok 1f7c95ba1a Update man pages with proper formatting. v35 2018-11-16 10:58:38 -08:00
Auke Kok 496c1bb1b0 Also ignore ucd-oci 2018-11-16 10:58:26 -08:00
Auke Kok 451aa37d84 Fix man page generation. 2018-11-16 10:56:29 -08:00
Auke Kok 203c668269 v35 2018-11-16 10:49:28 -08:00
Auke Kok 365393bd31 Memset struct sockaddr_in to zero. 2018-11-16 10:48:57 -08:00
Auke Kok a98a0fe6c0 v34 v34 2018-11-16 09:45:05 -08:00
Auke Kok dc803bd6aa Fix dead code branch on error condition. 2018-11-16 09:44:46 -08:00
Mark D Horn bbed0e8a1b Markdown formatting fixes
Signed-off-by: Mark D Horn <mark.d.horn@intel.com>
2018-09-13 08:59:56 -07:00
Auke Kok 45e7443579 v33 v33 2018-09-06 09:29:28 -07:00
Auke Kok bfc2d427be AWS: Do not assume the HTTP server supports keep-alive.
On some of the computational AWS instances, the HTTP service at
169.254* does not support HTTP/1.0 keep-alive. This causes the
second part of the user-data not to be transferred and results
in an error during the execution of ucd-aws. Subsequently, the
SSH key never gets provisioned by `ucd`. The result is an unusable
AWS instance that can't be remotely logged into.

Instead, we just terminate and reconnect for the second HTTP
request, reusing some memory where we can. This is a minute
bit slower, and doesn't really come at a size penalty either,
since it's just the same functions being used.
2018-09-06 09:26:29 -07:00
Auke Kok 48be37060f v32 v32 2018-08-09 14:27:09 -07:00
Auke Kok 58f50b83c8 Do not run initial setup async.
Since we have another task also run `usermod` as well, these
might bump into a lock file for /etc/ files and fail, leaving
the system unable to login a normal user.
2018-08-09 14:24:02 -07:00
Auke Kok 382d455f0f v31 v31 2018-05-14 15:07:35 -07:00
William Douglas abe84ebe5d Fix logic for testing HTTP errors
Change to test if HTTP code is < 200 or > 299 rather than being both <
200 and > 299.
2018-05-14 15:05:49 -07:00
William Douglas bfadb7b09f Add Oracle Cloud support
Enable ucd to work within the Oracle Cloud environment. In this case
it involves creating the opc user and provisioning the ssh public
key.
2018-05-14 15:05:49 -07:00
Auke Kok 7e7755ac37 Fix typo (wiht->with) 2017-11-13 10:45:45 -08:00
Auke Kok 2157df468b v30 v30 2017-07-11 12:24:49 -07:00
Auke Kok 40f0588d19 Check in the man page output as well for ucd-aws.1 2017-06-30 12:37:59 -07:00
Auke Kok 3784aea67a meta-data: process public_keys
This adds support for parsing openstack meta-data.json files in
config-2 filesystems and extracting and installing any SSH pubkeys
into the default user account.

In order to properly parse a config-2 json blob outside of the normal
openstack early initialization, we need to fill the parser table
properly and clean it up.

This exposes some flaws in other parts of this code that appear that
this wasn't entirely fully tested. I have not yet confirmed that
in a config-2 scenario everything actually automatically works yet,
this remains to be done.
2017-06-30 12:31:56 -07:00
Auke Kok 3117776034 Update man page result. 2017-06-26 10:16:33 -07:00
Auke Kok ff9fc02f35 v29 v29 2017-06-09 15:15:13 -07:00
Auke Kok b83cd00521 Add ucd-aws(1) man page. 2017-06-07 14:34:51 -07:00
Auke Kok 590b3aab6a Convert man pages to .md format, add ronn to Makefile.am. 2017-06-07 13:58:18 -07:00
Auke Kok 89bc08e5b4 v28 v28 2017-05-05 15:36:35 -07:00
Auke Kok 9d13049eb3 Fetch both ssh key and userdata in one http conversation. 2017-05-05 15:34:52 -07:00
Auke Kok 5056dc93ef Do not hard code path to ucd binary, instead pass $bindir 2017-05-02 10:28:21 -07:00
Auke Kok 5531716c67 Makedev will be in <sys/sysmacros.h>. 2017-05-02 10:10:46 -07:00
Auke Kok 4e21debad3 Convert to agreed upon code style for braces. 2017-05-02 10:08:50 -07:00
Auke Kok f275bf1eef ucd-aws: install unit file, compile with AM_CFLAGS v27 2017-04-28 15:11:10 -07:00
Auke Kok f4af292368 v26. v26 2017-04-28 15:01:37 -07:00
Auke Kok 5f80692011 ucd AWS helper.
The ucd-aws program fetches the user-data for an AMI instance
over http from 169.254.169.254, and passes it back to ucd.

The service is not supposed to be enabled unless you are running
on AWS, as it is highly specific to that cloud.
2017-04-28 14:48:10 -07:00
Auke Kok a376233cee Update name of the project in 2 more locations.
git grep does not show occurrences of the old name anymore
with this patch.
2016-08-03 12:31:44 -07:00
Julio Montes 061c9dcb2c Merge pull request #23 from ikeydoherty/cleanup2
Various cleanups
2016-07-29 16:09:42 -05:00
Auke Kok eea1e1351f Bump to 25. v25 2016-07-27 14:45:11 -07:00
Ikey Doherty 574c759b30 lib: Ensure pwd_buf is always freed in write_ssh_keys
Prior to this change, a NULL pw_dir would result in pwd_buf being leaked after
write_ssh_keys is called. Granted, it's a minor leak, and only potential, but
should still be fixed regardless.

Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
2016-07-27 14:43:52 -07:00
Ikey Doherty bc5f756f33 tests: Ensure global cflags are used here in all cases
Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
2016-07-27 14:43:52 -07:00