MENU
  • VPS(レンタルサーバ)比較
  • ITエンジニアの転職
  • IT技術入門(Engineers.LOG)
カテゴリー
  • IT関連 (623)
    • Bootstrap (2)
    • クラウド (4)
    • サーバー技術 (185)
    • ストレージ (7)
      • NetApp (7)
    • ネットワーク技術 (91)
      • Cisco (36)
      • Juniper (18)
      • 負荷分散装置 (17)
    • パソコン関連 (92)
      • MAC (25)
      • Windows (54)
    • プログラミング (154)
      • Ansible (11)
      • C言語 (23)
      • Python (111)
        • Django (20)
    • 仮想化 (88)
      • Docker (63)
      • VMware (23)
  • VPS (200)
    • ABLENET VPS (16)
    • Amazon Lightsail(VPS) (2)
    • ConoHaVPS (37)
    • mixhostVPS (4)
    • WebARENAIndigo (16)
    • XServerVPS (34)
    • お名前.com VPS (12)
    • さくらのVPS (24)
    • カゴヤクラウドVPS (13)
    • シンVPS (7)
  • レンタルサーバー (56)
    • エックスサーバー (38)
  • 光回線 (8)
  • 技術スキルアップ開発・学習 (7)
    • Envader (2)
    • RareTECH (2)
    • Udemy (3)
もう現役20年超えましたー。経験値ならだれにも負けないエンジニア技術ブログ
インフラエンジニアの技術LOG
  • VPS(レンタルサーバ)比較
  • ITエンジニアの転職
  • IT技術入門(Engineers.LOG)
インフラエンジニアの技術LOG
  • VPS(レンタルサーバ)比較
  • ITエンジニアの転職
  • IT技術入門(Engineers.LOG)
  1. ホーム
  2. IT関連
  3. サーバー技術
  4. FreeRadiusインストールするがradtestがうまくいかないメモ(CentOS)

FreeRadiusインストールするがradtestがうまくいかないメモ(CentOS)

2019 10/31
サーバー技術
2014年3月7日2019年10月31日

Radiusと言ってもぱっとこない人は多いですが、簡単に言うとインターネットに接続するための、認証サーバーです。 すごく簡単に言いました。こんな感じとじぶんは認識しとります。 ということで、インストールからradtestまでの動作確認など、一連の手順をメモしておきます。

目次
安くて高速!高性能VPSで快適開発!
最速5分でサーバー構築
>>>こちらをチェック

エンジニア必見! 技術力を伸ばすVPS徹底比較
>>>VPS比較

Radiusインストール手順

今回はCentOS6でインストールしました。 途中で引っかかってしまったところも回避策をメモっているのでご紹介します。

yumインストールでradiusをインストール

$ yum install freeradius
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
~~~
Total download size: 1.4 M
Installed size: 5.7 M
Is this ok [y/N]: y

~~~
Installed:
freeradius.x86_64 0:2.1.12-4.el6_3

Complete!
#

freeradius_utilsのインストール ※参照先で紹介されているradtestが入っている。

$ yum install freeradius_utils

※インストールされたバージョンを確認

$ rpm -q freeradius
freeradius-2.1.12-4.el6_3.x86_64

FreeRadiusの設定

インストールした後、以下設定を実施

  1. radiusd.conf FreeRadius全体の基本設定
  2. clients.conf 認証、アカウンティング要求を受け付けるRadiusクライアントの設定を定義する
  3. users 認証するユーザ情報を設定する。また、ファイル名はradiusd.confで変更可能

radiusd.confの設定

$ pwd
/etc/raddb
$ ls -la | grep radius*
-rw-r----- 1 root radiusd 27848 10月 3 10:23 2012 radiusd.conf
$ cp radiusd.conf radiusd.origin
$ vi radiusd.conf
# Log authentication requests to the log file.
#
# allowed values: {no, yes}
#
auth = no

#auth = no → yesへ変更

clients.confの設定

$ pwd
/etc/raddb

$ ls -la | grep clients*
-rw-r----- 1 root radiusd 6703 10月 3 10:23 2012 clients.conf

$ cp clients.conf clients.origin
# You can now specify one secret for a network of clients.
# When a client request comes in, the BEST match is chosen.
# i.e. The entry from the smallest possible network.
#
client 1.1.1.1 {
secret = test
shortname = RadiusTest
}
  • client = 認証要求を受け付ける対向機器のIPアドレスを設定(名前解決可能であればドメイン名でOK)
  • secret = クライアント側で設定するパスフレーズ
  • shortname = クライアント側で設定する名前

usersの設定

$ pwd
/etc/raddb


$ ls -la | grep users
-rw-r----- 1 root radiusd 671 10月 3 10:23 2012 acct_users
-rw-r----- 1 root radiusd 984 10月 3 10:23 2012 preproxy_users
-rw-r----- 1 root radiusd 6524 10月 3 10:23 2012 users


$ vi users# Deny access for a specific user. Note that this entry MUST
# be before any other 'Auth-Type' attribute which results in the user
# being authenticated.
#
# Note that there is NO 'Fall-Through' attribute, so the user will not
# be given any additional resources.
#
#lameuser Auth-Type := Reject
# Reply-Message = "Your account has been disabled."

bobo Auth-Type := Local, User-Password =="testbobo"

ユーザーIDを「bobo」、パスワードを”testbobo”としてユーザ登録する

※FreeRadiusの動作確認 テストコマンド

$ radtest ユーザID パスワード 認証先 認証(auth)ポート secretキー

起動及び確認

$ service radiusd start
radiusd を起動中: [ OK ]


$ ps aux | grep radius
radiusd 31244 0.0 0.3 152420 3284 ? Ssl 06:56 0:00 /usr/sbin/radiusd -d /etc/raddb
root 31257 0.0 0.0 107456 916 pts/0 S+ 06:58 0:00 grep radius# service radius status
radius: 認識されていないサービスです。


$ service radiusd status
radiusd (pid 31244) を実行中...

radtest install(初期設定時にはパッケージに入っているが、インストールされていない)

$ yum provides '*/radtest'
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: ftp.nara.wide.ad.jp
* extras: ftp.nara.wide.ad.jp
* updates: ftp.nara.wide.ad.jp

~~~~~

Total download size: 120 k
Installed size: 216 k
Is this ok [y/N]: y

~~~~~

Installed:
freeradius-utils.x86_64 0:2.1.12-4.el6_3

Complete!

radtestがうまくいかない

→/etc/hostsへ機器のアドレスを追記

$ vi /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.10.94 {ホスト名} ←ホスティング機器の場合、認証がうまくいかないときがある為hostsファイルに名義してあげる
~
~

access-rejectで拒否られる

hostsファイルの設定 radiusをインストール・設定する上で、単純な設定ですがまず一番最初に実施することとして、自身のhost名を/etc/hostsファイルに登録する必要がある。 通常のインストールでは問題はないが、ホスティング機器へのインストールなど、後にhost名を変える場合など、少し注意が必要。 hostsに自身の機器を名前解決できないと、認証が失敗することがある。

$ radtest bobo testbobo localhost 0 testing123
Sending Access-Request of id 2 to 127.0.0.1 port 1812
User-Name = "bobo"
User-Password = "testbobo"
NAS-IP-Address = 192.168.10.94
NAS-Port = 0
Message-Authenticator = 0x00000000000000000000000000000000
rad_recv: Access-Reject packet from host 127.0.0.1 port 1812, id=2, length=20

※usersファイルを修正

$bobo Auth-Type := Local, User-Password =="testbobo"
bobo Cleartext-Password := "testbobo" ←こちらに変更

  再度確認。

$ radtest bobo testbobo localhost 0 testing123
Sending Access-Request of id 250 to 127.0.0.1 port 1812
User-Name = "bobo"
User-Password = "testbobo"
NAS-IP-Address = 192.168.10.94
NAS-Port = 0
Message-Authenticator = 0x00000000000000000000000000000000
rad_recv: Access-Accept packet from host 127.0.0.1 port 1812, id=250, length=20
#

※radtestでうまくいった。

まとめ

Radiusはホント最初のころはさっぱりでした。※今もです。 認証サーバなんて何の事かもわからないし、動作もわかりません。 わからなければ、まずは構築してみて動かしてみることが大切です。 じぶんも勉強していきます!

あわせて読みたい
サーバーエンジニアへの構築手順書 サーバエンジニアにおすすめの構築手順をまとめたページです。 サーバ初心者の方。じぶんも初心者なので、そっから目線で構築した設計手順書となっています。 ご興味の...
エンジニアスキルをアップする勉強法

ITエンジニアの開発・検証・学習としてインターネット上で専用のサーバ(VPS)を利用しましょう!
実務経験はVPSで学べます。

あわせて読みたい
現役エンジニアがおすすめするVPSレンタルサーバ比較(高速SSD限定) 格安VPS比較(2025年最新版)

サーバー技術
よかったらシェアしてね!
  • URLをコピーしました!
  • URLをコピーしました!

コメント

コメントする コメントをキャンセル

email confirm*

post date*

日本語が含まれない投稿は無視されますのでご注意ください。(スパム対策)



検索
カテゴリー
新着記事
  • XServerVPS アニメ風 男の子 プログラミングをしている VPSを利用している 楽しそうにしている
    XServerVPSで証明書(SSL)を取得する方法
    2025年3月24日
    XServerVPS
  • レンタルサーバ アニメ風 女の子 楽しんでパソコンをしている 目がキラキラ
    WordPressがレンタルサーバよりVPSで利用する方がおすすめの理由
    2025年3月19日
    VPS
  • VPS レンタルサーバー アニメ風 女の子 プログラミングをしている VPSを利用している 楽しそうにしている
    VPSとクラウドの違いとは?初心者向けにわかりやすく解説
    2025年3月5日
    VPS
  • シンVPS アニメ風 女の子 パソコン プログラミングをしている VPSを利用している 楽しそうにしている
    シンVPSはWindows serverを利用できない。その理由と利用できるOSは?
    2025年3月4日
    シンVPS
  • シンVPS アニメ風 女の子 パソコン プログラミングをしている VPSを利用している 楽しそうにしている
    シンVPSでゲームを利用する環境はあるのか
    2025年3月4日
    シンVPS
  • シンVPS アニメ風 女の子 パソコン プログラミングをしている VPSを利用している 楽しそうにしている
    シンVPSのサイトの表示速度は他社に比べて早いのか?
    2025年3月4日
    シンVPS
目次
目次