/srv/irclogs.ubuntu.com/2023/05/16/#cloud-init.txt

minimalmeena: likewise with LVM you'd not care (assuming roofs is a LV on LVM)00:14
minimalbottom line: partitions, whether on MBR or GPT are placed at specific disk sectors, you can't grow a partition if the sector after the end of that partition is allocated to another partition...00:16
minimalnot having used ZFS I assume it works in a similar fashion to LVM, you're either not partitioning a disk or you're putting ZFS on a partition and then dividing that up inside ZFS00:17
Anianyone looking at https://github.com/canonical/cloud-init/pull/3671 ?05:59
-ubottu:#cloud-init- Pull 3671 in canonical/cloud-init "network-manager: Set higher autoconnect priority for nm keyfiles" [Open]05:59
meenaminimal: i reckon btrfs might also fall into this category, but I've never heard anything good said about that thing06:37
meenaAni: looks sensible to me, but then, i have no clue about Linux (any more)06:40
AniNeed someone to review and merhe07:04
Animerge07:04
=== philroche_ is now known as philroche
meenacc_rsyslog is both over engineered and underwhelming / unambitious13:34
minimalmeena: yes apparently btrfs supports partitionless use directly on a disk (and then you use subvolumes rather than partitions), however we're talking about cloud-init's rootfs' partition growing functionality which obviously only applies where partitioning is used and where the partition containing the rootfs is not "blocked" from growing by there being another partition directly adjacent to the end of that partition14:00
meenaminimal: i still expanded the documentation for people like me, who are not very good at knowing obvious things14:01
meenaready to merge: https://github.com/canonical/cloud-init/pull/411414:01
-ubottu:#cloud-init- Pull 4114 in canonical/cloud-init "FreeBSD: Fix user account locking" [Open]14:02
meenaready to review https://github.com/canonical/cloud-init/pull/2334 (by someone who's not cjp256 ;)14:03
-ubottu:#cloud-init- Pull 2334 in canonical/cloud-init "FreeBSD: add ResizeGrowFS class to cc_growpart" [Open]14:03
minimalmeena: another "obvious" thing to point out is regarding cloud-init's "resizefs" functionality - if you do have your rootfs on LVM/btrfs subvolume/ZFS equivalent then obviously you don't want the rootfs resized to use all available space as typically the main reason to use the like of LVM (and I assume btrfs/ZFS) is so that individual LVs and filesystems can be grown and shrunk as and when required14:04
minimalmeena: interesting to see #4114 as I thought that on BSD systems there is no separation of locking only password access and locking accounts in general14:09
minimalI've hit a related issue in the past with "portable OpenSSH" which treats an account with a locked password as being locked completely for SSH access (even via key), unless PAM is enabled, which seems to relate to OpenSSH's BSD original14:11
minimals/original/origins/14:11
meenaah, probably: OpenBSD doesn't have PAM14:14
minimalfrom https://man.freebsd.org/cgi/man.cgi?query=passwd&sektion=514:15
minimal"An encrypted password prefixed by `*LOCKED*' means that the account is temporarily locked out and no one can log into it using any authentication."14:15
minimalnote the "using any authentication" part14:15
minimalso on FreeBSD if cloud-init locked the password then that means the intention is to prevent both password and SSH key-based access14:16
meenayeah, but look at pw(8) for comparison14:17
meenaminimal: yeah, that was the behaviour so far14:17
meenareportedly bad.14:17
minimalmeena: yes, pw(8) says "to prevent successful authentication", it doesn't say "to prevent successful *password* authentication" ;-)14:18
minimalso pw(8) and passwd(5) so FreeBSD appear to agree with each other14:18
meenaminimal: did you see the section on -w ?14:19
minimalof pw(8)? I looked at the "USER LOCKING" section14:20
meenathat's what we've been doing so far, but that's wrong14:21
minimalwhy is it wrong?14:21
meenabecause it completely prevents an account from logging in14:22
minimalthat's intended as indicated in passwd(5) that I just quoted from14:22
minimal "An encrypted password prefixed by `*LOCKED*' means that the account is temporarily locked out and no one can log into it using any authentication."14:22
minimal*any* authentication14:22
minimalwhich is a difference between BSDs and Linux, in Linux locked the password is only intended to prevent password access, whereas to prevent all forms of access on Linux you'd have to set the account expiration date (from memory)14:24
meenamy Patch changes that. however, it's still not like on Linux14:24
minimalmeena: right but isn't your patch then going against standard BSD behaviour?14:25
meena I don't think so? it's just fixing a bug in cloud-init on FreeBSD14:26
minimalmeena: confused. Do you agree that the FreeBSD passwd(5) manpage indicates that locking a password is intended to prevent all forms of access?14:27
meenaminimal: if on Linux you set an account as locked, and your sudo requires password, can you use sudo?14:27
minimalI'm talking about logging into an account14:28
meenaminimal: locking the password seems to refer to the field14:28
minimalthe field? on FreeBSD? "no one can log into it using any authentication"14:29
minimalif locking the password field on FreeBSD was only intended to lock password then the manpage wouldn't say that doing so would prevent logins using *ANY* authentication14:30
meena   A passwordof `*' indicates that password authentication is disabled for14:31
meena     that account (logins through otherforms of authentication, e.g., using14:31
meena     ssh(1) keys, will still work).  The field only contains encrypted pass-14:31
meena     words, and`*' cannever be the result of encrypting a password.14:31
meenathat's the section above14:31
meenathat's what I've changed it to14:31
minimalmeena: are you quoting FreeBSD or Linux manpage? That looks like Linux manpage14:33
meenahttps://man.freebsd.org/cgi/man.cgi?query=passwd&sektion=514:34
minimalmeena: this is not referring to a *locked* (e.g. by "pw") password however, see the next paragraph14:37
minimalin the case of "*" you CANNOT later unlock it as the password field only contains "*", whereas for a locked password the encrypted password is PREFIXED by "*LOCKED*" which means it can later be unlocked by removing that prefix14:38
meenathat's why i was saying it's not entirely the same as Linux, and asking about the sudo case14:40
meenayou unlock it, by setting a password 14:40
minimalwe are talking about controlling *logins*, using sudo isn't exactly a "login", is it switching to a different user14:40
minimalon both FreeBSD (with "pw unlock") and on Linux (with "passwd -u") you unlock merely by indicating which account and the previous password is reinstated14:42
minimal....which is why on Linux you can't use "passwd -u" on a user account that previously didn't have a password as unlocking would leave it passwordless - "passwd -l" specifically refused to unlock in this scenario14:43
minimaloops s/-l/-u/14:43
meenapasswd -l on FreeBSD sets a NIS account to local only… 14:45
meenathat was… somewhere between bad and useless, but definitely broken. i then changed it to pw usermod -h, which, as it turns out, it's also broken14:46
minimalI think part of the "confusion" is that the cloud-init settings is called "lock_passwd" but the description is "Disable password login" which is not the same thing - as on some systems locking the password will disable all logins, no just via passwords. Perhaps the setting should be renamed to something like "disable_password_login" ;-)14:51
minimalblackboxsw, falcojr, rharper: ^^^14:52
meenaspeaking of esoteric Systems 14:55
meenaminimal: does cc_rsyslog work on Alpine? 14:55
minimalyes14:55
minimalAFAIK14:56
minimal(from memory) I'm using it as the default syslog daemon on my cloud-init enabled Alpine disk images14:57
rharperminimal: it's called lock_password because the GNU tools call it that, and it's not disabling the account, you can still get in with ssh key or some other auth, but you cannot change the account password. 15:01
rharperpasswd --lock, usermod --lock; man pages both indicate it just prevents use of the account password.  15:02
minimalrharper: right on Linux locking the password entry is only expected to disable password acces, however on BSDs that is not the case15:02
rharperYeah, I was remembering that 15:02
minimalalso the problem I had in the past is that "portable" OpenSSH does not behave that way if PAM is disable - it treats locked passwords as preventing all access *UNLESS* PAM is enabled (OpenSSH code has a specific "override" for PAM)15:03
minimalas "locking" does not mean the same thing on all systems, perhaps 2 different settings "disable_password_access" and "disable_account" would be less confusing/more consistent to implement?15:04
rharpermaybe, I suppose we should construct a matrix of what locking user password does in different systems, that might help creating the right abstraction.    that might just be useful docs to go along with the lock_passwd: setting ;  could even be sufficient to leave lock_passwd as is and explain the differing behaviors.  15:06
rharperis there something tunable for BSD that we'd want separately as a new key? 15:06
minimalrharper: as I mentioned above FreeBSD's "pw" manpage indicates locking prevents all forms of login auth15:06
rharperand there's some other way to disable password login but not disabling account on FreeBSD ? 15:07
minimalmy own "problem" is that Alpine's sshd by default does not have PAM functionality compiled in and so "lock_passwd: true" also blocks SSH key-based access15:07
minimalso to date my "workaround" has been to install the alternative Alpine sshd that *does* have PAM compiled in (so increasing size of disk image)15:08
rharperyeah -- and I suppose other Non-PAM systems linux or BSD would have that issue. 15:08
rharperand non-pam sshd can't do it's own ssh key auth ? 15:09
minimalrharper: yes on FreeBSD you can set the password to just "*" to prevent password-only access, but then you can't later unlock the password as obviously there is no password to restore15:09
minimalI assume that Alpine is one of the few Linux distros to have a non-PAM sshd so that's why no-one else sees the issue15:09
minimalas for BSD, I don't know, the code for OpenSSH on BSD is not 100% the same as for non-BSD (the "portable OpenSSH" they ship)15:10
rharperok15:11
minimalrharper: basically there's a couple of lines in "portable OpenSSH" source code that say something like:15:11
minimalif account password is locked; then if pam != enabled then; error "Account is locked for SSH access"; fi; fi15:12
rharperwell, so even if we changed the key name, the net is if you set it, no account login for you 15:14
rharperso it _seems_ to me, enough to mention this in docs, if you have non-PAM sshd or BSD ssh and no PAM, this will prevent account access. 15:15
minimalin summary: on both Linux & BSDs method of locking passwords comes with a reprocial method to unlock (reinstate) passwords, how on some systems doing a lock doesn't have the desired (block only password access) effect15:15
minimals/how/so/15:15
minimalrharper: I guess it is about intentions: if I use cloud-init with both various Linux distros and FreeBSD and make use of "lock_passwd: true" I expect the end result to be the same - the account(s) has password access, but not SSH key, access disabled15:16
rharperbut we literally cannot make them the same unless the OSes all have PAM 15:17
rharperunless I'm missing something15:17
rharpersystems with pam will still want a way to say, no using passwords, ssh keys only; 15:17
blackboxsw> undigging from previous IRC thread.... From the previous conversation it sounds like there there is not an option on Alpine to lock only paswd due to missing PAM? Is there no alternative to lock only the passwd on Alpine?15:18
rharpersystems without pam cannot do that IFAICT 15:18
rharperblackboxsw: UUIC, you can still lock the password (put ! at the start) but sshd built-in to the image does not enable PAM, so no way to auth ssh keys to login 15:18
rharperminimal has been using an alternative sshd (larger than the default) which as PAM, but wanted to not carry larger sshd in the image 15:19
minimalrharper: the PAM "thing" is I think a non-BSD issue15:21
blackboxswhrm docs should call that out reasonably. PAM-compiled SSH has support for ssh key based auth and we don't want to lose that if we can avoid it. Can cloud-init query whether PAM is enabled in the ssh on the system? if that's easy we could also warn in logs (limited usefulness anyway because nobody can get into the system at that point w/ an ssh key).15:21
minimalthe same issue would appear on Ubuntu if the sshd_config had "UsePAM no" (from memory)15:22
minimalblackboxsw: in the case of Alpine the openssh-server's sshd is *NOT COMPLIED* with PAM, so "UsePAM" has no effect15:22
blackboxswdocs are needed to call this out both in the ssh lock_passwd example and the module in general. 15:23
blackboxswminimal: so ideally what is it you'd want to see on Alpine with a openssh-server that doesn't have PAM support compiled in?15:23
blackboxswI'm keying off of Ryan's "systems with pam will still want a way to say, no using passwords, ssh keys only; "15:24
minimalwell first you'd have to indicate which the general cloud-init functionality is supposed to be, is it meant to be "lock passwords" or "disable password logins"? ;-)15:25
minimalas the 2 things are not necessarily the same15:25
minimalthe 1st thing is what the setting in c-i is called, the 2nd is the description for the setting15:26
minimalconfused?15:32
blackboxswjust going through the git commit history of the original intent of the lock_passwd key from cloud-init perspective15:33
blackboxswand comparing against the docs we have related to it as well.15:33
blackboxswyeah generally I'd  say our lock_passwd should mean/imply  'disable paswword logins'  though I do see some comments float by about disabling the account as a whole.  Was just doing some bug archeology to see if the original intent was expressed 15:34
minimalI expect the vast majority of people using "lock_passwd: true" expect it to prevent password logins but let key logins still function15:35
blackboxswas something different than 'disable password login'15:35
blackboxswagreed. on your comment. 15:35
minimalso then it would make sense to rename the setting to "disable_password" or similar15:36
minimalthen I could modify alpine.py to NOT lock the password but rather replace it with "*" or "!" (forget the difference in meaning) but then "disable_password: false" (or current "lock_passwd: true") would not work on Alpine to restore the previous password15:38
minimallikewise on FreeBSD meena could then have freebsd.py change the password to "*" for similar functionality (and with similar limitation)15:39
minimaland then secondary point would be whether to add a new setting to control completely disabling an account (for password and key access)15:39
minimaloops s/lock_passwd: true/lock_passwd: false/15:40
blackboxswthe rename is a bit more of a lift given the support/migration deprecation path. I'm wondeirng about the possibility of just adding the `disable_password` key and having BSD/Alpine leverage that with known expected behavior, Linux w/ PAM-support in openssh would still retain passswd login disabled and SSH key support on either lock_passwd or disabled_password.15:54
blackboxswand we add example docs, module docs and schema docs referencing the preference for `disable_pasword` on non-PAM openssh environments.15:56
minimalwell by rename I meant adding the new setting but keeping lock_passwd for some time in line with deprication policy15:56
blackboxswI think that makes sense and probably should be floated to cloud-init mailinglist to float the proposal asynch and allow other perspectives to come in on that.15:57
minimalI'd say "referencing the prefernce for `disable_password` over `lock_passwd` in *all* cases" as it is then clear to the cloud-init user what the intended behaviour is15:58
blackboxswand to double check here, the proposal would be for openssh with PAM-support, that those systems would continue to use `passwd -l` or some such which disables the password authentication, but leaves SSH key-based access permitted.16:02
minimalon Linux yes (should the cc_ssh.py code check for "EnablePAM" setting and its value in sshd_config?)16:03
minimalon FreeBSD then meena would have to use alternative functionality as "pw lock" prevents SSH key-based access also16:04
blackboxswminimal: what would cloud-init do differently if it sees a deactivated EnablePAM setting? I think it could warn that the account is fully disabled in this case and still attempt to `passwd -l`16:09
minimalGood question. It should warn that account will not be accessible (on console? as if you do this for the "default" you won't be able to SSH in to check the logs lol)16:11
blackboxswI'm trying to think through the use-case: If you don't have PAM enabled and you are locking the passwd of the user, you are creating some shell user/bot account for running services on the VM that you don't expect to login and you have an alternate admin/primary user that actually has access to the system maybe.16:13
blackboxswI think WARNINGs should be spit out to console, so serial console access would see that true. And yes you wouldn't be able to access the system w/ that use ras it's fully locked16:14
minimalwell the person who decided to not have PAM enabled ("disk image creator") is not necessarily the same person supplying the user-data ("end user")16:14
minimalso "end user" may intend the "default" account to only be accessible via SSH using key and so decides to set "disable_password: true")16:15
blackboxswI'd agree, but educating them with a warning log telling them that the user is now inaccessible via ssh due to lock_passwd plus lack of PAM support in openssh would give enough of a breadcrumb that they can either opt to avoid using lock_passwd|disable_password, or opt to work with an image that has PAM16:15
minimalnot realising the disk image comes with sshd PAM disabled and then the "end user" can't understand why they can't SSH into their newly created VM/Cloud instance...16:16
minimalwith a warning on console, yes - in log alone is not useful if they can't SSH into to see it16:17
blackboxswyes on WARN that needs to make it to console16:17
minimalyes as e.g. some of the older AWS instance don't have a "usable" console (there's only a way to view console output) so now way to log in via there16:18
blackboxswminimal: are you aware is there any config artifact that can be queries to determine whether the openssh library has PAM support compiled in or not? I'm wondering if there are simple ways to determine whether a given pkg on Alpine would show whether PAM support is possible. Just looking through config modules to see if UsePAM = true|false doesn't really tell us for certain if the underlying libs actually honor those values16:23
minimalfrom memory if there is a "UsePAM" of *any* sort present in sshd_config then a sshd compiled without PAM support will object and fail to start16:25
blackboxswbut, my quesiton is if I'm on a system that has no UsePAM key (active or commented out) in /etc/ssh/sshd_config how do I know if that version of openssh supports PAM? Given that you mentioned you've installed an openssh-server w/ PAM support as a workaround, how does cloud-init know for certain on Alpine that the version of SSH we are interacting with is not capable of PAM and therefore we can't rely on `passwd -l` behavior?16:28
minimalyeah I just checked the "sshd" options and there's none to show programs compile info16:29
blackboxswI ask that question with the underlying thought, **if** we are on Alpine and the openssh-server supports PAM, wouldn't we want behavior of disable_password to be equivalent to what we do on Linux ?16:29
minimalon Alpine the difference can be detected by the package name "openssh-server" vs "openssh-server-pam"16:30
blackboxswyeah I was looking at deb pkg dependencies, knowing that it pulls in libpam-modules is a pretty good indicator16:30
blackboxswheh. well that's a good indicator too16:30
blackboxswor the fact that that pkg delivers /etc/pam.d/sshd16:32
meenaThere's no package on FreeBSD :P16:33
meenait's just there16:33
meena(until I can have my way)16:33
blackboxsw<<magic>>> :) 16:33
meenablackboxsw: nah, the base system is just setup by copying base.tgz onto a disk 16:33
meenabut there's been a project underway since at least 2012 to break up the base system into packages so you don't have to recompile the whole thing just because you hate sendmail and don't want it anywhere near your system16:34
minimalor the binary name: /usr/sbin/sshd vs /usr/sbin/sshd.pam16:34
meenawhy are integration tests failing https://github.com/canonical/cloud-init/pull/4114 ?16:35
-ubottu:#cloud-init- Pull 4114 in canonical/cloud-init "FreeBSD: Fix user account locking" [Open]16:35
blackboxswmeena: does the base filesystem also carry an etc/pam.d/sshd config artifact?16:35
meenablackboxsw: yes16:35
blackboxswminimal: is it possible to open a GH issue suggesting that behavior of lock_passwd on BSD/Alpine16:36
blackboxswminimal: is it possible to open a GH issue suggesting that behavior of lock_passwd on BSD/Alpine/Linux is clear nor uniform on each distro and propose an alternative. We can then float that broadly for comment?16:36
minimalsure16:37
meena👍 cc goneri16:37
blackboxswthanks! I think the proposed path makes sense w/ deprectation of old keys and plan for more strict behavior related to the intent of the config key. Just want a bit of time to marinate on it and discuss async16:38
meenaanyway, this: https://github.com/canonical/cloud-init/blob/main/cloudinit/config/cc_rsyslog.py#L70-L81 is absolutely horrific.16:39
meenait's from 2011, so maybe that's somewhat understandable, but still16:40
minimalyou're welcome. The past few days seem to be the time for complex/complicated discussions lol. Just been though a whole one about Alpine's opendoas specific "extension" functionality that upstream opendoas now don't seem to want - so that's likely to result in my modifying my Alpine-specific cloud-init doas module and upstreaming it in the near future16:40
meenaI think we should refactor cc_rsyslog to be a bit like cc_ntp16:47
meenaThe current redirecting keys mess is… a mess.16:47
blackboxswmeena: I'm rerunning the failed pkging job, not hitting archives for some reason was the prob16:55
blackboxswon your PR16:55
meenablackboxsw: thank you 17:13
meenasame here https://github.com/canonical/cloud-init/actions/runs/4994414479/jobs/8944941998?pr=411517:14
meenait's there a way to (bulk) assign all (Free)BSD issues to me?18:14
meenahttps://github.com/canonical/cloud-init/issues?q=is%3Aissue+is%3Aopen+%28FreeBSD+OR+OpenBSD+OR+NetBSD+OR+BSD+OR+Dragonfly%2918:16
blackboxswmeena: we can do that, though processwise I don't know if we preferred only assigning issues as an indication that they were being actively worked (as a signal that the issue may be resolved shortly)... falcojr holmanb did we chat about defining the policies for issue ownership?18:18
blackboxswas an alterative I could also see distro labels being potentially valuable for ease of issue search alpine, redhat, suse, bsd, debian, but maybe we'd back ourselves into the 'too many labels'  camp18:21
meena👍18:21
meenago uses https://github.com/golang/go/labels/OS-FreeBSD18:22
meenabut i think in our case we can just do distro-BaseDistro if it's something affecting or relating only to a specific thing18:23
blackboxswsame w/ cpython https://github.com/python/cpython/labels/OS-freebsd18:26
meenahttps://github.com/rust-lang/rust/labels/O-freebsd18:26
meenaetc18:26
blackboxswI think labels may be the easiest way to go for distro-specific classes of issues. I'd +1 os-<distro> as a convention.... but leave that to others who may have strong opinions on this.18:27
meenacan't wait until rust drops Compat for FreeBSD 10…18:27
meenaI realise why they use os or even O: it's shorter than distro18:28
falcojrI'm fine with a label convention. In general, we're wary of assigning issues unless they're actively being worked on...just in case somebody else might like to pick it up in the mean time18:34
meenaaye18:39
meenaI just can't self assign, is all. 18:40
falcojris adding a comment good enough? We can always assign you based on that18:41
meena👍18:41

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