Personal tools
You are here: Home 日々のメモ書き LDAP

LDAP

2008-10-02

PostgreSQLの認証をLDAPでする

Filed Under:

むずかしい話でもなくて。

host all all 127.0.0.1/32 ldap "ldap://192.168.1.1/dc=example,dc=org;uid=;,ou=Users,dc=example,dc=org"

とpg_hba.confに書く。

ldap://ldaphost/basedn;prefix;suffixとなる。この例でユーザーがhogeならばuid=hoge,ou=Users,dc=example,dc=jpが使われる。

ちなみに認証だけなのでユーザーの作成はcreateuserで別に作っておくように。AuthenticationとAuthorizationは違うという話。

2008-02-25

LDAP Account Manager 2.2.0

Filed Under:

気付いたところ。

  • ユーザー一覧表示のときにGIDからグループ名に変換するかどうかを設定で決められるようになった。今まではログインするたびにチェックボックスにチェックを入れる必要があった。
  • グループ一覧のときのプライマリグループの表示についても設定になる。
  • ユーザ追加画面のIFが変わった。他いろいろUIの改善。
  • ログ回りの設定がファイルからGUIに移動

2007-12-09

luma

Filed Under:

gui utility for accessing and managing LDAP database

qtを使ったLDAPブラウザ。わりといい感じ。

2007-11-21

gforge + LDAP

Filed Under:

gforgeでLDAP認証をする。ldapextauth pluginを使用する。

このプラグインは on the fly でユーザーを作成する。

  • gforge-plugins-extra を入れる。
  • /etc/gforge/plugins/dapextauth/config.php mapping.phpを作る。svnから持ってきてカスタマイズ
  • /usr/share/gforge/plugins/ldapextauth/bin/db-upgrade.pl
  • /usr/lib/gforge/bin/register-plugin ldapextauth "LDAP external authentication"
  • これでpluginは登録される。
  • libnss-ldapとまぜると危険。getentでユーザーチェックをしているのでそっちで発見されると拒否される。

2007-10-17

MediaWiki+LDAP

Filed Under:

MediaWikiの認証にLDAPを組み合わせる。

require_once( "$IP/extensions/LdapAuthentication.php" );
$wgAuth = new LdapAuthenticationPlugin();
$wgLDAPDomainNames = array(
"testLDAPdomain"
);

$wgLDAPServerNames = array(
"testLDAPdomain"=>"192.168.1.1"
);
$wgLDAPUseLocal = false;
$wgLDAPEncryptionType = array(
"testLDAPdomain"=>"clear"
);
$wgLDAPSearchStrings = array(
"testLDAPdomain"=>"uid=USER-NAME,ou=Users,dc=example,dc=net"
)

LocalSettings.phpに書く。USER-NAMEがログインIDに置換される。

  • WikiSysopに入れなくなるのでどうするか。WikiSysopをLDAPに作るのもいいが、一旦LDAPを外して通常のログインで入ってからLDAPのユーザーに権限を与える方法で解決させた。

2007-07-15

OpenDS-1.0.0

Filed Under:

OpendSの1.0.0-build001が7/14にリリースされた。

インストールはさらに簡単になっていてウィザードに従ってやればできる。さらに重要なのがレプリケーションに関して。これもウィザードの指示でホストとかポートを指定してやるだけでレプリケーションができる。ここまで簡単ならOpen LDAPから移行することを本気で考えようか。

2007-06-09

djangoでLDAP認証

Filed Under:

djangoでLDAP認証する方法

Django's new authentication backends という記事もあるのだが、これではanonymousでできないのでちょっと改良。anonymousでbindしてdnを捜して、そのdnで認証するという手順。手順は普通の話。

import ldap

import ldap
from django.contrib.auth.models import User

# Constants
AUTH_LDAP_SERVER = '192.168.0.1'

class LDAPBackend:
def authenticate(self, username=None, password=None):
base = "ou=Users,dc=example,dc=jp"
scope = ldap.SCOPE_SUBTREE
filter = "(&(objectclass=person) (uid=%s))" % username
ret = ['dn']

# Authenticate the base user so we can search
try:
l = ldap.open(AUTH_LDAP_SERVER)
l.protocol_version = ldap.VERSION3
except ldap.LDAPError:
return None

try:
result_id = l.search(base, scope, filter, ret)
result_type, result_data = l.result(result_id, 0)
# print result_data
if (len(result_data) != 1):
return None

# Attempt to bind to the user's DN
l.simple_bind_s(result_data[0][0],password)


try:
user = User.objects.get(username__exact=username)
except:
# Theoretical backdoor could be input right here. We don't
# want that, so input an unused random password here.
# The reason this is a backdoor is because we create a
# User object for LDAP users so we can get permissions,
# however we -don't- want them able to login without
# going through LDAP with this user. So we effectively
# disable their non-LDAP login ability by setting it to a
# random password that is not given to them. In this way,
# static users that don't go through ldap can still login
# properly, and LDAP users still have a User object.
from random import choice
import string
temp_pass = ""
for i in range(8):
temp_pass = temp_pass + choice(string.letters)
user = User.objects.create_user(username,
username + '@example.jp',temp_pass)
user.is_staff = False
user.save()
# Success.
return user

except ldap.INVALID_CREDENTIALS:
# Name or password were bad. Fail.
return None

def get_user(self, user_id):
try:
return User.objects.get(pk=user_id)
except User.DoesNotExist:
return None

ほんのちょっとだけ変更してあります。

2007-05-12

PAM+LDAP

Filed Under:

LDAPを使ってLinuxのPAM認証を導入する手順メモ

何回もやっているのだけど。
  • libnss-ldap libpam-ldapをインストール
  • ldapサーバーの指定とかはdebconfに適当に返答する。
  • libnss-ldapに関してはnssswitch.confを手動で書き換え。
  • /etc/pam.d/common-authを書き換え。/usr/share/doc/libpam-ldap/README.Debianを読むこと。
  • libnss-ldap.confにhost ldap://192.168.0.1/とか書くとなぜか見てくれない。 host 192.168.0.1にしないと駄目だった。

proftpd + PAM + LDAP

Filed Under:

結論としては駄目ということなんだろうか。

"mod_auth_pam is not on this list because it cannot provide the necessary user account informatin." だそうです。mod_ldapでやらないと駄目なのかねえ?

mod_ldapの設定は以下。
LDAPServer            localhost
LDAPDoAuth on "ou=Users,dc=example,dc=com"

2007-04-30

OpenDSにログインできなくなった

Filed Under:

LDAP StudioのテストとしてOpenDSを使おうとしたが。

あれ、管理者のdnってなんだっけ。cn=Directory Managerだった。でパスワード。わからなくなっていた…。うわーん、初期化の方法もわからん…。再インストールしたけど…。

結局はconfig.ldifの書き直しのようだ。 ./bin/encode-password -s SSHA512 -c 'newpassword'を実行して、出力をconfig.ldifの
dn: cn=Directory Manager,cn=Root DNs,cn=config の userpassword: を書き直せばいいようだ。

2007-04-29

LDAP Studio 0.7.0

Filed Under:

リリースされていた。

差がよくわからない。

apacheds-1.5.0を使ってみる

Filed Under:

いつのまにか(4/12)にリリースされていた。

インストールは1.0.1と同じ。
# java -jar apacheds-1.5.0-linux-i386-setup.jar
を実行する。

適当にウィザードに答える。管理者がuid=admin,ou=systemになっていた。間違えてメモしていたかな。conf/server.xmlに設定が書いてあるので気にいらなかったら変更する。

Multi-Master replicationが実装されたそうなので、そのうち試してみることにする。

2007-03-24

DSML

Filed Under:

LDAP Studioを使っていたら、import/exportにDSMLという文字が。

名前で見当がついたが、Directory Services Markup Languageの略でLDAPのデータをやりとりするためのXMLのschemaである。単なるデータ表現のみならず、問い合わせも記述できるのがLDIFより進んでいるところか。OpenLDAPはnativeで使えるんだっけ?

ApacheDSを使ってみる

Filed Under:

Apacheで開発されているDirectory Server(LDAP サーバ)のApacheDS-1.0.1を使ってみる。

インストールはjarをダウンロードしてきて
# java -jar apacheds-1.0.1-linux-i386-setup.jar
を実行する。

初期状態でTCP/10389を使って、uid=admin,dc=system・password=secretで管理者権限でbind。

普通にLDAPサーバとして使える。残念ながらMulti-MasterではないのでOpenLDAPから移行する元気はない。
でもOpenLDAPよりはましなんだろうなあとは思う。

LDAP Studio

Filed Under:

Apache Directoryで開発されているLDAP Studioを使ってみる。

Screenshot-LDAP Studio .png
Eclipseのプラグインとして実現されている。Connectionsのウィンドウから新しいConnectionを追加。ホスト名を打ち込むぐらい。あとはGUIで簡単編集と見たままのソフト。新しいentryの追加もwizard形式で作れる。追加は今のところfrom scratchか、他のentryをtemplateにする方法があるようだ。

検索もwizardを使ってできる。
Screenshot-Search -1.png
検索結果は日時と共に保存されて繰り返し参照できる。

Schemaも編集できる。
Screenshot-LDAP Studio -2.png

Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: