Skip to content

ENT-13005: Added integrity check to cf-remote remote installation#174

Merged
victormlg merged 1 commit intocfengine:masterfrom
victormlg:improved-remote-download
Mar 25, 2026
Merged

ENT-13005: Added integrity check to cf-remote remote installation#174
victormlg merged 1 commit intocfengine:masterfrom
victormlg:improved-remote-download

Conversation

@victormlg
Copy link
Copy Markdown
Contributor

No description provided.

@victormlg victormlg force-pushed the improved-remote-download branch from 6c48260 to f43babf Compare February 24, 2026 16:06
@victormlg victormlg requested a review from larsewi March 2, 2026 08:51
@victormlg victormlg force-pushed the improved-remote-download branch from f43babf to c52900a Compare March 2, 2026 13:12
@victormlg victormlg requested a review from larsewi March 2, 2026 13:14
Copy link
Copy Markdown
Contributor

@larsewi larsewi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remember to test the script 😉

@victormlg victormlg force-pushed the improved-remote-download branch from c52900a to b680be0 Compare March 3, 2026 11:44
@victormlg victormlg requested a review from larsewi March 3, 2026 11:49
Copy link
Copy Markdown
Contributor

@larsewi larsewi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of these checks can be done before you actually download the file. Maybe do these checks first, and then download.

@victormlg victormlg force-pushed the improved-remote-download branch from b680be0 to 8cb770f Compare March 3, 2026 14:15
@victormlg victormlg requested a review from larsewi March 3, 2026 15:24
Copy link
Copy Markdown
Member

@olehermanse olehermanse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please expand nt-discovery.sh and then do the error checking as early as possible (as fast as possible). This way you can detect errors right after running nt-discovery.sh, without having to transfer over another script.

@victormlg victormlg force-pushed the improved-remote-download branch 2 times, most recently from 3e755d9 to ea263af Compare March 9, 2026 10:07
@victormlg victormlg requested a review from olehermanse March 9, 2026 10:25
@victormlg victormlg force-pushed the improved-remote-download branch from ea263af to ca9da21 Compare March 9, 2026 10:30

print("Downloading '%s' on '%s' using curl" % (package, host))
r = ssh_cmd(
cmd="curl --fail -O {}".format(package), connection=connection, errors=True
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code preferred curl. Why is wget preferred now?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that's right, the ticket says;

Download with wget if that is available and curl is not

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the initial PR I made it used curl as the default, but then changed it to wget after correction. What I mean that I changed it because it should be like it is now

@victormlg victormlg force-pushed the improved-remote-download branch 2 times, most recently from 63c24f3 to 5737c1f Compare March 16, 2026 07:59
@victormlg victormlg requested a review from larsewi March 16, 2026 08:13
@victormlg victormlg force-pushed the improved-remote-download branch from 5737c1f to 4296c22 Compare March 16, 2026 13:18
@victormlg victormlg requested a review from larsewi March 16, 2026 13:26
Copy link
Copy Markdown
Contributor

@larsewi larsewi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using shlex.quote() on the passed arguments when building the shell commands in cf-remote. You could argue that if you can connect to a remote machine as root, then shell injection is not really a problem. But still it's good hygiene.

@victormlg
Copy link
Copy Markdown
Contributor Author

Consider using shlex.quote() on the passed arguments when building the shell commands in cf-remote. You could argue that if you can connect to a remote machine as root, then shell injection is not really a problem. But still it's good hygiene.

The commands are already manually escaped inside ssh_cmd and ssh_sudo. So adding one more layer of quoting with shlex breaks the remote command. I think it would make sense to add this in a separate PR, and handle everything in the ssh functions.

Ticket: ENT-13005
Signed-off-by: Victor Moene <victor.moene@northern.tech>
@victormlg victormlg force-pushed the improved-remote-download branch from 4296c22 to 53ede36 Compare March 25, 2026 09:56
Copy link
Copy Markdown
Contributor

@larsewi larsewi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 🚀

@victormlg victormlg merged commit 6b6a0c9 into cfengine:master Mar 25, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants