[SOLVED] invalid csrf token on every edit

Stefano Giunchi

Renowned Member
Jan 17, 2016
91
14
73
51
Forlì, Italy
www.soasi.com
I played a bit with certificates and letsencrypt, failed and rolled back.
pmgproxy did not restart, resolved with pmgconfig apicert --force 1.

Now pmgproxy starts, I can login, but when I try to make any changes, I get this error then I have to login again:

1586328919843.png

Code:
root@mailscan:/etc/pmg# ls -alh
total 72K
drwxr-xr-x  3 root root     4.0K Apr  8 08:42 .
drwxr-xr-x 72 root root     4.0K Apr  8 08:18 ..
drwxr-xr-x  2 root root     4.0K Apr  4 15:29 dkim
-rw-r--r--  1 root root      106 Apr  4 16:01 domains
-rw-r--r--  1 root root      12K Apr  4 16:01 domains.db
-rw-r--r--  1 root root       30 Apr  4 16:01 mynetworks
-rw-r-----  1 root www-data 5.0K Apr  8 08:14 pmg-api.pem
-rw-------  1 root root     1.7K Apr  4 16:01 pmg-authkey.key
-rw-r--r--  1 root root      451 Apr  4 16:01 pmg-authkey.pub
-rw-r-----  1 root root     1.7K Apr  4 16:01 pmg-csrf.key
-rw-r--r--  1 root root      132 Apr  5 16:54 pmg.conf
-rw-r--r--  1 root root        0 Apr  4 16:01 tls_policy
-rw-r--r--  1 root root      12K Apr  4 16:01 tls_policy.db
-rw-r--r--  1 root root        0 Apr  4 16:01 transport
-rw-r--r--  1 root root      12K Apr  4 16:01 transport.db

Thanks for any help.
 
hmm - seems the 'pmg-csrf.key' has the wrong ownership - does it work after you run:
Code:
chown root.www-data /etc/pmg/pmg-csrf.key
systemctl restart pmgproxy pmgdaemon

Thanks!
 
Had a similar problem just fyi if you remove
/etc/pmg/pmg-authkey.key
/etc/pmg/pmg-authkey.pub
/etc/pmg/pmg-csrf.key

After reboot they will be re-generated. That fixed my problem.