provide a history of changes with revert function

Discussion in 'Feature Requests' started by, May 27, 2024.

  1. Well-Known Member HowtoForge Supporter

    a lot of issues occur after something changed, duh.
    The ISPConfig cronjob should know well when databases or config changes.
    For database changes we have the log what changed, this is good.

    It should be possible to add a "revert to previous settings".

    At the very least, the cron could add a local git repo with relevant config files
    to allow for easier debugging and reverting?!
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    This exist already. Everything that ISPConfig changes is in the datalog history and you can undo these changes using ISPConfig GUI. See Monitor > datalog History. There is an undo button for every change ISPconfig is doing. It also shows exactly what has been changed.
    michelangelo likes this.
  3. Well-Known Member HowtoForge Supporter

    I know of the datalog, but that includes the database changes only.
    If the cron would regulary update the git contents with the actual config files /etc/apache2 /etc/postfix, or just /etc --exclude letsencrpyt shadow etc
    it would help in many cases, even if a user has modified a file by themselves or unattended upgrades...
    this could be time matched against the datalog and help understanding what went wrong
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Ok, so basically, you want to convert /etc. into a GIT repo and do a commit after each run of the script where at least one datalog entry has been processed. This is most likely only useful for manual changes that one has made outside of ISPConfig and not for things ISPConfig has changed, as you would have to review and undo ISPConfig changes using Monitor > datalog History anyway.
  5. Well-Known Member HowtoForge Supporter

    exactly, of course not entire etc as mentioned above, some things should not be there.
    but basically something like this
    /usr/bin/git add -A
    /usr/bin/git commit -a -m "auto commit `date`"
    /usr/bin/git push origin master
    it can be a helpful feature / resource to use when dealing with customizations or old systems, or people trying suggestions
    and do not know how to revert anymore whatever you can imagine.
    First it would be standalone, just is there and can be used / requested / reviewed
    Then one _could_ match it against settings on the datalog _if_ there is a relation or it did what it promised.

    It's a backup feature kind of too, also against unattended upgrade package overwriting some defaults file and changed behaviour of things
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    While this might be nice for debugging indeed, people might use git commands then to restore files managed by ISPConfig, which would be a bad idea as the config becomes inconsistent between ISPConfig and the file system. The forum will get filled with complaints that file versions containing an error get restored by ISPConfig as the users missed using the undo function in Datalog but used git to revert things. So, this is a two-sided sword, which might cause more issues.
  7. Well-Known Member HowtoForge Supporter

    it is indeed. but forward reverting the config files to the last datalog point should be possible to do it the right way.
    could be hidden as debug feature too, as long it is there somewhere and used only as instructed.
    On the other hand some threads here can get very long figureing out things where a simple lookup of the
    file-log might solve the issue quickly and get the system running.

    sure, might need some considerations on how and if to implement.

    But having a history is better than having nothing for average user?

    it would also show if a repository got disabled, has not updated codename ah all sorts of things, well /etc

    ah and exclude /etc/mysql/debian.cnf on systems where password= is put in still
    Last edited: May 27, 2024
  8. michelangelo

    michelangelo Active Member

    I think the Datalog-History is sufficient for most ISPConfig related cases.

    If /etc is supposed to get revisioned I would suggest using etckeeper. There is also a plugin for the package manager, so if one updates the packages on the system, the plugin will force execute a commit after the packages have been updated.

    On the other hand I could think of a hook system for the datalog like it is done for backup software, like before and after something was processed and it will execute a shell file.

    Personally I don't need such a feature and I think that it has also potential to be harmful.
 likes this.
  9. till

    till Super Moderator Staff Member ISPConfig Developer

    Passwords are also in many other config files, e.g., postfix, dovecot, pure-ftpd, amavis, rspamd, and Redis. If you exclude them all, then only a small fraction of config files are left. If the user has a regular system backup, as any server should have, then he can get older versions of config files from that.
  10. Well-Known Member HowtoForge Supporter

    yes, valid reasons and a quick thought posted after some of the latest threads.
    maybe the ispconfig passwords are not too harmful in there, they're on the filesystem anyway
    and the git should be used in rare cases and may not need to be exposed too much on the UI.

    Also one can cleanup old data and thereby remove old things.
    Also thought git is a more common process and software available and more basic thus less error prone and dependency,
    etckeeper looks nice, I love etcd though ;)

    sure, "should" but facing reality, most people do the howto and nowhere it is mentioned.
    Well, at least among many seeking for help.
    Modern systems have those kind of features, either to be used or hidden and automated.

    But that's just my thoughts right now :)
  11. Well-Known Member HowtoForge Supporter

    summary so far, thx gpt =)

    Certainly! Let's explore the pros and cons of integrating a version control system for configuration files in an ISPConfig-managed server environment, along with some alternative ideas to address the underlying issues.

    ### Pros and Cons

    #### Pros
    1. **Enhanced Debugging and Troubleshooting:**
    - **Pro:** Having a version control system like Git or etckeeper can make it easier to identify and revert changes, simplifying the debugging process.
    - **Con:** Users might rely on the version control system instead of understanding the root cause of issues, potentially leading to repeated mistakes.

    2. **Improved Configuration Management:**
    - **Pro:** Automating the version control of configuration files ensures that all changes are tracked, providing a detailed history that can be useful for audits and rollbacks.
    - **Con:** This can lead to a false sense of security if not properly managed, especially if sensitive information is not correctly excluded.

    3. **Facilitates Compliance and Auditing:**
    - **Pro:** Version control helps in maintaining a clear record of changes, which is beneficial for compliance with various standards and regulations.
    - **Con:** Managing and securing the version control system itself adds another layer of complexity and potential vulnerabilities.

    #### Cons
    1. **Increased Complexity:**
    - **Pro:** Advanced users might benefit from the additional functionality and control provided by version control.
    - **Con:** For less experienced users, the added complexity can be overwhelming and lead to misuse or neglect of the feature.

    2. **Potential for Inconsistencies:**
    - **Pro:** When used correctly, it ensures consistency and a reliable rollback mechanism.
    - **Con:** Users might bypass ISPConfig’s built-in functions, causing inconsistencies between the system's state and what ISPConfig expects.

    3. **Security Risks:**
    - **Pro:** Proper configuration can mitigate risks, and the benefits of version control might outweigh potential downsides.
    - **Con:** Sensitive information might accidentally get committed to the repository, exposing passwords and other confidential data.

    ### Alternative Solutions

    1. **Etckeeper Integration:**
    - **Description:** Use etckeeper, which integrates with package managers and commits changes to `/etc` automatically. It's designed for this purpose and is less likely to introduce inconsistencies.
    - **Pros:** Seamless integration with package managers, automated commits, designed for tracking `/etc`.
    - **Cons:** Still requires careful exclusion of sensitive files, adds a layer of dependency.

    2. **Enhanced Logging with Hooks:**
    - **Description:** Implement hooks in ISPConfig’s datalog that trigger scripts before and after changes. These scripts can log file states or even back up relevant files.
    - **Pros:** Provides flexibility, minimal intrusion, and can be customized.
    - **Cons:** Requires scripting knowledge, potential performance impact if not optimized.

    3. **Backup and Snapshot Solutions:**
    - **Description:** Use existing backup solutions to create regular snapshots of the `/etc` directory and other critical configuration files.
    - **Pros:** Established backup solutions are reliable and can be automated.
    - **Cons:** Restoration might be less granular than version control, more suited for full recovery rather than specific changes.

    4. **ISPConfig Configuration History:**
    - **Description:** Extend ISPConfig’s existing datalog to include file-level changes by integrating a lightweight file monitoring service.
    - **Pros:** Keeps all change tracking within ISPConfig, avoiding the need for external tools.
    - **Cons:** Development effort required, potential for increased resource usage.

    5. **User Education and Best Practices:**
    - **Description:** Enhance documentation and provide training on best practices for configuration management and backup.
    - **Pros:** Empowers users to manage their systems more effectively, reducing dependency on automated tools.
    - **Cons:** Requires ongoing effort to educate and support users.

    ### Conclusion

    Implementing a version control system for configuration files in an ISPConfig environment can provide significant benefits, particularly for debugging and rollback purposes. However, it also introduces complexity and potential security risks. Alternative solutions like etckeeper, enhanced logging, and traditional backups can offer similar benefits with varying levels of complexity and integration effort.

    Ultimately, the choice depends on balancing ease of use, security, and the technical proficiency of the user base. A phased approach, starting with optional features and thorough documentation, can help mitigate risks while providing valuable tools for those who need them.
  12. till

    till Super Moderator Staff Member ISPConfig Developer

    The ISPConfig installation instructions can not replace basic knowledge about running a server or desktop. But yes, I might add a chapter at the end on what people should also do next.

    I guess putting /etc in git will not change that; it might help us debug things in some cases, though. But it will also add another level of failures where people restore a config using Git because it's easy, and it must work that way in their option as such a feature won't exist if it does not work ... right? However, they will not understand that they are messing up the system, so the info in ISPConfig and the file system becomes inconsistent.

    Now we are back at post #2, because ISPConfig has such an automated undo feature in the GUI.
  13. Well-Known Member HowtoForge Supporter

    I know you are thinking "ispconfig can regenerate the files out of config" but just think the rcent posts where the user simply
    was unable to login, would you prefer instructing him to make database changes and rely on the user what he think he changed? or the system internals did or whatever, see above

    could not agree more. But reality is... have you ever been in a forum for ovh/hetzner or alike? reality is many people simply do not think about until they post "help I lost all data due to rm -r" ... or "help I got hacked" or "i got a netwokr abuse complaint" and so on
    Last edited: May 27, 2024
  14. till

    till Super Moderator Staff Member ISPConfig Developer

    Indeed, the first step is always to get ISPConfig access again. But the good thing is that you do not need database changes for that as the config for the GUI is not generated from database. And in almost all cases, you can fix GUI problems by running an ISPConfig update on the shell and letting it rewrite the config. Yes, I'm aware of the recent case where this did not work, but that's a really rare case, and as users can manually change so many things in their systems, you can never have an easy solution for all possible scenarios. So yes, having /etc in GIT might have helped there a lot, but one must also take the possible downsides of such a solution into account when considering to implement it.

    I'm aware of that. People also tend not to read system requirements, even if it's the first chapter of the install guide, or check if software can even run on a specific OS or version before updating the OS. So in the end, it will make no difference if we add something like that to the guides as users won't read it. But nonetheless I'll add a few bullet points at the end, maybe there are at least some users that read it.
  15. till

    till Super Moderator Staff Member ISPConfig Developer

  16. Well-Known Member HowtoForge Supporter

    glad to have at least exchanged thoughts about it. what and if results out of it is another story indeed.
    gpt made a good summary imho.
    cli tool is a must, I agree.

    Though looking at the code makes me run away, but that's a topic for a different thread plus we had this already, we have different philosophys and let's leave it at that ^^
  17. till

    till Super Moderator Staff Member ISPConfig Developer

    That's perfectly fine, though :)

    Yes, we had that topic and know we will not agree.
    ahrasis and like this.

Share This Page