293 Commits
Author SHA1 Message Date
Auke Kok 0407325314 v42 v42 2019-10-31 14:39:37 -07:00
Auke Kok 5aa46b9b7d Allow packages etc. to also enter a valid wait for network. 2019-10-31 14:39:13 -07:00
Auke Kok e95430c21a Consolidate 2 vars, ensure we sleep a few times here. 2019-10-31 14:35:09 -07:00
Auke Kok 68e27c67ef Header - multiple inclusion guard. 2019-10-31 14:21:44 -07:00
Auke Kok 85747cb4c2 v41 v41 2019-10-29 11:33:34 -07:00
Auke Kok 9644cbdc5d Add wait_for_network: <boolean>.
This option allows users to suspend execution of the cloud-init provisioning
until a valid network is detected.

This detection is currently done through requesting a DNS lookup for one
of the Clear Linux NTP service IP addresses (this is a RR record, we
don't actually look at the result).

This lookup is not infinite. After 5 minutes, the wait exits no matter
what even if there is no network detected.

The option can be provided manually. `packages` and `package_upgrade`
options *imply* this option, but one can explicitly disable the wait
by providing it early in the cloud-config file with a value of `false`.

The wait routing is active - it will retry relatively quickly to detect
an active connection. Any failure will result in another retry. In
a fully private network without public DNS, this will not work.

The DNS hostname used for testing can be manipulated through the
`-with-dnstestaddr=<hostname>` configure flag. You shouldn't put an
IP address in here, since that fully disables any network testing.
2019-10-29 11:33:17 -07:00
Auke Kok 4364c943e1 v40 v40 2019-10-15 11:31:18 -07:00
jwang 4706d35c2c Add aliyun cloud support
Enable ucd to work in aliyun cloud by add a config templete
for aliyun

Signed-off-by: jwang <jing.j.wang@intel.com>
2019-10-15 11:27:02 -07:00
Auke Kok 2c8d9c0d62 Add security concern section to the README.md. 2019-10-14 14:30:18 -07:00
Auke Kok 112e0a4e39 v39 2019-09-30 10:58:24 -07:00
Auke Kok 542b611ae1 user-data: allow missing user data.
When I deduplicated this code I mistakenly used parse_headers() in
the same way twice. This was incorrect.

We definitely need to error out if a 404 or something else happens
for the SSH keys, since then we've lost entirely.

But a missing `user-data` is mostly harmless and optional, so, in
case a 404 happens for the second `GET` request, we shouldn't error
out, because this makes the instance unusable. Instead, we can
carry on as normal.
2019-09-30 10:58:24 -07:00
Auke Kok a240a29d21 Fix typo in yaml tag for ssh_authorized_keys. 2019-09-30 10:58:24 -07:00
jwang 7ed37b2b41 fix typo in tencent cloud-config template 2019-09-24 20:55:25 -07:00
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