FreeIPAでアカウント管理を敷いたシステムにて smb共有 を提供してみる

FreeIPA自体はsamba-adのようにディレクトリ管理ができて smb共有 のアクセス管理も含めることが可能です.
FreeIPA参加済 計算ノード へのパスワード認証、smb共有先へのパスワード認証が一元管理され1つのパスワードで行えます.

ただ、、smb共有へのアクセスを可能にするには、windows/macOSらクライアントをわざわざ FreeIPA の傘下に入る必要がある. 認証がkerberosチケットで行われるので
windows/macOSからのsshログインにFreeIPA参加は不要です. SSOで行いたいのなら必要

クライアントのFreeIPA参加が面倒なら
計算ノードへの認証はFreeIPAのパスワードで行い、smb共有にはスタンドアローンのsambaのパスワードで行う事も可能です パスワードの二重管理になりますが

2025y05m20d_194616848.png

ここではsmb共有を提供するマシン(freeipa-smb)にsshはFreeIPAのパスワード、smb共有にはsambaのパスワードを使用するノードを作ります

freeIPAへの参加

sshはFreeIPAサーバが提供する認証を使うので、freeipa-smbはFreeIPA/clientのように freeipa に参加させる

[root@freeipa-smb ~]# cat /etc/redhat-release
Rocky Linux release 9.5 (Blue Onyx)
 
[root@freeipa-smb ~]# hostname -s
freeipa-smb
[root@freeipa-smb ~]# hostname -f
freeipa-smb.sybyl.local
[root@freeipa-smb ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
 
[root@freeipa-smb ~]# echo "server c.sybyl.local" > /etc/chrony.conf
[root@freeipa-smb ~]# systemctl restart chronyd
 
[root@freeipa-smb ~]# dnf install ipa-client -y
 
[root@freeipa-smb ~]# ipa-client-install --no-ntp
This program will set up IPA client.
Version 4.12.2
 
Discovery was successful!
Client hostname: freeipa-smb.sybyl.local
Realm: SYBYL.LOCAL
DNS Domain: sybyl.local
IPA Server: freeipa.sybyl.local
BaseDN: dc=sybyl,dc=local
 
Continue to configure the system with these values? [no]: yes   <-- この構成で続けるので「yes」
Skipping chrony configuration
User authorized to enroll computers: admin                     <--- freeipaとつないでチケットをもらうのですが、そのアカウントを指定
Password for admin@SYBYL.LOCAL:                                <--- 「admin@SYBYL.LOCAL」のチケットをもらうためにパスワードを入力
Successfully retrieved CA cert
    Subject:     CN=Certificate Authority,O=SYBYL.LOCAL
    Issuer:      CN=Certificate Authority,O=SYBYL.LOCAL
    Valid From:  2025-05-13 18:35:30+00:00
    Valid Until: 2045-05-13 18:35:30+00:00
 :
Client configuration complete.
The ipa-client-install command was successful
[root@freeipa-smb ~]#

/homeと/dataを共有へ

[root@freeipa-smb ~]# parted /dev/sdb
GNU Parted 3.5
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mklabel gpt
(parted) mkpart primary 0% 100%
(parted) quit
Information: You may need to update /etc/fstab.
 
[root@freeipa-smb ~]#
[root@freeipa-smb ~]# parted /dev/sdc
 :
[root@freeipa-smb ~]# 
[root@freeipa-smb ~]# mkfs.xfs -L home /dev/sdb1
[root@freeipa-smb ~]# mkfs.xfs -L data /dev/sdc1
[root@freeipa-smb ~]# mkdir /data
 
[root@freeipa-smb ~]# echo "LABEL=home /home xfs defaults 0 0" >> /etc/fstab
[root@freeipa-smb ~]# echo "LABEL=data /data xfs defaults 0 0" >> /etc/fstab
 
[root@freeipa-smb ~]# systemctl daemon-reload
[root@freeipa-smb ~]# mount -a

ユーザフォルダ作成

[root@freeipa-smb ~]# mkhomedir_helper arcueid 0022 /etc/skel
[root@freeipa-smb ~]# mkdir /data/em
[root@freeipa-smb ~]# setfacl  -m group:em:rwx /data/em
[root@freeipa-smb ~]# setfacl -dm group:em:rwx /data/em

SELinux対応

[root@freeipa-smb ~]# setsebool -P use_nfs_home_dirs 1
[root@freeipa-smb ~]# restorecon -R  /home
 
[root@freeipa-smb ~]# setsebool -P samba_export_all_ro=1 samba_export_all_rw=1
[root@freeipa-smb ~]# semanage fcontext -a -t samba_share_t "/data/(.*)?"
[root@freeipa-smb ~]# restorecon -R -v /data

smb設定

[root@freeipa-smb ~]# dnf install samba
[root@freeipa-smb ~]# vi /etc/samba/smb.conf
[global]
        workgroup = SAMBA
        security = user
        passdb backend = tdbsam
[homes]
        comment = Home Directories
        valid users = %S, %D%w%S
        browseable = No
        read only = No
        inherit acls = Yes
[data]
        path = /data
        browseable = Yes
        read only = No
        inherit acls = Yes
 
[root@freeipa-smb ~]# systemctl start smb
[root@freeipa-smb ~]# firewall-cmd --add-service=samba --permanent
[root@freeipa-smb ~]# firewall-cmd --reload

smbアカウントの作成

[root@freeipa-smb ~]# smbpasswd -a arcueid

smbアクセス

ホスト名でははアクセス拒否された。でもFQDNならアクセスできた。ipアドレスでもアクセスできた。

sshアクセス

他のマシンから「ssh -l arcueid freeipa-smb」でアクセスできました。

最新の60件
2025-06-18 2025-06-17 2025-06-15 2025-06-14 2025-06-11 2025-06-09 2025-06-08 2025-06-07 2025-06-05 2025-06-02 2025-06-01 2025-05-31 2025-05-30 2025-05-25 2025-05-22 2025-05-21 2025-05-20 2025-05-18 2025-05-17 2025-05-14 2025-05-13 2025-05-12 2025-05-11 2025-05-08 2025-05-07 2025-05-06 2025-05-05 2025-05-04 2025-05-03 2025-04-27 2025-04-26 2025-04-25 2025-04-24

edit


トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2025-05-20 (火) 19:47:14