Wednesday, 2022-09-28

-@gerrit:opendev.org- Zuul merged on behalf of Simon Westphahl: [zuul/zuul] 856523: Add span for builds and propagate via request https://review.opendev.org/c/zuul/zuul/+/85652308:07
-@gerrit:opendev.org- Zuul merged on behalf of Simon Westphahl: [zuul/zuul] 857421: Trace merge requests and merger operations https://review.opendev.org/c/zuul/zuul/+/85742108:11
-@gerrit:opendev.org- Zuul merged on behalf of Tristan Cacqueray: [zuul/zuul] 850575: doc: fix liveness probes path rendering https://review.opendev.org/c/zuul/zuul/+/85057508:47
-@gerrit:opendev.org- Zuul merged on behalf of Clark Boylan: [zuul/zuul-jobs] 858961: Reduce the number of loops in prepare-workspace-git https://review.opendev.org/c/zuul/zuul-jobs/+/85896115:34
-@gerrit:opendev.org- Tristan Cacqueray proposed: [zuul/zuul] 859711: Add executor.ssh_args configuration https://review.opendev.org/c/zuul/zuul/+/85971119:25
@tristanc_:matrix.orgI'm not sure how to proceed, but we need to set `-o Ciphers=aes256-ctr` on the ssh command to access a FIPS enabled host. Thus I've proposed 859711 ^, but perhaps there is another way?19:30
@clarkb:matrix.org> <@tristanc_:matrix.org> I'm not sure how to proceed, but we need to set `-o Ciphers=aes256-ctr` on the ssh command to access a FIPS enabled host. Thus I've proposed 859711 ^, but perhaps there is another way?19:34
OpenDev's zuul is able to ssh to fips enabled test nodes from the debian bullseye based zuul container images without trouble. A bit more info on why this is necessary would be helpful.
-@gerrit:opendev.org- Zuul merged on behalf of Simon Westphahl:19:38
- [zuul/zuul] 858096: Trace node request phase https://review.opendev.org/c/zuul/zuul/+/858096
- [zuul/zuul] 858372: Create link to previous buildset span https://review.opendev.org/c/zuul/zuul/+/858372
@tristanc_:matrix.orgClark: I don't have much more info, beside that this option is required on our deployment, running ubi8 container on a centos7 host.19:38
@clarkb:matrix.orgI think before we had a whole new mechanism to configure ssh we should understand this better. Running ssh -vvv from your container to a fips sshd should show which ciphers both ends support and where the mismatch is. I'm surprised ubi8 ssh can't ssh to a fips host though19:41
@clarkb:matrix.orgLooks like fips 140-2 requires aes128-ctr or aes192-ctr or aes256-ctr. I guess this means your client isn't offering one of those by default. Maybe a better approach is to modify the client config to allow those ciphers and then let ssh negotiate them rather than hard coding? In particular it is my understanding that clients and servers should negotiate the best mutual option and keeping that available for non fips hosts is probably ideal19:48
@tristanc_:matrix.orgClark: but how can we modify the ssh client config for the executor?19:51
@clarkb:matrix.orgI think you just configure it via /etc/ssh or /home/zuul/.ssh ?19:51
@clarkb:matrix.orgIt is using openssh19:51
@clarkb:matrix.orgI'm really curious to know what cipher list you have configured if it doesn't include aes256-ctr19:52
@tristanc_:matrix.orgClark: I meant these paths are not mounted in bubblewrap, so you mean by adding them to the ro_path list ?19:58
@clarkb:matrix.orgOh if we don't mount an ssh config are we just using compiled defaults then?19:59
@clarkb:matrix.orgIn that case I'm really surprised you don't have aes256-ctr20:00
@tristanc_:matrix.orgClark: i'm waiting for another reproducer, but it looked like the connection was dropped because the client was offering deprecated ciphers20:02
@clarkb:matrix.orgright, this is why I'm saying we need to be cautious. It seems like there may be a problem with your openssh installation and working around it with zuul here may just cover up that problem. We should understand this and if the client is deficient fix the client20:03
@clarkb:matrix.orgrunning ssh -vvv in your container within the zuul bwrap environment (zuul has a command to get one of those iirc) will probably show you what the client is offering. ssh -Q cipher will show you what the client supports20:05
@tristanc_:matrix.orgClark: thank you for the pointer, i'll keep on debugging20:07
@clarkb:matrix.orgIf I install openssh-clients in redhat/ubi8 and execute `ssh -Q cipher` it reports aes256-ctr20:07
@clarkb:matrix.orgThe red hat openssh config seems to use this Ciphers list: `Ciphers aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes256-ctr,aes256-cbc,aes128-gcm@openssh.com,aes128-ctr,aes128-cbc`20:09
@tristanc_:matrix.orgClark: the other parameter is that the zuul's ssh key is quite ancient, it was created with sha25620:10
@clarkb:matrix.orgtristanC: the key itself shouldn't matter for this aiui20:10
@clarkb:matrix.orgthis is the cipher used to bulk encrypt data after the connection is established20:10
@clarkb:matrix.orgin the ssh -vvv output I think you are looking for the lines like `ciphers ctos` and `ciphers stoc` to show client to server (ctos) and server to client (stoc). Then later `kex: server->client cipher:` and `kex: client->server cipher:` to see what is chosen.20:14
@clarkb:matrix.orgIn your case you may only get the first type of log lines and not the second if negotiation is failing20:14
@tristanc_:matrix.orgwell, I can't reproduce the issue anymore, and perhaps it was not ssh after all, here is the failure we get: `"msg": "Connection closed by 38.102.83.73 port 22\r\nrsync: connection unexpectedly closed (0 bytes received so far) [sender]\nrsync error: unexplained error (code 255) at io.c(226) [sender=3.1.3]\n",`  from: https://review.rdoproject.org/zuul/build/163d0147c214443b860d6c20268702a2/log/job-output.txt#18720:19
@clarkb:matrix.orgtristanC: once sec20:22
@clarkb:matrix.orgtristanC: https://opendev.org/openstack/project-config/commit/a6d4fae07098546f5d61b32e62b7053946064e9a that is what I would look at next20:22
@clarkb:matrix.orgI can't say for sure if you are hitting that problem but the symptoms are similar. Basically openssh sshd has a number of slots that it will start negotiating new connections on and that number is quite low by default. When you get people port scanning you those may all fill up and then valid ssh connections fail. To check on that you can look at your sshd logs (probably in syslog or equivalent) to see if you've got port scanning occuring at the same time as your failures20:23
@clarkb:matrix.orgwe worked around it by increasing the number of new connections20:24
@clarkb:matrix.organd it tends to be temporary as the port scanning roves around the internet20:24
@tristanc_:matrix.orgClark: I see, thank you for the help, it's much appreciated!20:24
@clarkb:matrix.orghttps://matrix.org/blog/2022/09/28/upgrade-now-to-address-encryption-vulns-in-matrix-sdks-and-clients fyi since we're on matrix here20:28
@clarkb:matrix.orgthis room isn't encrypted though so I don't think your use of this room is affected20:29
@tristanc_:matrix.orgClark: alright, so bwrap seems to be the issue, here is the command that fails: https://paste.opendev.org/show/bvhLUSqyiXONVQ3VdUww/  , and adding `-c aes256-ctr` fixes it : https://paste.opendev.org/show/bUNcTSfaZuSZ6rjqTnox/20:42
@tristanc_:matrix.organd bind mounting the ssh_config from the container to the bwrap seems to fix it20:47
@clarkb:matrix.orgtristanC: lines 35-36 and 47-48 are the relevant lines20:47
@clarkb:matrix.orgI think that is showing both the server and client wanting to use chacha20-poly1305@openssh.com and then failing after20:48
@clarkb:matrix.orgif your fips server can't do chacha20-poly1305@openssh.com why is it advertising it. That seems like maybe a fips bug20:48
@clarkb:matrix.orgnote that chacha and the gcm variants provide extra security over the aes ctr variants aiui. So openssh is properly negotiating the more secure method20:50
@clarkb:matrix.orgoverriding to aes256-ctr is going to work because that is what fips wants, but ideally you'd get that to work through properly configured software (in this case I think the server is misconfigured?)20:50
@tristanc_:matrix.orgor perhaps because of that first choice, then it picks `<implicit>` MAC which is the actual issue? I don't know, the server is configured using the standard fips enabling tool, and the issue only happens with zuul jobs20:51
@tristanc_:matrix.orgunfortunately we can't simply mount /etc/ssh and /etc/crypto-policy in bwrap because they get assigned to nobody and ssh is complaining about bad permission20:52
@clarkb:matrix.org> <@tristanc_:matrix.org> or perhaps because of that first choice, then it picks `<implicit>` MAC which is the actual issue? I don't know, the server is configured using the standard fips enabling tool, and the issue only happens with zuul jobs20:53
MAC is implicit because it is built into the chacha cipher. It is not built in with aes256-ctr so there is a separate negotiation for that. The reason it doesn't work for zuul is we don't bind mount an openssh config in and so use compiled defaults. I think your config outside of bwrap is overriding the priority list of ciphers (see my list above it puts aes256-gcm before chacha20) and that must work
@tristanc_:matrix.orgright, thanks. So we'll add that to an extra trusted_ro_paths20:54
@clarkb:matrix.orgwell I still think the correct thing is to fix the remote side if it can't actually do chacha20:54
@clarkb:matrix.orgBoth sides agree they can do aes256-ctr. But the side that is picky (the server fips side) is not prioritizing its ciphers properly20:55
@clarkb:matrix.orgat least that is how I read the log20:56
@jim:acmegating.com(*i don't disagree with clark -- just pointing out that you'd want it for both trusted_ and untrusted_ro_paths if you decide to do that)20:57
@tristanc_:matrix.orgcorvus: unfortunately we can't really change the fips configuration, so we'll mount a custom ssh config to fix the client. Thanks for the tips. For what its worth, here is a fix proposal:  https://softwarefactory-project.io/r/c/software-factory/sf-config/+/26225 21:04
@clarkb:matrix.orgtristanC: well, maybe it indicates a bug in the sshd?21:05
@clarkb:matrix.orgtristanC: let me put it another way: a default openssh client compiled by redhat should be able to ssh to an openssh server compiled by redhat with fips enabled and disabled21:05
@clarkb:matrix.orgThat appears to be broken for you and I would say that constitutes and issue likely in the sshd21:06
@tristanc_:matrix.orgClark: I think the expectation is that the ssh client uses the provided crypto-policies21:06
@clarkb:matrix.orgI can kind of understand that except that the ssh protocol relies heavily on negotiating these items between client and server. If a server cannot support a particular setup then it shouldn't negotiation them.21:08
@clarkb:matrix.orgIn any case I'm glad that existing zuul configuration constructs allow this to be addressed21:09
@clarkb:matrix.orgrunning `zuul-bwrap` out of the zuul published executor image then running ssh in that against a random server I haev at home seems to show it defaulting to chacha20 here too. I'm surprised that opendev's fips jobs all seem fine in that case.21:18
@tristanc_:matrix.orgalternatively, we could always bind mount /etc/ssh and /etc/crypto-policies, but that would require adding the `-o StrictModes=no` to the ssh_args.21:21
@jim:acmegating.comhttps://tracing.opendev.org/trace/73f394c92d9fbe1943178eabfa6da6b1 is working now21:25
@jim:acmegating.comopendev is a few commits behind master, so we only have the queueitem and buildset traces now.21:25

Generated by irclog2html.py 2.17.3 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!