I'm trying to activate authentification via htpasswd in my minishift 1.11.0 installation. I cannot find the master config file to set the values described in the documentation for Openshift Origin. I've searched in the minishift-VM via minishift ssh and in the minishift folders in my home folder on my Windows 7 Host.
How can I activate htpasswd for minishift 1.11.0?
EDIT:
I found the master-config.yaml
in the folder /var/lib/minishift/openshift.local.config/master/
. I changed the content under oauthConfig as described in the Openshift documentation:
https://docs.openshift.org/latest/install_config/configuring_authentication.html
The .htpasswd file is located in the same folder and referenced in the master config with it's absolute path.
But when I stop and start minishift again, the starting process ends with the following error:
-- Starting OpenShift container ...
Starting OpenShift using container 'origin'
FAIL
Error: could not start OpenShift container "origin"
Details:
No log available from "origin" container
minishift : Error during 'cluster up' execution: Error starting the cluster.
In Zeile:1 Zeichen:1
+ minishift start --vm-driver=virtualbox
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (Error during 'c...ng the cluster.:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
EDIT 2: I'm suspecting, that Openshift directly uses the tool htpasswd to verify the passwords of the users. I was not able to install htpasswd in the boot2docker VM, that minishift uses, so the initialization of the container failes. (also yum is not installed by default).
Is it possible to install htpasswd in boot2docker? If yes, where can I get the package?
I think I have found the problem. While trying I changed to the centos image for minishift with the corresponding flag at startup:
minishift start --iso-url=centos
When I wanted to patch the configuration to the master with minishift openshift config set
it failed and rolled back. Searching in the logs (with minishift logs
) got me this line:
error: Invalid MasterConfig /var/lib/origin/openshift.local.config/master/master-config.yaml
oauthConfig.identityProvider[0].provider.file: Invalid value: "/var/lib/minishift/openshift.local.config/master/.htpasswd": could not read file: stat /var/lib/minishift/openshift.local.co
nfig/master/.htpasswd: no such file or directory
Openshift couldn't find the HTPasswd file, because for Openshift the master-config.yaml
file lies in
/var/lib/origin/openshift.local.config/master
and not in
/var/lib/minishift/openshift.local.config/master
as I had written in the config file. The latter one is the path of the files as seen by the minishift-VM itself (as seen, when using minishift ssh
), but the Openshift instance, that runs inside it sees only the first one. I only had to update the master config file to the right filepath.
I haven't checked, if this also solves the problem for the boot2docker-iso, but I think this must have been the problem. And HTPasswd really doesn't need to be installed in the VM to let this work. You just need the file with your users and passwords reachable for the VM.
PS.: I also got a strange side behaviour. One user was already defined, when I changed to HTPasswd. I also defined him in the password file, but when trying to log with this username via the webconsole, I got the error, that the user could not be created. All other usernames work correctly. Maybe I have to delete him in some internal user directory, before adding him to HTPasswd.