カテゴリーごとに、下記のページを参照して下さい
CentOS 6 のインストールについて
CentOS 6 からはSELinux機能がインストール時に、標準ではON(稼働する)状態でインストールされます。さまざまプログラムでセキュリティ制限など、影響が出る場合はSELinuxをOFFに設定して再起動します。
/etc/sysconfig/selinux の中で SELINUX=disabled で設定
もしくは、インストール時のCentOS ロゴ画面で、[Esc]ボタンを押し、 boot: selinux --disabled でインストール実行
# yum groupinstall "Japanese Support" # vim /etc/sysconfig/i18n LANG="ja_JP.UTF-8"
再起動が好ましい
環境: (CentOS のバーション不明)
/etc/named.conf
新規ドメイン名を登録
/var/named/
/var/named/chroot/var/named
新規ドメインのzoneファイル作成
[root@pori named]# /etc/init.d/named restart
named を停止中: [ OK ]
named を起動中: [ OK ]
OpenLDAPはTCP/IPで実装されたディレクトリサービス用のプロトコル、LDAP(Lightweight Directory Access Protocol)のオープンソースソフトウェア版です。
LDAPのバージョン2とバージョン3の両方のプロトコルに対応しており、汎用性があります。
開発は OpenLDAP Foundationが運営するOpenLDAP Projectで行われております。
DN (Disingunished Name) : 各エントリーで持っているユニークな名前の属性
RDN (Relative Distingunished Name) : エントリ検索を容易にするたに、上位のエントリ名を含まない名前の属性
objectClass : エントリに設定する必要がある属性、もしくは設定することができる特別な属性
スキーマ定義 : objectClassの定義
dc (DOmain Component) : ドメインの構成要素
o (Organization) : 組織名
ou (Organization Unit) : 組織の単位
cn (Common Name) : 一般の名称
環境: CentOS 6.4 の場合 Sambaとの連携を想定
1)パッケージのインストール openldap-servers openldap-clients です。
openldapは一般的にデフォルトでインストール済が多い、libtool-ltdlはopenldap-clientsの依存パッケージです 。
# yum install openldap-servers openldap-clients
2)設定用ディレクトリのパスワード作成
# slappasswd
/etc/openldap/slapd.conf/cn=config/olcDatabase={0}config.ldif ファイルを開いて、oclRootPW として作成したパスワードを記入し保存します。
3)データベースチューニングのための設定ファイル
# cp -ar /usr/share/openldap-servers/DB_CONFIG.example /var/lib/ldap/DB_CONFIG
# chown -R ldap:ldap /var/lib/ldap/DB_CONFIG
4)設定ファイルの作成
/etc/openldap に slapd.conf を作成し、 slappasswdコマンドで作成したパスワードを記入し保存します。
5)LDAPサービスの起動
# service slapd start もしくは # /etc/rc.d/init.d/slapd start
LDAPサービスの制御スクリプト引数として start stop status restart condrestart configtest
6)LDAPデータベースの基本設定
基本設定の確認 -D オプションでルートDNを指定し DN(cn=config))配下のエントリに対して検索します。
# ldapsearch -x -LLL -D 'cn=config' -W -b 'cn=config' '(olcDatabase={1}bdb)'
もしくは
# ldapsearch -x -LLL -D 'cn=config' -W -b 'cn=config' '(objectClass=*)'
結果の内容から /var/lib/ldap/ にデータが保存され、olcSuffixでLDAPデータベースツリーのDN、olcRootDNでLDAPサーバの管理用アクセス権のある特権DNの設定が確認出来ます。
olcRootPWは設定されていません。
7)データ用ディレクトリの管理情報を変更
データ変更用のLDIFファイル(bdb-init.ldif)を作成します。 以下のように、 DN名やolcDatabase={ } などは調整して下さい
dn: olcDatabase={2}bdb,cn=config
changetype: modify
replace: olcRootDN
olcRootDN: cn=Manager,dc=sambadom1,dc=local
-
replace: olcSuffix
olcSuffix: dc=sambadom1,dc=local
-
add: olcRootPW
olcRootPW: {SSHA}xxxxxxxxxxxxxxxxxxxxxxxxxxx
8)LDAPサーバで管理するデータを登録
以下のサンプルldifファイルはSambaとOpenLDAPとの連携をするときを想定した内容です。実際の運用環境に合わせて調整します。
組織、グループ、ユーザアカウントの基本となるLDAPデータ
dn: dc=sambadom1,dc=local
objectClass: top
objectClass: dcObject
objectClass: organization
o: dc=sambadom1,dc=local
dc: sambadom1
dn: cn=Manager,dc=sambadom1,dc=local
objectClass: organizationalRole
cn: Manager
dn: ou=users,dc=sambadom1,dc=local
objectClass: top
objectClass: organizationalUnit
ou: users
dn: ou=groups,dc=sambadom1,dc=local
objectClass: top
objectClass: organizationalUnit
ou: groups
dn: ou=idmap,dc=sambadom1,dc=local
objectClass: top
objectClass: organizationalUnit
ou: idmap
dn: ou=computers,dc=sambadom1,dc=local
objectClass: top
objectClass: organizationalUnit
ou: computers
グループのアカウントに関するLDAPデータ
Sambaとの連携ではSambaデータベースからデータを移行します。
ユーザーのアカウントのLDAPデータ
Sambaとの連携ではSambaデータベースからデータを移行します。
データアクセスの制御
/etc/openldap/slapd.d/cn=config/olcDatabase={1}dbd.cn=config ファイルで dn名やその他の設定を調整します。
9)slapd.confの設定
/etc/openldap/slapd.conf ファイルをSamba用に設定する 詳細は別途
Sambaのスキーマ( /usr/share/doc/samba-3.6.9/LDAP/samba.schema )を /etc/openldap/schema へコピー
10)Linux認証のLDAP化
UNIXユーザの情報もLDAPに格納するプログラム nss-pam-ldapd pam_ldap nscd をインストール
# yum install nss-pam-ldapd nscd pam_ldap
# authconfig --enableldap --enableldapauth --ldapserver=127.0.0.1 --ldapbasedn=dc=sambadom1,dc=local --update
11)Winbindの設定と起動 # authconfig --enablewinbindauth --update
nscdは二重キャッシュになるのでサービスを停止
12)net sam provision コマンドでSamba用の初期ユーザやグループを作成
環境: Debian の場合
ここのページを参考にします >> ここから
olcRootPW を olcDatabase={0}config.lfid に編集して追加します。 olcDatabase{2}bdb.ldif には必要ありません。
再インストールする場合
OpenLDAP Server を再インストールするときなどは、 /var/lib/ldap 以下のOpenLDAPのBDBデータを削除するか、別の場所に新規保存するようにします。
どちらの場合もDB_CONFIGファイルを新規設定します。
また、/etc/openldap のディレクトリも削除されているか確認します。
LDAPデータベースのバックアップ
CentOS 6.4 でアーカイブする場合 (下記の手順では、キャッシュ用の一時ファイルは削除しています)
# service slapd stop # cd /var/lib/ldap # tar cvzf /var/lib/ldap_backup.tar.gz --exclude __db.* /var/lib/ldap/ # service slapd start
CentOS 6.4 でLDIFファイルに書き出す場合もLDAPデータベースは停止した状態で実行します。
CentOSの場合 phpldapadmin のダウンロードとインストール(標準レポジトリにはないので外部レポジトリからダウンロード)
# yum install phpldapadmin
/etc/httpd/conf.d/phpldapadmin.conf を編集し、 Allow from 127.0.0.1 の行に アクセスするネットワーク、例えば 192.168.0.0/24 を追加
/etc/phpldapadmin/config.php を編集し、以下の内容に修正する。
397行をコメントアウトし 398行をコメントに設定する
$servers->setValue('login','attr','dn');
//$servers->setValue('login','attr','uid');
ブラウザから localhost/ldapadmin で起動
1)LDAPサーバのログファシリティとログレベルの調整
/etc/sysconfig/ldap ファイルを編集します SLAPD_OPTIONS="-l local4 -s 512" を挿入します。
デバックレベルは必要に応じて増減します
例えば 512 は送られたエントリのステータス
2048 はエントリの解析処理
65535 ですべてのレベルを表示
2)/etc/rsyslog.conf ファイルに以下の行を追加します
local4.* /var/log/slapd.log
3)念のためにrsyslog とOpenLDAPの再起動後、ログの確認
# service rsyslog restart # service slapd restart # cat /var/log/slapd.log
LAM (Ldap Account Manager) Webブラウザで管理できる 開発元のサイト
GOsa2 LDAPデータベースでアカウントやシステムを管理できるフレームワーク 開発元のサイト
Webmin Linuxのシステム管理ツールで、LDAP、SAMBAもサポート
LDAP Admin WindowsベースのLDAP管理ツール SAMABも対応
Apache Directory Studio Apache FoundationのLDAPプロジェクトとして開発されている 開発元のサイト
OpenLDAPとSambaを連携するツールです。
CentOS 5.4 の場合 参考サイト http://www.oss-d.net/samba-openldap
CentOS 5.3 でテストしました。 smbldap-populate でLDAPデータベース初期化する前に、以下の項目を調整します。
NetBIOS名やサーバ名の定義を、テスト環境のサーバ名に変更します。
DN名 dc=oss,dc=dip,dc=jp で統一させる
smb.conf ファイルで [global] を追加する。 さらに、home netlogin profiles public などのディレクトリを変更する、たとえば /home/sambaを作成して。 profile acls = yes は設定しない。
smb.conf ファイル作成後、smbpasswd -w ldapadmin の実行。 SambaからLDAPディレクトリへのアクセスで使用する「ldap admin dn」 で指定したDNのパスワード(ldapadmin)を格納します。
smbldap_bind.conf では、slavePW と masterPW をテキスト ldapadmin で入力
slapd.conf ファイルの rootpw はslappasswd コマンドで作成した ldapadmin をSSHA形式で記入する。 また、 index のところは index sambaSID eq というⅠ行だけ追加します。
samba は起動しない状態で、smbldap-populate コマンドを実行します。
一般的にTelnetサーバは起動しないように設定をしますが、ローカルホスト経由でログインや通信のテスト環境として運用する場合があります。 あくまでもテスト環境だけとします。
CentOS 6.4 の場合
Telnet サーバのインストール yum install telnet-server telnet
Telnetサーバが起動できるように設定 vim /etc/xinetd.d/telnet disable=yesをdisable=no に変更
ファイヤーウォールの設定も忘れず GUIで設定するか ファイルを編集する /etc/sysconfig/iptables
23番portを通しておく。以下の1行があればOK。
-A RH-Firewall-1-INPUT -m state -state NEW -m tcp -p tcp -dport 23 -j ACCEPT
サービスの再起動 /etc/rc.d/init.d/xinetd restart
動作確認は telnet 192.168.0.161
環境: CentOS 6.4 の場合
1) インストール yum -y install tigervnc-server
2) 起動、スタータスなどの確認 /etc/rc.d/init.d/vncserver start /etc/rc.d/init.d/vncserver status
3) 必要ならば、設定変更 /etc/sysconfig/vncservers を編集 以下の内容を最後の行に追加
解像度は 1600x1200 1920x1080 1920x1200 など
4) パスワードの設定 root権限で vncpasswd コマンドで設定
5) ファイアーウォールの設定
システム->管理->ファイアウォールで、ポート 5900-5910 をオープンします。
6) 起動は /etc/rc.d/init.d/vncserver start または sudo vncserver :1
もし解像度を指定する場合は vncserver -geometry 1920x1080 :1
停止 sudo vncserver -kill :1
yumを使用する場合、標準のレポジトリは /etc/yum.repos.d/ で定義されております。
デフォルトレポジトリ以外のレポジトリを参照させる場合、外部レポジトリごとにインストールします。 EPELというレポジトリを取り込む場合は
CentOS 6 の64ビット版をダウンロード
wget http://ftp-srv2.kddilabs.jp/Linux/distributions/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
RPMでインストール
rpm -ivh epel-release-6-8.noarch.rpm
インストールは /etc/yum.repos.d/epel.repo というファイルを作成します。 もしデフォルトでEPELレポジトリが起動しない場合は、そのファイル内で enabled=1 と設定します。
環境: CentOS 6.4 の場合
List of Commands:
check Check for problems in the rpmdb
check-update Check for available package updates
clean Remove cached data
deplist List a package's dependencies
distribution-synchronization Synchronize installed packages to the latest available versions
downgrade downgrade a package
erase Remove a package or packages from your system
groupinfo Display details about a package group
groupinstall Install the packages in a group on your system
grouplist List available package groups
groupremove Remove the packages in a group from your system
help Display a helpful usage message
history Display, or use, the transaction history
info Display details about a package or group of packages
install Install a package or packages on your system
list List a package or groups of packages
load-transaction load a saved transaction from filename
makecache Generate the metadata cache
provides Find what package provides the given value
reinstall reinstall a package
repolist Display the configured software repositories
resolvedep Determine which package provides the given dependency
search Search package details for the given string
shell Run an interactive yum shell
update Update a package or packages on your system
update-minimal Works like update, but goes to the 'newest' package match which fixes a problem that affects your system
updateinfo Acts on repository update information
upgrade Update packages taking obsoletes into account
version Display a version for the machine and/or available repos.
Options:
-h, --help show this help message and exit
-t, --tolerant be tolerant of errors
-C, --cacheonly run entirely from system cache, don't update cache
-c [config file], --config=[config file]
config file location
-R [minutes], --randomwait=[minutes]
maximum command wait time
-d [debug level], --debuglevel=[debug level]
debugging output level
--showduplicates show duplicates, in repos, in list/search commands
-e [error level], --errorlevel=[error level]
error output level
--rpmverbosity=[debug level name]
debugging output level for rpm
-q, --quiet quiet operation
-v, --verbose verbose operation
-y, --assumeyes answer yes for all questions
--version show Yum version and exit
--installroot=[path] set install root
--enablerepo=[repo] enable one or more repositories (wildcards allowed)
--disablerepo=[repo] disable one or more repositories (wildcards allowed)
-x [package], --exclude=[package]
exclude package(s) by name or glob
--disableexcludes=[repo]
disable exclude from main, for a repo or for
everything
--obsoletes enable obsoletes processing during updates
--noplugins disable Yum plugins
--nogpgcheck disable gpg signature checking
--disableplugin=[plugin]
disable plugins by name
--enableplugin=[plugin]
enable plugins by name
--skip-broken skip packages with depsolving problems
--color=COLOR control whether color is used
--releasever=RELEASEVER
set value of $releasever in yum config and repo files
--setopt=SETOPTS set arbitrary config and repo options
Plugin Options:
--security Include security relevant packages
--bugfixes Include bugfix relevant packages
--cve=CVE Include packages needed to fix the given CVE
--bz=BZ Include packages needed to fix the given BZ
--sec-severity=SEVERITY
Include security relevant packages, of this severity
--advisory=ADVISORY
Include packages needed to fix the given advisory
環境: CentOS 6.4 の場合
もしsudoパッケージがインストールされていない場合は yum -y install sudo でインストールします。
root権限で visudo を実行し、最後に追加 ユーザー名 ALL = NOPASSWD: ALL と追加します。
ファイル作成時に日付をファイル名に付加する
tar cvfz `date +%Y%m%d_%H%M`.tar.gz ターゲットファイル <- 2019年2月2日15時34分の場合 20190202_1534