Skip to content
This repository has been archived by the owner on Sep 16, 2022. It is now read-only.

Implement functinality to patch system based on recommended actions #257

Open
vpetersson opened this issue Jan 10, 2020 · 5 comments
Open
Labels
story-points-20 20 Story Points

Comments

@vpetersson
Copy link
Contributor

vpetersson commented Jan 10, 2020

We want to make it easy for users to patch their systems by having a simple one-liner to do this. Unfortunately, this can become somewhat troublesome when you have different configurations across the fleet.

As such, we want to extend the CLI for easier patching of packages.

We want to keep this as dynamic as possible. Hence, we could do something similar to wott-agent patch $ID, where $ID is the issue from the backend. This could either be CVE or a change.

Here's an example of how I envision a run to look like:

Example of patching a service.

$ sudo wott-agent patch 222

The patch will make the following changes to /etc/ssh/sshd_config

-#PasswordAuthentication yes
+PasswordAuthentication no

After the change, we will automatically restart the SSH daemon.

Do you want to apply the changes (Y/n)?
[...]

Example of upgrading packages/patching for CVE.

$ sudo wott-agent patch 223

The following packages will be upgraded as part of CVE-XYZ:

* colordiff
* libgdbm-compat4
* libgdbm5
* libperl5.26
* netbase
* perl
* perl-modules-5.26

Please note that upgrading packages may cause them the service(s) to restart.

Do you want to apply the changes (Y/n)?
[...]

Considerations:

  • We need to make sure this works across distros
  • We need to have a warning dialogue showing what happens before it is being applied
  • After the patch, it needs to run the ping functionality to submit the new state
@vpetersson vpetersson changed the title Implement functinality to upgrade vulnerable packages Implement functinality to patch vulnerable packages Jan 10, 2020
@vpetersson vpetersson changed the title Implement functinality to patch vulnerable packages Implement functinality to patch system based on recommended actions Jan 16, 2020
@vpetersson
Copy link
Contributor Author

vpetersson commented Feb 17, 2020

We want to demo this for an investor, so let's take some shortcuts to get the alpha version of this working. Here are some shortcuts:

  • Instead of making an API call back to the back-end to lookup what an ID means, let's use names (e.g. wott-agent patch openssh-disable-password-auth).
  • Let's limit the scope to the ssh recommended actions.
  • Let's make sure to run a ping at the end of the run.
  • Let's make sure to take a backup of the file prior to the change.

Outstanding tasks for MVP after #263:

  • Add comment on line before
  • Backup config file to /opt/wott/backup
  • Test and restart service using SIGHUP
  • Add warning message for when disabling password auth Warning: Before you disable password authentication, make sure that you have generated and installed your SSH keys on this server. Failure to do so will result in that you will be locked out. I have have my SSH key(s) installed: [y/N]

@vpetersson
Copy link
Contributor Author

MVP is done Sprint 16. We've received great feedback on this. Now we need to revisit the original scope in Sprint 17.

@vpetersson
Copy link
Contributor Author

vpetersson commented Mar 9, 2020

We need to resume work on this. As next steps, I want to do the following:

Next sprint

  • Display the actual diff as per the instructions in the initial ticket.
  • Implement patch for 'Automatic security updates not enabled'
    • AWS Linux
    • Ubuntu

@vpetersson vpetersson added the story-points-unknown Unknown Story Points label Mar 9, 2020
@rptrchv
Copy link
Contributor

rptrchv commented Mar 10, 2020

13 complexity points

@a-martynovich
Copy link
Contributor

20

@vpetersson vpetersson added story-points-20 20 Story Points and removed story-points-unknown Unknown Story Points labels Mar 11, 2020
@a-martynovich a-martynovich removed their assignment Mar 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
story-points-20 20 Story Points
Projects
None yet
Development

No branches or pull requests

3 participants