Topic: No login in Sogo after databases restore (and email not working)
==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 1.5.1
- Deployed with iRedMail Easy or the downloadable installer? download
- Linux/BSD distribution name and version: lxc virtual Ubuntu 16.04 on host Ubuntu 20.04
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): remote MySQL in docker
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? No
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====
Hi,
This is just for archiving to help some else with this problem: No login in Sogo after Database restore
So i had a mysql-crash, and had to install a new server (eg spin up a new docker image with a newer MariaBD-database that couldn't use my old database-volume).
Luckily procedure to restore databases from iredmail have been described here: docs.iredmail.org/backup.restore.html
Problem is that the restore of the Sogo-databases did not include the (working) view on the Vmail-database mailbox with the useraccounts.
Things to consider when restoring database is that you restore all iredmail-accounts for each database, including SELECT-permissions for sogo-user on vmail.mailbox-table.
I don't remember in which order i restored the databases so maybe it is helpful to restore vmail-database first, and then the sogo-database.
In the backup-file (made by standard iredmail backup-script) the view defined as sql-statement as such:
DROP TABLE IF EXISTS `users`;
/*!50001 DROP VIEW IF EXISTS `users`*/;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `users` AS SELECT
1 AS `c_uid`,
1 AS `c_name`,
1 AS `c_password`,
1 AS `c_cn`,
1 AS `mail`,
1 AS `domain`,
1 AS `c_webmail`,
1 AS `c_calendar`,
1 AS `c_activesync`*/;
but that didn't work. For Mariadb (v10.5.16) i had to rewrite this to:
CREATE OR REPLACE
ALGORITHM = UNDEFINED VIEW `sogo`.`users` AS
select
`vmail`.`mailbox`.`username` AS `c_uid`,
`vmail`.`mailbox`.`username` AS `c_name`,
`vmail`.`mailbox`.`password` AS `c_password`,
`vmail`.`mailbox`.`name` AS `c_cn`,
`vmail`.`mailbox`.`username` AS `mail`,
`vmail`.`mailbox`.`domain` AS `domain`,
`vmail`.`mailbox`.`enablesogowebmail` AS `c_webmail`,
`vmail`.`mailbox`.`enablesogocalendar` AS `c_calendar`,
`vmail`.`mailbox`.`enablesogoactivesync` AS `c_activesync`
from
`vmail`.`mailbox`
where
`vmail`.`mailbox`.`enablesogo` = 1
and `vmail`.`mailbox`.`active` = 1;
----
Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.