LDAP/smbldap-passwd をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
計算機の認証先にLDAPを採用した. っでアカウントのパスワー...
ただし、この場合 Posix側の変更であってsamba側にはその変更...
同じLDAPを認証先として構築した smb サーバで要求されるpass...
ならどうするか?
windowsOSであれば一応変更できる. 結構トリッキーだけど.
求めたいのは一つのコマンドで Posix側もsmb側も一緒にパスワ...
っでLDAPとsambaを連携させるパッケージ「smbldap-tools」(Us...
***修正 [#k2a2db4a]
LDAPを一部修正します. 修正箇所は「dn: olcDatabase={2}hdb,...
こちらはLDAP構築時に「ldap/ldapdomain.ldif」にて
#code(nonumber){{
[root@ldap-server ~]# cat ldap/ldapdomain.ldif
:
:
dn: olcDatabase={2}mdb,cn=config
changetype: modify
add: olcAccess
olcAccess: {0}to attrs=userPassword,shadowLastChange by d...
olcAccess: {1}to dn.base="" by * read
olcAccess: {2}to * by dn="cn=Manager,dc=sybyl,dc=local" w...
[root@ldap-server ~]#
}}
と定義されていた.
修正部分のldifを作って対応してみたが、どうもうまくいかない.
なのでldapviで直接修正してみる.
#code(nonumber){{
[root@ldap-server ~]# dnf install epel-release
[root@ldap-server ~]# dnf install ldapvi
[root@ldap-server ~]# ldapvi -Y EXTERNAL -h ldapi:/// -b ...
}}
編集箇所は下記になります
#code(nonumber){{
olcAccess: {0}to attrs=userPassword,shadowLastChange by d...
これを下記にする(一行です)
olcAccess: {0}to attrs=userPassword,shadowLastChange,samb...
by dn="cn=Manager,dc=sybyl,dc=local" write by anonymous...
}}
修正して保存すると即座に反映されます
***smbldap-passwd インストール [#te50b5c6]
#code(nonumber){{
[root@ldap-smb ~]# curl -O http://repo.iotti.biz/CentOS/8...
[root@ldap-smb ~]# dnf install epel-release -y
[root@ldap-smb ~]# dnf localinstall smbldap-tools-0.9.11-...
}}
まずは設定. 「smbldap-config」を実行します. 色々問われる...
#code(nonumber){{
[root@ldap-smb ~]# smbldap-config
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-...
smbldap-tools script configuration
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Before starting, check
. if your samba controller is up and running.
. if the domain SID is defined (you can get it with the ...
. you can leave the configuration using the Ctrl-c key c...
. empty value can be set with the "." character
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-...
Looking for configuration files...
Samba Configuration File Path [/etc/samba/smb.conf] >
The default directory in which the smbldap configuration ...
If you need to change this, enter the full directory path...
Smbldap-tools Configuration Directory Path [/etc/smbldap-...
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-...
Let's start configuring the smbldap-tools scripts ...
. workgroup name: name of the domain Samba acts as a PDC ...
workgroup name [SAMBA] >
. netbios name: netbios name of the samba controller
netbios name [] >
. logon drive: local path to which the home directory wil...
logon drive [] >
. logon home: home directory location (for Win95/98 or NT...
(use %U as username) Ex:'\\\%U'
logon home (press the "." character if you don't want h...
. logon path: directory where roaming profiles are stored...
logon path (press the "." character if you don't want r...
. home directory prefix (use %U as username) [/home/%U] >
. default users' homeDirectory mode [700] >
. default user netlogon script (use %U as username) [] >
. default password validation time (time in days) [45] >
. ldap suffix [dc=sybyl,dc=local] >
. ldap group suffix [ou=Group] >
. ldap user suffix [ou=People] >
. ldap machine suffix [] >
. Idmap suffix [ou=Idmap] >
. sambaUnixIdPooldn: object where you want to store the n...
and gidNumber available for new users and groups
sambaUnixIdPooldn object (relative to ${suffix}) [samba...
. ldap master server: IP address or DNS name of the maste...
ldap master server [192.168.0.81] >
. ldap master port [389] >
. ldap master bind dn [cn=Manager,dc=sybyl,dc=local] >
. ldap master bind password [] >
. ldap slave server: IP address or DNS name of the slave ...
ldap slave server [192.168.0.81] >
. ldap slave port [389] >
. ldap slave bind dn [cn=Manager,dc=sybyl,dc=local] >
. ldap slave bind password [] >
. ldap tls support (1/0) [0] >
. SID for domain SAMBA: SID of the domain (can be obtaine...
SID for domain SAMBA [S-1-5-21-4253967948-352593788-321...
. unix password hash: hash used for unix passwords
If set to "exop", use LDAPv3 Password Modify (RFC 3062)...
unix password hash (CRYPT, MD5, SMD5, SSHA, SHA, CLEART...
. default user gidNumber [513] >
. default computer gidNumber [515] >
. default login shell [/bin/bash] >
. default skeleton directory [/etc/skel] >
. default domain name to append to mail address [] >
. treat shadowAccount object or not (1/0) [1] >
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-...
backup old configuration files:
/etc/smbldap-tools/smbldap.conf->/etc/smbldap-tools/smb...
/etc/smbldap-tools/smbldap_bind.conf->/etc/smbldap-tool...
writing new configuration file:
/etc/smbldap-tools/smbldap.conf done.
/etc/smbldap-tools/smbldap_bind.conf done.
[root@ldap-smb ~]#
}}
これによって作られるファイルは「/etc/smbldap-tools/smblda...
#code(nonumber){{
[root@ldap-smb ~]# grep -v -e '^\s*#' -e '^\s*$' /etc/smb...
SID="S-1-5-21-4253967948-352593788-3218593100"
sambaDomain="SAMBA"
slaveLDAP="192.168.0.81"
slavePort="389"
masterLDAP="192.168.0.81"
masterPort="389"
ldapTLS="0"
verify=""
cafile=""
clientcert=""
clientkey=""
suffix="dc=sybyl,dc=local"
usersdn="ou=People,${suffix}"
computersdn=",${suffix}"
groupsdn="ou=Group,${suffix}"
idmapdn="ou=Idmap,${suffix}"
sambaUnixIdPooldn="sambaDomainName=SAMBA,${suffix}"
scope="sub"
password_hash="SSHA"
password_crypt_salt_format=""
userLoginShell="/bin/bash"
userHome="/home/%U"
userHomeDirectoryMode="700"
userGecos="System User"
defaultUserGid="513"
defaultComputerGid="515"
skeletonDir="/etc/skel"
shadowAccount="1"
defaultMaxPasswordAge="45"
userSmbHome="\\\%U"
userProfile="\\\profiles\%U"
userHomeDrive=""
userScript=""
mailDomain=""
with_smbpasswd="0"
smbpasswd="/usr/bin/smbpasswd"
with_slappasswd="0"
slappasswd="/usr/sbin/slappasswd"
[root@ldap-smb ~]# grep -v -e '^\s*#' -e '^\s*$' /etc/smb...
slaveDN="cn=Manager,dc=sybyl,dc=local"
slavePw="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" ...
masterDN="cn=Manager,dc=sybyl,dc=local"
masterPw="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" ...
[root@ldap-smb ~]#
}}
これで準備は完了
***つかってみる [#a7f0ced9]
ここではパスワードを変更して、それがPosixもsmbも同時に変...
#code(nonumber){{
[foo@ldap-smb ~]$ smbldap-passwd -h
(c) Jerome Tournier - (jtournier@gmail.com)- Licensed und...
Usage: /usr/sbin/smbldap-passwd [hpsuB?] [username]
-h, -?, --help show this help message
-p read password from STDIN without verific...
-s update only samba password
-u update only UNIX password
-B must change Samba password at logon
[foo@ldap-smb ~]$
[foo@ldap-smb ~]$ smbldap-passwd
Identity validation...
Enter your UNIX password: <-- これまで...
Changing UNIX and samba passwords for foo
New password: <-- これから...
Retype new password:
[foo@ldap-smb ~]$
}}
これで両方同時にパスワードが変更された.
***smb共有を提供していないサイトでも使いたい [#cb7de8df]
上記は ldap を参照しているclientマシンで、かつそこでsmbを...
ではsmbを提供せず、 ldap 参照clientマシンの場合は?
前段の「smbldap-config」の内容から「smbpasswd」コマンドと...
なので、この2つを含むパッケージをまずは入れてみる
#code(nonumber){{
[root@ldap-client ~]# yum install samba-common-tools
[root@ldap-client ~]# yum install openldap-servers
}}
そして本題の「smbldap-tools」
#code(nonumber){{
[root@ldap-client ~]# yum install epel-release
[root@ldap-client ~]# yum install smbldap-tools
}}
次にsmbldap-toolsの設定で「smbldap-config」を実行すると
#code(nonumber){{
[root@ldap-client ~]# smbldap-config
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-...
smbldap-tools script configuration
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Before starting, check
. if your samba controller is up and running.
. if the domain SID is defined (you can get it with the ...
. you can leave the configuration using the Ctrl-c key c...
. empty value can be set with the "." character
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-...
Samba needs to be started first !
[root@ldap-client ~]#
}}
と言われる. smbデーモンの起動が必要なようで、そうなると/e...
「/etc/samba/smb.conf」はsmbサービスを提供している所から...
#code(nonumber){{
[root@ldap-client ~]# cat /etc/samba/smb.conf
[global]
workgroup = SAMBA
security = user
load printers = no
passdb backend = ldapsam:ldap://192.168.0.81
ldap suffix = dc=sybyl,dc=local
ldap user suffix = ou=People
ldap group suffix = ou=Group
ldap admin dn = cn=Manager,dc=sybyl,dc=local
ldap passwd sync = yes
ldap ssl = off
[root@ldap-client ~]#
}}
smb共有をする必要はないので、[global]設定のみかな. 「lda...
#code(nonumber){{
[root@ldap-client ~]# smbpasswd -W
Setting stored password for "cn=Manager,dc=sybyl,dc=local...
New SMB password:
Retype new SMB password:
[root@ldap-client ~]#
}}
その後にsmbデーモンを稼働させ、再度「smbldap-config」を実...
#code(nonumber){{
[root@ldap-client ~]# systemctl start smb
[root@ldap-client ~]# smbldap-config
}}
「smbldap-config」は特段何も修正せず、リターンキーで応答....
その後、一般ユーザでパスワード変更が可能になる
&color(red){*};「smbldap-config」が完了したらsmbデーモン...
#code(nonumber){{
[foo@ldap-client ~]$ smbldap-passwd
Identity validation...
Enter your UNIX password:
Changing UNIX and samba passwords for foo
New password:
Retype new password:
[foo@ldap-client ~]$
}}
これでLDAPのみ参照のノードでもsshログインパスワードとsmb...
rootユーザのパスワード変更には使えないけど一般ユーザのpas...
#code(nonumber){{
[root@c ~]# vi /etc/modulefiles/smbldap-passwd
#%Module1.0
set-alias passwd /usr/sbin/smbldap-passwd
[root@c ~]#
}}
とするとか.
終了行:
計算機の認証先にLDAPを採用した. っでアカウントのパスワー...
ただし、この場合 Posix側の変更であってsamba側にはその変更...
同じLDAPを認証先として構築した smb サーバで要求されるpass...
ならどうするか?
windowsOSであれば一応変更できる. 結構トリッキーだけど.
求めたいのは一つのコマンドで Posix側もsmb側も一緒にパスワ...
っでLDAPとsambaを連携させるパッケージ「smbldap-tools」(Us...
***修正 [#k2a2db4a]
LDAPを一部修正します. 修正箇所は「dn: olcDatabase={2}hdb,...
こちらはLDAP構築時に「ldap/ldapdomain.ldif」にて
#code(nonumber){{
[root@ldap-server ~]# cat ldap/ldapdomain.ldif
:
:
dn: olcDatabase={2}mdb,cn=config
changetype: modify
add: olcAccess
olcAccess: {0}to attrs=userPassword,shadowLastChange by d...
olcAccess: {1}to dn.base="" by * read
olcAccess: {2}to * by dn="cn=Manager,dc=sybyl,dc=local" w...
[root@ldap-server ~]#
}}
と定義されていた.
修正部分のldifを作って対応してみたが、どうもうまくいかない.
なのでldapviで直接修正してみる.
#code(nonumber){{
[root@ldap-server ~]# dnf install epel-release
[root@ldap-server ~]# dnf install ldapvi
[root@ldap-server ~]# ldapvi -Y EXTERNAL -h ldapi:/// -b ...
}}
編集箇所は下記になります
#code(nonumber){{
olcAccess: {0}to attrs=userPassword,shadowLastChange by d...
これを下記にする(一行です)
olcAccess: {0}to attrs=userPassword,shadowLastChange,samb...
by dn="cn=Manager,dc=sybyl,dc=local" write by anonymous...
}}
修正して保存すると即座に反映されます
***smbldap-passwd インストール [#te50b5c6]
#code(nonumber){{
[root@ldap-smb ~]# curl -O http://repo.iotti.biz/CentOS/8...
[root@ldap-smb ~]# dnf install epel-release -y
[root@ldap-smb ~]# dnf localinstall smbldap-tools-0.9.11-...
}}
まずは設定. 「smbldap-config」を実行します. 色々問われる...
#code(nonumber){{
[root@ldap-smb ~]# smbldap-config
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-...
smbldap-tools script configuration
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Before starting, check
. if your samba controller is up and running.
. if the domain SID is defined (you can get it with the ...
. you can leave the configuration using the Ctrl-c key c...
. empty value can be set with the "." character
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-...
Looking for configuration files...
Samba Configuration File Path [/etc/samba/smb.conf] >
The default directory in which the smbldap configuration ...
If you need to change this, enter the full directory path...
Smbldap-tools Configuration Directory Path [/etc/smbldap-...
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-...
Let's start configuring the smbldap-tools scripts ...
. workgroup name: name of the domain Samba acts as a PDC ...
workgroup name [SAMBA] >
. netbios name: netbios name of the samba controller
netbios name [] >
. logon drive: local path to which the home directory wil...
logon drive [] >
. logon home: home directory location (for Win95/98 or NT...
(use %U as username) Ex:'\\\%U'
logon home (press the "." character if you don't want h...
. logon path: directory where roaming profiles are stored...
logon path (press the "." character if you don't want r...
. home directory prefix (use %U as username) [/home/%U] >
. default users' homeDirectory mode [700] >
. default user netlogon script (use %U as username) [] >
. default password validation time (time in days) [45] >
. ldap suffix [dc=sybyl,dc=local] >
. ldap group suffix [ou=Group] >
. ldap user suffix [ou=People] >
. ldap machine suffix [] >
. Idmap suffix [ou=Idmap] >
. sambaUnixIdPooldn: object where you want to store the n...
and gidNumber available for new users and groups
sambaUnixIdPooldn object (relative to ${suffix}) [samba...
. ldap master server: IP address or DNS name of the maste...
ldap master server [192.168.0.81] >
. ldap master port [389] >
. ldap master bind dn [cn=Manager,dc=sybyl,dc=local] >
. ldap master bind password [] >
. ldap slave server: IP address or DNS name of the slave ...
ldap slave server [192.168.0.81] >
. ldap slave port [389] >
. ldap slave bind dn [cn=Manager,dc=sybyl,dc=local] >
. ldap slave bind password [] >
. ldap tls support (1/0) [0] >
. SID for domain SAMBA: SID of the domain (can be obtaine...
SID for domain SAMBA [S-1-5-21-4253967948-352593788-321...
. unix password hash: hash used for unix passwords
If set to "exop", use LDAPv3 Password Modify (RFC 3062)...
unix password hash (CRYPT, MD5, SMD5, SSHA, SHA, CLEART...
. default user gidNumber [513] >
. default computer gidNumber [515] >
. default login shell [/bin/bash] >
. default skeleton directory [/etc/skel] >
. default domain name to append to mail address [] >
. treat shadowAccount object or not (1/0) [1] >
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-...
backup old configuration files:
/etc/smbldap-tools/smbldap.conf->/etc/smbldap-tools/smb...
/etc/smbldap-tools/smbldap_bind.conf->/etc/smbldap-tool...
writing new configuration file:
/etc/smbldap-tools/smbldap.conf done.
/etc/smbldap-tools/smbldap_bind.conf done.
[root@ldap-smb ~]#
}}
これによって作られるファイルは「/etc/smbldap-tools/smblda...
#code(nonumber){{
[root@ldap-smb ~]# grep -v -e '^\s*#' -e '^\s*$' /etc/smb...
SID="S-1-5-21-4253967948-352593788-3218593100"
sambaDomain="SAMBA"
slaveLDAP="192.168.0.81"
slavePort="389"
masterLDAP="192.168.0.81"
masterPort="389"
ldapTLS="0"
verify=""
cafile=""
clientcert=""
clientkey=""
suffix="dc=sybyl,dc=local"
usersdn="ou=People,${suffix}"
computersdn=",${suffix}"
groupsdn="ou=Group,${suffix}"
idmapdn="ou=Idmap,${suffix}"
sambaUnixIdPooldn="sambaDomainName=SAMBA,${suffix}"
scope="sub"
password_hash="SSHA"
password_crypt_salt_format=""
userLoginShell="/bin/bash"
userHome="/home/%U"
userHomeDirectoryMode="700"
userGecos="System User"
defaultUserGid="513"
defaultComputerGid="515"
skeletonDir="/etc/skel"
shadowAccount="1"
defaultMaxPasswordAge="45"
userSmbHome="\\\%U"
userProfile="\\\profiles\%U"
userHomeDrive=""
userScript=""
mailDomain=""
with_smbpasswd="0"
smbpasswd="/usr/bin/smbpasswd"
with_slappasswd="0"
slappasswd="/usr/sbin/slappasswd"
[root@ldap-smb ~]# grep -v -e '^\s*#' -e '^\s*$' /etc/smb...
slaveDN="cn=Manager,dc=sybyl,dc=local"
slavePw="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" ...
masterDN="cn=Manager,dc=sybyl,dc=local"
masterPw="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" ...
[root@ldap-smb ~]#
}}
これで準備は完了
***つかってみる [#a7f0ced9]
ここではパスワードを変更して、それがPosixもsmbも同時に変...
#code(nonumber){{
[foo@ldap-smb ~]$ smbldap-passwd -h
(c) Jerome Tournier - (jtournier@gmail.com)- Licensed und...
Usage: /usr/sbin/smbldap-passwd [hpsuB?] [username]
-h, -?, --help show this help message
-p read password from STDIN without verific...
-s update only samba password
-u update only UNIX password
-B must change Samba password at logon
[foo@ldap-smb ~]$
[foo@ldap-smb ~]$ smbldap-passwd
Identity validation...
Enter your UNIX password: <-- これまで...
Changing UNIX and samba passwords for foo
New password: <-- これから...
Retype new password:
[foo@ldap-smb ~]$
}}
これで両方同時にパスワードが変更された.
***smb共有を提供していないサイトでも使いたい [#cb7de8df]
上記は ldap を参照しているclientマシンで、かつそこでsmbを...
ではsmbを提供せず、 ldap 参照clientマシンの場合は?
前段の「smbldap-config」の内容から「smbpasswd」コマンドと...
なので、この2つを含むパッケージをまずは入れてみる
#code(nonumber){{
[root@ldap-client ~]# yum install samba-common-tools
[root@ldap-client ~]# yum install openldap-servers
}}
そして本題の「smbldap-tools」
#code(nonumber){{
[root@ldap-client ~]# yum install epel-release
[root@ldap-client ~]# yum install smbldap-tools
}}
次にsmbldap-toolsの設定で「smbldap-config」を実行すると
#code(nonumber){{
[root@ldap-client ~]# smbldap-config
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-...
smbldap-tools script configuration
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Before starting, check
. if your samba controller is up and running.
. if the domain SID is defined (you can get it with the ...
. you can leave the configuration using the Ctrl-c key c...
. empty value can be set with the "." character
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-...
Samba needs to be started first !
[root@ldap-client ~]#
}}
と言われる. smbデーモンの起動が必要なようで、そうなると/e...
「/etc/samba/smb.conf」はsmbサービスを提供している所から...
#code(nonumber){{
[root@ldap-client ~]# cat /etc/samba/smb.conf
[global]
workgroup = SAMBA
security = user
load printers = no
passdb backend = ldapsam:ldap://192.168.0.81
ldap suffix = dc=sybyl,dc=local
ldap user suffix = ou=People
ldap group suffix = ou=Group
ldap admin dn = cn=Manager,dc=sybyl,dc=local
ldap passwd sync = yes
ldap ssl = off
[root@ldap-client ~]#
}}
smb共有をする必要はないので、[global]設定のみかな. 「lda...
#code(nonumber){{
[root@ldap-client ~]# smbpasswd -W
Setting stored password for "cn=Manager,dc=sybyl,dc=local...
New SMB password:
Retype new SMB password:
[root@ldap-client ~]#
}}
その後にsmbデーモンを稼働させ、再度「smbldap-config」を実...
#code(nonumber){{
[root@ldap-client ~]# systemctl start smb
[root@ldap-client ~]# smbldap-config
}}
「smbldap-config」は特段何も修正せず、リターンキーで応答....
その後、一般ユーザでパスワード変更が可能になる
&color(red){*};「smbldap-config」が完了したらsmbデーモン...
#code(nonumber){{
[foo@ldap-client ~]$ smbldap-passwd
Identity validation...
Enter your UNIX password:
Changing UNIX and samba passwords for foo
New password:
Retype new password:
[foo@ldap-client ~]$
}}
これでLDAPのみ参照のノードでもsshログインパスワードとsmb...
rootユーザのパスワード変更には使えないけど一般ユーザのpas...
#code(nonumber){{
[root@c ~]# vi /etc/modulefiles/smbldap-passwd
#%Module1.0
set-alias passwd /usr/sbin/smbldap-passwd
[root@c ~]#
}}
とするとか.
ページ名:
1