core
core copied to clipboard
Backup to Google Shared Drive does not follow maximum Backup Count
Important notices
Before you add a new report, we ask you kindly to acknowledge the following:
- [X] I have read the contributing guide lines at https://github.com/opnsense/core/blob/master/CONTRIBUTING.md
- [X] I am convinced that my issue is new after having checked both open and closed issues at https://github.com/opnsense/core/issues?q=is%3Aissue
Describe the bug
Opensense Version: OPNsense 24.1.5_3-amd64
Setting up a backup up to Google Drive you can configure a "Backup Count". The "Backup Count" should be the maximum count of backup files in the configured drive folder. When an new file gets uploaded to the backup folder and the maximum count ist reached, the oldest file should be deleted. This does work with a personal Google Drive Folder. This does not work with a Google Shared Drive Folder.
To Reproduce
- Set up a Google Shared Drive
- Create a Folder within the Google Shared Drive
- Follow the manual to set up the backup using Google Drive https://docs.opnsense.org/manual/how-tos/cloud_backup.html
- Use the Google Drive Folder ID from the folder creted in 2.
- Enter a number in "Backup Count"
- Execute backups or wait for backups until the number of backup files is greater than the number in "Backup Count".
- Realize that old backup files do not get deleted.
Expected behavior
The number of backup files should not be greater than the number in "Backup Count". Old backup files should get deleted.
Describe alternatives you considered
Since the introduction of the possibility to backup to Google Shared Drives I waited several versions for someone to solve the issue.
Workaround: You can create a Google Apps Script that takes care of the backup count from the target side.
Relevant log files
Additional context
Environment
Software version used and hardware type if relevant, e.g.:
OPNsense 24.1.5_3-amd64 Intel(R) Celeron(R) J6413 @ 1.80GHz (4 cores, 4 threads) Network Intel® i226-V
could be access grants on Google's end, trying my setup with 2 works, but I do need to execute twice to see the proper number of items in the gui (removal does not drop them from the list instantly)
https://github.com/opnsense/core/blob/24f36bf3323bdb08894a8619ab8e2b22ed557539/src/opnsense/mvc/app/library/OPNsense/Backup/GDrive.php#L270
Executing the backup manually via the GUI only shows one file in the success message every time. Allthough there are over 30 in the shared drive now. Some files were delete manually. (again - this is working in a personal drive folder.)
I am using a subfolder on the shared drive. The service sccount users mail address is configured as a content-manager of the subfolder.
As a test with higher access rights I set up a new shared drive and made the service account the administrator of the shared drive. But even then I only get one file in the file list after every backup via the GUI.
I checked the drive API in the developer console but I don't see, where to fiddle with access grants there.