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

[bug] Not all modified files are included in the backup used to restore the last working configuration #206

Closed
okraits opened this issue Apr 11, 2024 · 0 comments · Fixed by #207
Assignees
Labels

Comments

@okraits
Copy link
Member

okraits commented Apr 11, 2024

Currently all files which are also included in the new configuration to be applied are included in the backup which is created before applying the new configuration. There can be situations though when this is not sufficient.

Imagine the following situation:

  1. The network configuration is modified by the agent. Before modifying /etc/config/network, the agent creates a copy in /etc/openwisp/stored/.
  2. Some time later, that change to the network configuration is removed from the device config on the controller. The previous state of /etc/config/network is restored with the help of the copy of the file in /etc/openwisp/stored/.
  3. Unfortunately, the previous state doesn't work anymore, due to a change in the network the device is connected to, or due to a firmware upgrade (for example DSA). The configuration test fails and the backup created before applying that configuration change is used to restore the configuration before the change.
  4. Unfortunately, the file network is not included in the backup because it's not included in the new configuration tarball either.
  5. Restoring the last working configuration failed.

Solution:

Files included in the currently applied configuration (all files currently modified by the agent) need to be included in the backup as well.

An example of how to reproduce the issue:

Preconditions:

  • the device can reach the OpenWISP controller and is registered
  • the wan interface of the device will be configured by OpenWISP
  • the agent uses the following configuration test script:
#!/bin/sh

logger "Trying to reach google.de..."
ping -c 3 google.de

Procedure:

The following configuration is provided by the controller:

{
    "interfaces": [
        {
            "type": "ethernet",
            "name": "wan",
            "network": "wan",
            "addresses": [
                {
                    "proto": "static",
                    "family": "ipv4",
                    "address": "10.2.3.107",
                    "mask": 24,
                    "gateway": "10.2.3.254",
                    "dns": [
                        "10.2.4.12",
                        "10.2.4.13"
                    ]
                }
            ]
        }
    ]
}

The agent downloads and applies the configuration. The configuration test succeeds.

Now the above configuration is removed on the controller.
The agent downloads and applies the configuration. The configuration test fails.
The previous configuration should be restored but the backup doesn't include the network file. Thus the network configuration after the restore is incomplete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

Successfully merging a pull request may close this issue.

1 participant