/srv/irclogs.ubuntu.com/2022/01/24/#cloud-init.txt

falcojrbeantaxi: Generally mostly business hours for reviews15:39
falcojrI don't really have a great answer for your other question15:41
hackedheadso, the docs make a scary note about using hashed passwd's in a cloud-init file, referencing that the example is crackable in mere seconds. But, unless I'm confused, the format used is the exact same format used in /etc/shadow, so they're no riskier (format wise) than revealing /etc/shadow. I was not able to reproduce the crack in seconds (and I tried for a few minutes), but was able to crack15:58
hackedheadknown trivial passwords with the JtR method, using wordlists that I knew would be suitable for my example. So my question: is the _format_ of the passwd body fundamentally unlike /etc/shadow in a subtle way? Or do I just need to not use bad passwords that are going to appear on common wordlists? (Is the example weak because the format is weak? or because the chosen example password is weak15:58
hackedheadrelative to known wordlists/cracking schemes?)15:58
hackedheadreference: line 66 from the first example here: https://cloudinit.readthedocs.io/en/latest/topics/examples.html15:59
hackedheadalso, if I _do_ trust the connection: is this moot?15:59
minimalhackedhead: I guess how "unbreakable" such a password is depends on the algo you use - whether sha512, bcrypt, etc16:03
minimalthe cloud-init docs refer to regex (r'\$(1|2a|2y|5|6)(\$.+){2}') is used to determine if a password value should be treated as a hash16:03
minimalwhere the $1 or $2a, or $2y, or $5, or $6 refer to supported/recognised hash algos16:04
hackedheadbut that's literally how the OS does it as well.16:52
hackedheadI mean, the example reference's sha512, which should be quite secure.16:53
hackedheadbut if i pick the password "abc123" and then run it though 4096 rounds of sha512, and then try to crack it with a wordlist that has "abc123" in the first two hundred entries... it's gonna get craked real fast (seconds)16:54
hackedheadbut that is the result of picking a bad password, not _anything_ to with the algo16:54
minimalhackedhead: different algos have different resistance to bruteforce attacks16:54
hackedheadif I picked a string of 16 random characters, it'd hold up ust fine.16:54
hackedheadI understand that, yes16:54
hackedheadthe question remains: am I _incorrect_ in my udnerstanding that the format in the cloudinit file is the same as the one in /etc/shadow?16:55
hackedheadbecasue they sure look identical.16:56
minimalit still is related to the algo - some algos (BCRYPT? PBKDF) are specifically designed to be "CPU" expensive to do those sort of attacks16:56
hackedheadsure, agreed16:56
hackedheadbut that's not part of my question.16:56
minimalyes I believe it is the same - although as I pointed out the regex may mean cloud-init might not treat some algo hashes appropriately16:56
holmanb@blackboxsw - I followed your recommended suggestion in PR #1203, but it looks like `build-package;sbuild .... cloud-init*.dsc` fails (in the unittests) and I don't know if it's due to a mistake setting up my chroot config or if I made a mistake in the process16:57
hackedheadminimal: if the format is the same (as we both expet/assume) cloud init doesn't ahve to know anyhting at all about the algos. it just has to drop the text into the apsswd file in the right place16:57
hackedheadwhich is actually ery good for cloud init, because it can just be naive.16:58
hackedheadmy concern is that the docs seem to imply cloud-init is doing some _else_ that's weaker, but the warning is really just "don't take you're cloud-init config anywhere you'd not take /etc/shadow"16:58
hackedheadthe "we cracked the example in 12 seconds" is completely misleading, in that case.16:59
hackedheadbecause it implies something about the example password, but could get interpreted as implying something about cloud init16:59
minimalhackedhead: my point was that is you take YESCRYPT as an example I believe all its hashes begin with "$y$" which the above regex not NOT match16:59
minimaland therefore cloud-init will not treat it as a hash, so I guess it will treat it as a unencrypted "raw" (i.e. plaintext) password17:00
hackedheadoh i see, vs treating it as plaintext and hashing the text itself.17:00
hackedheadokay, fair enough17:00
minimalthat's just based on looking at the docs, not at the code17:00
hackedheadI guess my reaction was to the docs saying "you can put a hash here, but <scary> hashes aren't safe </scary>"  ... but they are as safe as it gets, really.17:01
hackedheadnow, you still don't want them on the wire in the clear, if you can help it.17:02
minimalI think in general what the docs are "flagging" is that as user-data is potentially accessible to other parties then as you illustrated weak passwords with certain hash algos risk being "broken" by 3rd parties17:02
hackedheadbut they _are_ cryptographic hashses, they're whole deal is to obscure the plaintext.17:02
hackedheadright. I feel like the warning needs to focus on the wire-access and not on how fast an example password gets cracked.17:03
minimalyou mentioned /etc/shadow - in order to try and crack passwords there someone needs access to a machine, whereas with user-data (i.e. provided via metadata server) they do not need access to the machine so the potential risk is increased17:04
holmanbhackhead: The wording could be more clear about the risks associated with using passwd, I agree. For reference, the implementation passes the value to `adduser --password <value>` (seee cloudinit/distros/__init__.py)17:09
minimalholmanb: I guess my point was that regex is in the code and so restricts the recognised hash algos: https://github.com/canonical/cloud-init/blob/main/cloudinit/config/cc_set_passwords.py#L16817:12
falcojrminimal: that's actually a different implementation for a different module17:13
falcojrfor user definitions, passwd gets passed straight to useradd17:14
minimalright,, but this can also be used to set user password via chpasswd: list: 17:15
falcojrcorrect17:15
minimalI would have expected both places to act in the same fashion17:16
blackboxswholmanb: checking now.17:27
blackboxswdidn't realize my IRC proxy logged me out17:27
holmanbblackboxsw: all good17:28
holmanbminimal: That module suffers from having to disambiguate different data types from one list since it supports encrypted, unencrypted, and random passwords. At first blush, a more explicit schema is one way I might approach improving that module (a dict of lists, perhaps?).17:45
minimalholmanb: yeah its trying to use "magic" (regex) which always suffers from not being up-to-date with things like new hash algos.17:47
minimalThen again personally I'd never17:48
minimaloopps, I only use SSH key access to machines so no worry about passwd hashes17:48
hackedheadyeah, not trying to magically tell the difference between plain and cipher text would be safer.17:50
hackedheadthanks everyone, for improving my understanding here.17:50
minimalyeah, why can't I see my password to be "$6$afrtgyhuj" :-)17:51
blackboxswholmanb: when I take your bionic PR I can confirm unittest failure during  sbuild --resolve-alternatives --dist=bionic --arch=amd64  --arch-all ../out/cloud-init_*dsc`  I can also see it locally outside of package build with `quilt push -a; tox -e py3 tests/unittests/sources/test_openstack.py` Its the default: False on Bionic for JSON network config. I'm trying to figure out why that unittest works on upstream/ubuntu/bionic17:54
blackboxswminimal:  "$6$afrtgyhuj" == "hunter2" :)17:55
blackboxsw... cloudn't resist the meme reference. apologies17:56
blackboxswahh holmanb, your quilt patch update patched the wrong unittest to apply_network_config: True. which is why the unittests are failing during package build.17:59
minimalblackboxsw: no worries, the ref was lost on me as I didn't use IRC back then lol18:00
blackboxswminimal: heh, I assumed as much. It was a bit oblique and dated :)18:02
minimalits not the dated bit - I've been online for a very long time :-)18:02
blackboxswholmanb: I think our Bionic PR should have patched test/unittests/sources/test_openstack.py::test_network_config_from_network_json instead of test_network_config_disabled_by_datasource_config18:03
blackboxswholmanb: posted a diff comment to your PR for bionic. not sure why I thought I saw success friday18:15
blackboxswthen we can merge and kick off CI package build recipes for bionic18:16
holmanb@blackboxsw: I just pushed the requested changes. Lintian failed, but since the final status is successful I assume that doesn't matter.19:16
blackboxswholmanb: running locally here. Thanks for bringing up the lintian aspect of things. What we care about in lintian mostly on older Ubuntu releases is that we don't introduce new errors and or warnings. In this case, we did introduce one new warning `W: cloud-init: spelling-error-in-changelog propery property`. Let's fix that typo in debian/changelog and git rebase squash it into the commit 19:34
blackboxsw4006ff2ceb37369dbd097aa70a6909093378320019:34
blackboxswwe'll have to remember that typo fixup too when we release into Jammy or other releases too, but as long as we watch for lintian warns/errors increasing we'll continue to catch it19:35
blackboxswI don't care much about preserving separate commits to d/changelog for typo-changes etc unless there are significant changesets that we find we want to git cherry-pick across ubuntu/* release branches.19:37
blackboxswhence the suggestion to squash in this case. But if you prefer otherwise all you19:37
holmanbahh, that one got added after this pr I see19:45
holmanbI can squash19:45
holmanberr, scratch that I see what you mean19:57
holmanb@blackboxsw: lintian still complains about s/propery/property/ after squash, not sure why :/20:13
blackboxswthat's sure funky. checking your pushed PR20:14
holmanbblackboxsw: just pushed the latest, might need to refresh20:14
holmanboh wait if I didn't rerun build-package that may have done it perhaps?20:15
blackboxswok yes I was just going to ask if you rebuilt the source tgz using build-package 20:16
blackboxswthat'd be it. otherwise some cases might show up during package build too if you didn't git commit before you used build-package as it ignores local uncommitted changes20:17
blackboxswI'm waiting on sbuild, but your commit change looks good20:17
holmanbI don't think I did after the squash. Rerunning sbuild now, I should know momentarily if it's good20:17
holmanbspelling warning is gone now for me20:18
blackboxswwhich begs the question, what kind of system are you running builds on as you beat me by quite a bit20:19
holmanbI started the rebuild a little before mentioning it here ;)20:19
holmanblets go with that20:19
blackboxswmay be time for me to buy myself a hardware upgrade. I'm still awaiting sbuild and I think I kicked it off a min or two before I told you about the re-build-pkg20:19
blackboxswahh same20:19
blackboxswyep new lintian warning gone20:20
blackboxsw+1-ing, up for a 2 min hangout?20:20
holmanbabsolutely20:20
blackboxswwoo hoo holmanb successful bionic build. thanks for the fix https://code.launchpad.net/~cloud-init-dev/+archive/ubuntu/daily/+recipebuild/2945452 20:54
blackboxswwill kickoff integration tests once that package shows up as published in the daily PPA20:54
holmanbawesome, thanks!20:55
raidandfadeHowdy folks, hate to drop in but I've been stumped on a cloud-init x openstack issue for a bit now and figured i'd see if any pros can help out - I can't seem to get it to load network_data.json from the metadata service on Ubuntu 18.04 - On ubuntu 20.04, with the same metadata structure, the network_data.json is loaded and implemented into22:56
raidandfadenetplan. I've tracked it down to a single debug logĀ  message "network config provided via network_json" which is logged on 20.04 but not on 18.04, i'm not sure where to go from here.22:56
raidandfadeBoth are running the same 21.4 version of cloud-init from their respective apt repositories, i've also checked back to version 20.3 which seems to reproduce the same behavior.22:57
blackboxswraidandfadethanks for pining here. That behavior of Ubuntu 18.04 (bionic) is as intended. 22:59
blackboxswraidandfade: cloud-init can't change default behavior on stable Ubuntu release based what major features were originally present on 18.04 when it released. This is because  we don't want to surprise people/scripts etc that expect cloud-init  to automatically start rendering network on 18.04 due to network_data.json once we added that feature upstream22:59
blackboxswraidandfade: that said, on older/stable releases we expose configuration options that allow someone to "enable" such configuration if desired22:59
raidandfadeAh, I figured it would be something like that. How do I go about enabling network_data?23:00
blackboxswraidandfade: what would be needed on the 18.04 image that you are consuming is the following datasource configuration:23:00
blackboxswdatasource:                                                                     23:01
blackboxsw  OpenStack:                                                                    23:01
blackboxsw    apply_network_config: true   23:01
blackboxswsomewhere in /etc/cloud/cloud.cfg.d/some-file.cfg on your filesystem23:01
blackboxswthis will tell 18.04 version of cloud-init to consume network_data.json23:02
raidandfadeSimple enough! I figure I may as well plop this on all of my images to avoid future headache23:02
blackboxswas documented here https://cloudinit.readthedocs.io/en/latest/topics/datasources/openstack.html23:02
blackboxswrather https://cloudinit.readthedocs.io/en/latest/topics/datasources/openstack.html#configuration23:02
blackboxswthough docs are sparse on that feature :)23:02
raidandfadeblackboxsw: I appreciate the quick help and response, you've saved me another few hours of headache!23:03
blackboxswno worries, that's what we are here for23:03
blackboxswit helps others too23:03
raidandfadeYeah, I looked at the docs pages for the datasource as well, it doesn't really explain that it's required, and "default: True" isnt helping the confusion23:03
raidandfadeMakes sense as for why it's not default:True at all times, but the docs certainly didn't help figure that out23:03
blackboxswabsolutely. yeah it's magical how older released "don't"  actually have that default :/23:04
blackboxswwe found it hard to figure out the best way to document that particular feature and whether to actually document older versions in tip of main docs :/23:04
raidandfadeIs there a changelog sort of page that has "This feature is only on OS newer than <x>" that i should be aware of?23:05
blackboxswraidandfade: sadly not exactly. From upstream major.minor version perspective we publish general changelogs for the upstream releases at URLs like https://launchpad.net/cloud-init/trunk/21.4  as found from https://launchpad.net/cloud-init/trunk. But individual features that are disabled on stable release isn't somethat that I think we have captured well23:08
blackboxswfrom Ubuntu perspective at Canonical I can say we can try to better represent that and I'll talk to the team about it. But we don't exactly have visibility to whether other distribution downstreams have disabled certain features.23:09
blackboxswraidandfade: for what it's worth: you can quickly check in github what few features Ubuntu has disabled on earlier releases by looking for the patches listed in https://github.com/canonical/cloud-init/tree/ubuntu/bionic/debian/patches or https://github.com/canonical/cloud-init/tree/ubuntu/focal/debian/patches23:10
raidandfadeOh, I think I might've been confused on who decided to make this default false- If it's a decision that the distribution makes then I can surely understand the difficulty of documenting it23:10
blackboxswyeah different distibutions have a different opinion of how much feature risk is reasonable to take with the cloud-init package23:11
blackboxswthat said, as you can see above, we don't carry any "feature disable" patches for focal 20.04 currently for new feature developments.23:11
blackboxswbecause the focal/debian/patches link 404s (because we don't carry any patch delta there)23:12
raidandfadeYeah, I see that. Convenient23:12
blackboxswhope it helps abbit23:12
raidandfadeYou've certainly linked a few good tools for me to use, and given some insight on why this behavior exists in the first place. I've still got a couple more images to create (trying to automate our image generation for most LTS distros i.e. ubuntu fedora debian) so I've got my work cut out for me as far as that goes.23:15
raidandfadeThanks again for the help!23:16
blackboxswraidandfade: nice, do feel free to let us know any pain points in that process. We'll try to iron out what we can23:16
raidandfadeSo far this was the only major problem, i ran into some other small quirks along the way but most of that would be because of my particular design I imagine (for example, we do accept_ra with a static ipv6 allocation on VMs, and cloud_init assumes that impossible)23:17
raidandfadeJust patched the source tree myself for that one, a simple False -> True23:17

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!