Update: I just noticed we can't create or edit Security rules. We can access the list of rules but when trying to create a new one or edit existing rule, same error message pops up: "Unexpected error".
It seems that you have some problem with PostgreSQL.
Hope you have all ports open.
I would recommend you to log a case with Qlik if you still find issue.
So I created ticket to Qlik Support. After sending copy of our database and many log files, they we're unable to replicate our problem. Next step was to arrange online meeting and let Qlik Support person investigate our server.
Turned out we had LocalUsers.dll file at C:\Program Files\Qlik\Sense\Repository\UserDirectoryConnectors.
When we removed (or actually turned it into .bak file), everything started to work as expected.
Qlik Support will try to replicate this now in their environment and investigate why it was still there after installation of June 2017 version. Maybe it was a bug and fix will be provided in future versions. In the meantime, if you encounter this kind of error, try our way to fix it. If it helped, I would be glad to hear!