Auto configure auth source
This commit is contained in:
+5
-3
@@ -13,8 +13,9 @@ services:
|
|||||||
REDMINE_DB_MYSQL: db
|
REDMINE_DB_MYSQL: db
|
||||||
REDMINE_SECRET_KEY_BASE: supersecretkey
|
REDMINE_SECRET_KEY_BASE: supersecretkey
|
||||||
REDMINE_PLUGINS_MIGRATE: "true"
|
REDMINE_PLUGINS_MIGRATE: "true"
|
||||||
#env_file:
|
REDMINE_LDAP: ldap
|
||||||
# - db.env
|
env_file:
|
||||||
|
- ldap.env
|
||||||
volumes:
|
volumes:
|
||||||
- redmine-files:/usr/src/redmine/files
|
- redmine-files:/usr/src/redmine/files
|
||||||
- redmine-config:/usr/src/redmine/config
|
- redmine-config:/usr/src/redmine/config
|
||||||
@@ -41,13 +42,14 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
LDAP_ORGANISATION: "Example Inc."
|
LDAP_ORGANISATION: "Example Inc."
|
||||||
LDAP_DOMAIN: "example.org"
|
LDAP_DOMAIN: "example.org"
|
||||||
LDAP_ADMIN_PASSWORD: "admin"
|
|
||||||
LDAP_CONFIG_PASSWORD: "config"
|
LDAP_CONFIG_PASSWORD: "config"
|
||||||
LDAP_READONLY_USER: "true"
|
LDAP_READONLY_USER: "true"
|
||||||
LDAP_READONLY_USER_USERNAME: "readonly"
|
LDAP_READONLY_USER_USERNAME: "readonly"
|
||||||
LDAP_READONLY_USER_PASSWORD: "readonly"
|
LDAP_READONLY_USER_PASSWORD: "readonly"
|
||||||
LDAP_BACKEND: "mdb"
|
LDAP_BACKEND: "mdb"
|
||||||
LDAP_TLS: "false"
|
LDAP_TLS: "false"
|
||||||
|
env_file:
|
||||||
|
- ldap.env
|
||||||
volumes:
|
volumes:
|
||||||
- ldap-database:/var/lib/ldap
|
- ldap-database:/var/lib/ldap
|
||||||
- ldap-config:/etc/ldap/slapd.d
|
- ldap-config:/etc/ldap/slapd.d
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
LDAP_BASE_DN: "DC=example,DC=org"
|
||||||
|
LDAP_ADMIN_PASSWORD: "admin"
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
# Add default ldap auth source
|
||||||
|
|
||||||
|
class Setup < ActiveRecord::Migration[4.2]
|
||||||
|
|
||||||
|
# look at auth_source.rb
|
||||||
|
# or auth_source_ldap.rb
|
||||||
|
# in path /usr/src/redmine/app/models
|
||||||
|
|
||||||
|
class AuthSource < ActiveRecord::Base
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.up
|
||||||
|
|
||||||
|
# create_table "auth_sources", :force => true do |t|
|
||||||
|
# t.column "type", :string, :limit => 30, :default => "", :null => false
|
||||||
|
# t.column "name", :string, :limit => 60, :default => "", :null => false
|
||||||
|
# t.column "host", :string, :limit => 60
|
||||||
|
# t.column "port", :integer
|
||||||
|
# t.column "account", :string, :limit => 60
|
||||||
|
# t.column "account_password", :string, :limit => 60
|
||||||
|
# t.column "base_dn", :string, :limit => 255
|
||||||
|
# t.column "attr_login", :string, :limit => 30
|
||||||
|
# t.column "attr_firstname", :string, :limit => 30
|
||||||
|
# t.column "attr_lastname", :string, :limit => 30
|
||||||
|
# t.column "attr_mail", :string, :limit => 30
|
||||||
|
# t.column "onthefly_register", :boolean, :default => false, :null => false
|
||||||
|
# end
|
||||||
|
|
||||||
|
# safe_attributes(
|
||||||
|
# 'name',
|
||||||
|
# 'host',
|
||||||
|
# 'port',
|
||||||
|
# 'account',
|
||||||
|
# 'account_password',
|
||||||
|
# 'base_dn',
|
||||||
|
# 'attr_login',
|
||||||
|
# 'attr_firstname',
|
||||||
|
# 'attr_lastname',
|
||||||
|
# 'attr_mail',
|
||||||
|
# 'onthefly_register',
|
||||||
|
# 'tls',
|
||||||
|
# 'verify_peer',
|
||||||
|
# 'filter',
|
||||||
|
# 'timeout')
|
||||||
|
|
||||||
|
# create default administrator account
|
||||||
|
auth = AuthSource.new
|
||||||
|
|
||||||
|
auth.name = "ldap"
|
||||||
|
auth.host = ENV["REDMINE_LDAP"]
|
||||||
|
auth.port = 389
|
||||||
|
auth.account = "admin"
|
||||||
|
auth.account_password = ENV["LDAP_ADMIN_PASSWORD"]
|
||||||
|
auth.base_dn = ENV["LDAP_BASE_DN"]
|
||||||
|
auth.attr_login = "uid"
|
||||||
|
auth.attr_firstname = "givenName"
|
||||||
|
auth.attr_lastname = "sn"
|
||||||
|
auth.attr_mail = "mail"
|
||||||
|
auth.onthefly_register = true
|
||||||
|
|
||||||
|
auth.save
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
@@ -1,2 +1,3 @@
|
|||||||
FROM redmine:latest
|
FROM redmine:latest
|
||||||
ADD --chown=999:999 ./redmine_ldap_passwd/ /usr/src/redmine/plugins/redmine_ldap_passwd/
|
ADD --chown=999:999 ./redmine_ldap_passwd/ /usr/src/redmine/plugins/redmine_ldap_passwd/
|
||||||
|
ADD --chown=999:999 ./999_config-ldap.rb /usr/src/redmine/db/migrate/
|
||||||
Reference in New Issue
Block a user