Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement manual initiation of noble migration #7416

Open
legoktm opened this issue Jan 16, 2025 · 3 comments · May be fixed by #7427
Open

Implement manual initiation of noble migration #7416

legoktm opened this issue Jan 16, 2025 · 3 comments · May be fixed by #7427
Assignees
Labels
noble Ubuntu Noble related work

Comments

@legoktm
Copy link
Member

legoktm commented Jan 16, 2025

There should be some kind of script on the admin workstation that triggers starting the noble migration on the app and then mon servers.

@legoktm legoktm added the noble Ubuntu Noble related work label Jan 16, 2025
@legoktm legoktm moved this to Ready to go in SecureDrop dev cycle Jan 16, 2025
@legoktm legoktm added this to the SecureDrop 2.12.0 milestone Jan 21, 2025
@legoktm
Copy link
Member Author

legoktm commented Jan 23, 2025

The manual workflow should look something like:

  1. Log into app and mon, check /etc/securedrop-noble-migration.json and make sure it's all positive.
  2. Disable OSSEC alerts on mon: let new = current.replace("<email_alert_level>7</email_alert_level>", "<email_alert_level>15</email_alert_level>"); or something. Then systemctl restart ossec
  3. Edit /usr/share/securedrop/noble-upgrade.json on app to set app.enabled = true and app.bucket = 5.
  4. systemctl start securedrop-noble-migration-upgrade on app
  5. Wait. The server will reboot twice in the meantime. Depending on internet and hardware speed this can take 5-20 minutes.
  6. After the second reboot, keep waiting until /etc/securedrop-noble-migration-state.json contains {"finished": "Done"}.
  7. Edit /usr/share/securedrop/noble-upgrade.json on mon to set mon.enabled = true and mon.bucket = 5.
  8. systemctl start securedrop-noble-migration-upgrade on mon
  9. Wait for the server to reboot twice
  10. After the second reboot, keep waiting until /etc/securedrop-noble-migration-state.json contains {"finished": "Done"}.
  11. Re-enable OSSEC alerts on mon.

@legoktm
Copy link
Member Author

legoktm commented Jan 24, 2025

I'm going to start working on the playbook for this and see how far I get.

@legoktm
Copy link
Member Author

legoktm commented Jan 24, 2025

I successfully got the playbook to migrate a mon server, work is in the stg-noble-playbook branch.

I'll plumb it into ./securedrop-admin on Monday.

legoktm added a commit that referenced this issue Jan 27, 2025
legoktm added a commit that referenced this issue Jan 27, 2025
Admins can run `./securedrop-admin noble_migration` to trigger a manual
noble migration.

At a high level the playbook:
* disables OSSEC notifications
* triggers the app upgrade, waiting through two reboots
* triggers the mon upgrade, again waiting through reboots
* re-enables OSSEC notifications

The most complicated part is how we for the reboots. We first have a
`wait_for` that looks for a specific stage in the state file. Because
the upgrade script writes the state file and then immediately reboots,
it should never actually succeed and fail because the connection is
interrupted. So we set `ignore_unreachable` and `ignore_errors`, and the
next block is `wait_for_connection` for the server to come back up.
There is a delay before we begin checking just in case the wait_for did
succeed and we need to wait for the reboot to happen.

Because of this sequencing, there isn't any support for the playbook
failing mid-host and restarting it. It is probably unnecessary since,
once started, the upgrade will automatically finish by itself.

The script does support one host already being upgraded and the other
still needing migration. So if e.g. app migration fails, you can
manually fix the host, let it auto finish the upgrade, and then re-run
the playbook to migrate mon.

Fixes #7416.
@legoktm legoktm linked a pull request Jan 27, 2025 that will close this issue
5 tasks
legoktm added a commit that referenced this issue Jan 27, 2025
Admins can run `./securedrop-admin noble_migration` to trigger a manual
noble migration.

At a high level the playbook:
* disables OSSEC notifications
* triggers the app upgrade, waiting through two reboots
* triggers the mon upgrade, again waiting through reboots
* re-enables OSSEC notifications

The most complicated part is how we for the reboots. We first have a
`wait_for` that looks for a specific stage in the state file. Because
the upgrade script writes the state file and then immediately reboots,
it should never actually succeed and fail because the connection is
interrupted. So we set `ignore_unreachable` and `ignore_errors`, and the
next block is `wait_for_connection` for the server to come back up.
There is a delay before we begin checking just in case the wait_for did
succeed and we need to wait for the reboot to happen.

Because of this sequencing, there isn't any support for the playbook
failing mid-host and restarting it. It is probably unnecessary since,
once started, the upgrade will automatically finish by itself.

The script does support one host already being upgraded and the other
still needing migration. So if e.g. app migration fails, you can
manually fix the host, let it auto finish the upgrade, and then re-run
the playbook to migrate mon.

Fixes #7416.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
noble Ubuntu Noble related work
Projects
Status: Ready to go
Development

Successfully merging a pull request may close this issue.

2 participants