Configure LDAP integration for Mastodon
This commit is contained in:
@@ -44,7 +44,7 @@ end
|
||||
|
||||
elasticsearch_service 'elasticsearch'
|
||||
|
||||
postgresql_data_bag_item = data_bag_item('credentials', 'postgresql')
|
||||
postgresql_credentials = data_bag_item('credentials', 'postgresql')
|
||||
|
||||
mastodon_path = node["kosmos-mastodon"]["directory"]
|
||||
mastodon_user = "mastodon"
|
||||
@@ -168,7 +168,22 @@ execute "restart mastodon services" do
|
||||
notifies :restart, "service[mastodon-streaming]", :delayed
|
||||
end
|
||||
|
||||
mastodon_credentials = data_bag_item('credentials', 'mastodon')
|
||||
credentials = data_bag_item('credentials', 'mastodon')
|
||||
|
||||
ldap_config = {
|
||||
host: "ldap.kosmos.local",
|
||||
port: 389,
|
||||
method: "plain",
|
||||
base: "ou=kosmos.org,cn=users,dc=kosmos,dc=org",
|
||||
bind_dn: credentials["ldap_bind_dn"],
|
||||
password: credentials["ldap_password"],
|
||||
uid: "cn",
|
||||
mail: "mail",
|
||||
search_filter: "(&(|(cn=%{email})(mail=%{email}))(serviceEnabled=mastodon))",
|
||||
uid_conversion_enabled: "true",
|
||||
uid_conversion_search: "-",
|
||||
uid_conversion_replace: "_"
|
||||
}
|
||||
|
||||
template "#{mastodon_path}/.env.#{rails_env}" do
|
||||
source "env.erb"
|
||||
@@ -178,21 +193,22 @@ template "#{mastodon_path}/.env.#{rails_env}" do
|
||||
variables redis_url: node["kosmos-mastodon"]["redis_url"],
|
||||
domain: node["kosmos-mastodon"]["domain"],
|
||||
alternate_domains: node["kosmos-mastodon"]["alternate_domains"],
|
||||
paperclip_secret: mastodon_credentials['paperclip_secret'],
|
||||
secret_key_base: mastodon_credentials['secret_key_base'],
|
||||
otp_secret: mastodon_credentials['otp_secret'],
|
||||
smtp_login: mastodon_credentials['smtp_user_name'],
|
||||
smtp_password: mastodon_credentials['smtp_password'],
|
||||
paperclip_secret: credentials['paperclip_secret'],
|
||||
secret_key_base: credentials['secret_key_base'],
|
||||
otp_secret: credentials['otp_secret'],
|
||||
ldap: ldap_config,
|
||||
smtp_login: credentials['smtp_user_name'],
|
||||
smtp_password: credentials['smtp_password'],
|
||||
smtp_from_address: "mail@#{node['kosmos-mastodon']['domain']}",
|
||||
s3_endpoint: node["kosmos-mastodon"]["s3_endpoint"],
|
||||
s3_region: node["kosmos-mastodon"]["s3_region"],
|
||||
s3_bucket: node["kosmos-mastodon"]["s3_bucket"],
|
||||
s3_alias_host: node["kosmos-mastodon"]["s3_alias_host"],
|
||||
aws_access_key_id: mastodon_credentials['s3_key_id'],
|
||||
aws_secret_access_key: mastodon_credentials['s3_secret_key'],
|
||||
vapid_private_key: mastodon_credentials['vapid_private_key'],
|
||||
vapid_public_key: mastodon_credentials['vapid_public_key'],
|
||||
db_pass: postgresql_data_bag_item['mastodon_user_password'],
|
||||
aws_access_key_id: credentials['s3_key_id'],
|
||||
aws_secret_access_key: credentials['s3_secret_key'],
|
||||
vapid_private_key: credentials['vapid_private_key'],
|
||||
vapid_public_key: credentials['vapid_public_key'],
|
||||
db_pass: postgresql_credentials['mastodon_user_password'],
|
||||
db_host: "pg.kosmos.local",
|
||||
default_locale: node["kosmos-mastodon"]["default_locale"],
|
||||
allowed_private_addresses: node["kosmos-mastodon"]["allowed_private_addresses"],
|
||||
|
||||
@@ -29,6 +29,23 @@ SMTP_LOGIN=<%= @smtp_login %>
|
||||
SMTP_PASSWORD=<%= @smtp_password %>
|
||||
SMTP_FROM_ADDRESS=<%= @smtp_from_address %>
|
||||
|
||||
<% if @ldap %>
|
||||
# LDAP configuration
|
||||
LDAP_ENABLED=true
|
||||
LDAP_HOST=<%= @ldap[:host] %>
|
||||
LDAP_PORT=<%= @ldap[:port] %>
|
||||
LDAP_METHOD='<%= @ldap[:method] %>'
|
||||
LDAP_BASE='<%= @ldap[:base] %>'
|
||||
LDAP_BIND_DN='<%= @ldap[:bind_dn] %>'
|
||||
LDAP_PASSWORD='<%= @ldap[:password] %>'
|
||||
LDAP_UID=<%= @ldap[:uid] %>
|
||||
LDAP_MAIL=<%= @ldap[:mail] %>
|
||||
LDAP_SEARCH_FILTER='<%= @ldap[:search_filter] %>'
|
||||
LDAP_UID_CONVERSION_ENABLED=<%= @ldap[:uid_conversion_enabled] %>
|
||||
LDAP_UID_CONVERSION_SEARCH=<%= @ldap[:uid_conversion_search] %>
|
||||
LDAP_UID_CONVERSION_REPLACE=<%= @ldap[:uid_conversion_replace] %>
|
||||
<% end %>
|
||||
|
||||
# Optional asset host for multi-server setups
|
||||
# CDN_HOST=assets.example.com
|
||||
|
||||
|
||||
Reference in New Issue
Block a user