Safemode doesn't allow to access

Thanks @aruzicka. That was the problem. I have an old script that I used when setting up Katello that I used when setting up this foreman instance. The script would create some global parameters and kt_activation_keys was one of them. kt_activation_keys was defined via this script but had no value. Deleting this global parameter fixed the safemode issue.