ユーザ用ツール

サイト用ツール


freebsd:初期設定

FreeBSD12インストール後の初期設定

SSH設定、SSH1は廃止されたのでProtocol 2は不要
# ee /etc/ssh/sshd_config

PermitRootLogin no 		(rootログイン拒否、コメントアウト外す)
PasswordAuthentication yes 	(パスワード認証ログイン許可、変更)
PermitEmptyPasswords no 	(空のパスワードを禁止、コメントアウト外す)
AllowUsers user_name 		(user_nameのみログイン許可、追加)

# /etc/rc.d/sshd restart

# ee /etc/group

wheel:*:0:root,user_name	(user_nameをwheelに所属させる)

セキュリティアップデート
# freebsd-update fetch
# freebsd-update install

portsのアップデート
初回
# portsnap fetch
# portsnap extract
# portsnap update
2回目から
# portsnap fetch
# portsnap update


hosts.allowの設定
・基本的には閉じて必要になったら開ける
・プライベートIPは全開放してるけど、セキュリティ考えたらSSHのみとか分けるのがお勧め
・外部からの接続の場合、jpだけだとログイン出来ない場合があるので注意
・下の方の文章の所は、アクセス者への返答処理なのですべてコメントアウト

# ee /etc/hosts.allow

#ALL : ALL : allow
ALL : 192.168.0. : allow
sshd : .jp : allow
sshd : ALL :deny
#sendmail : ALL : allow
sendmail : ALL : deny
#exim : ALL : allow
exim : ALL : deny
#ftpd : ALL : allow
ftpd : ALL : deny
ALL : ALL : deny

firewallとblacklistの設定
・firewall.confの記述については他のサイトを参考
・firewall_loggingで/var/log/securityにログが出る
・blacklistd_flags=“-r”
 -r、システムを再起動しても再度ルールを適用してブロックを開始
 -f、再起動時に消去

# ee /etc/rc.conf

#sshd
sshd_enable="YES"
sshd_flags="-o UseBlacklist=yes"
#blacklist
blacklistd_enable="YES"
blacklistd_flags="-r"
#firewall
firewall_enable="YES"
firewall_type="/etc/firewall.conf"
firewall_logging="YES"

# touch /etc/ipfw-blacklist.rc
ファイルを作らないとipfwと連携されない

# less /etc/blacklistd.conf
# /etc/rc.d/ipfw start
# /etc/rc.d/ipfw stop
# /etc/rc.d/blacklistd start
# /etc/rc.d/blacklistd stop
確認
# ipfw -a list
# ps awux | grep blacklistd
# blacklistctl dump -ar


その他
・仮想コンソールの数が多いので減らす
# ee /etc/ttys

ttyv1~ttyv7をoff

# kill -HUP 1

・ntpの設定
# ee /etc/ntp.conf

# pool 0.freebsd.pool.ntp.org iburst
pool ntp.jst.mfeed.ad.jp iburst

# ee /etc/rc.conf

ntpd_enable="YES"
freebsd/初期設定.txt · 最終更新: 2022/11/10 10:57 by 管理者

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki