Quick Tip: Restoring Comet Backup After User Removal
When using comet backup server, you may have a scenario where you’ve had a user on your server, and they’ve been removed for whatever reason. The backup data still exists in a repository (say Minio or B2, or even the customers own local storage), but the account isn’t in your comet server anymore.
The bad news is that you cannot restore the data with only the repository. The good news is, if you’ve been backing up your Comet server database regularly (as you should), then this can still be theoretically retrieved.
The Process⌗
- Grab the database from where you have it backed up - it will be a zip file.
- Install a new comet server somewhere else, and copy that zip over to it.
- Finalise the server install, then stop the comet server
- Once unzipped, you’ll end up with a file listing as follows
root@localhost:~/comet> ls -ls
total 185680
4 drwxr-xr-x 2 root root 4096 Sep 7 15:29 autossl
60364 -rw------- 1 root root 61808103 Sep 7 15:29 'backup-0-1694048220[2023-09-07T10-27-00+09-30].zip'
16 -rw-r--r-- 1 root root 14436 Dec 31 1979 cometd.cfg
121916 -rw-r--r-- 1 root root 124837888 Dec 31 1979 comet-jobs.db3
20 -rw-r--r-- 1 root root 20480 Dec 31 1979 comet-license.db
32 -rw-r--r-- 1 root root 32768 Dec 31 1979 comet-news.db
16 -rw-r--r-- 1 root root 16384 Dec 31 1979 comet-sessions.db3
3152 -rw-r--r-- 1 root root 3227648 Dec 31 1979 comet-stats.db
20 -rw-r--r-- 1 root root 20480 Dec 31 1979 comet-updatecampaign.db
140 -rw-r--r-- 1 root root 143360 Dec 31 1979 comet-users.db
- Copy these over to your
/var/lib/cometd
folder, replacing any files in there (while the comet server is stopped) - Restart comet server, then you can either add the storage in here again and connect the client up to this temp server, and you’ll be able to restore. Or,
- If the client knows the password they had previously set, you’ll be able to create an account in your live/current server, and copy some values into that new account from the “temp” server.
- Go to Admin menu/profile item and tick Advanced Options
- Browse to the newly created profile, and Actions > Edit Raw Profile
- For the given destination, copy the values of
EncryptionKeyEncryptionMethod
,EncryptedEncryptionKey
andRepoInitTimestamp
- In the same way, bring these over to your live server, and paste them into the account there. These values, in combination with the password, will decrypt the storage. You can then connect up a client and restore .
Note: if you got the password wrong, you’ll see the following in the client:
Read other posts