Skip to content
This repository was archived by the owner on Aug 29, 2018. It is now read-only.

Commit 154a754

Browse files
committed
Merge pull request #115 from detiber/consoleBasicAuthTweak
Set correct auth config for console when using remote user basic auth
2 parents f235c7d + 8d8a600 commit 154a754

File tree

3 files changed

+40
-1
lines changed

3 files changed

+40
-1
lines changed

manifests/plugins/auth/htpasswd.pp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,21 @@
3737
before => Exec['Broker gem dependencies'],
3838
}
3939

40+
file {'Console htpasswd config':
41+
path => '/var/www/openshift/console/httpd/conf.d/openshift-origin-auth-remote-user-basic.conf',
42+
content =>
43+
template('openshift_origin/console/plugins/auth/basic/openshift-origin-auth-remote-user-basic.conf.erb'),
44+
owner => 'apache',
45+
group => 'apache',
46+
mode => '0644',
47+
require => [
48+
Package['rubygem-openshift-origin-auth-remote-user'],
49+
File['Broker htpasswd config'],
50+
],
51+
notify => Service['openshift-console'],
52+
before => Exec['Console gem dependencies'],
53+
}
54+
4055
file { 'Auth plugin config':
4156
path => '/etc/openshift/plugins.d/openshift-origin-auth-remote-user.conf',
4257
content => template('openshift_origin/broker/plugins/auth/basic/remote-user.conf.plugin.erb'),

templates/console/console.conf.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ BROKER_API_SSL_OPTIONS={:verify_mode => OpenSSL::SSL::VERIFY_NONE}
5353
# during startup of the console and any errors will prevent
5454
# load.
5555
#
56-
CONSOLE_SECURITY=basic
56+
CONSOLE_SECURITY=<%= scope.lookupvar('::openshift_origin::broker_auth_plugin') == 'mongo' ? 'basic' : 'remote_user' %>
5757

5858
#
5959
# The name of the request env variable or header that indicates a
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
LoadModule auth_basic_module modules/mod_auth_basic.so
2+
LoadModule authn_file_module modules/mod_authn_file.so
3+
LoadModule authz_user_module modules/mod_authz_user.so
4+
5+
# Turn the authenticated remote-user into an Apache environment variable for the console security controller
6+
RewriteEngine On
7+
RewriteCond %{LA-U:REMOTE_USER} (.+)
8+
RewriteRule . - [E=RU:%1]
9+
RequestHeader set X-Remote-User "%{RU}e" env=RU
10+
11+
<Location /console>
12+
AuthName "OpenShift Developer Console"
13+
AuthType Basic
14+
AuthUserFile /etc/openshift/htpasswd
15+
require valid-user
16+
17+
# The node->broker auth is handled in the Ruby code
18+
BrowserMatch Openshift passthrough
19+
Allow from env=passthrough
20+
21+
Order Deny,Allow
22+
Deny from all
23+
Satisfy any
24+
</Location>

0 commit comments

Comments
 (0)