[Osaka/Yokohama] Looking for infrastructure/server side engineers!

[Osaka/Yokohama] Looking for infrastructure/server side engineers!

[Deployed by over 500 companies] AWS construction, operation, maintenance, and monitoring services

[Deployed by over 500 companies] AWS construction, operation, maintenance, and monitoring services

[Successor to CentOS] AlmaLinux OS server construction/migration service

[Successor to CentOS] AlmaLinux OS server construction/migration service

[For WordPress only] Cloud server “Web Speed”

[For WordPress only] Cloud server “Web Speed”

[Cheap] Website security automatic diagnosis “Quick Scanner”

[Cheap] Website security automatic diagnosis “Quick Scanner”

[Reservation system development] EDISONE customization development service

[Reservation system development] EDISONE customization development service

[Registration of 100 URLs is 0 yen] Website monitoring service “Appmill”

[Registration of 100 URLs is 0 yen] Website monitoring service “Appmill”

[Compatible with over 200 countries] Global eSIM “Beyond SIM”

[Compatible with over 200 countries] Global eSIM “Beyond SIM”

[If you are traveling, business trip, or stationed in China] Chinese SIM service “Choco SIM”

[If you are traveling, business trip, or stationed in China] Chinese SIM service “Choco SIM”

[Global exclusive service] Beyond's MSP in North America and China

[Global exclusive service] Beyond's MSP in North America and China

[YouTube] Beyond official channel “Biyomaru Channel”

[YouTube] Beyond official channel “Biyomaru Channel”

【Radius】グローバル経由でRadius認証の検証(radtest)を行ってみた

こんにちは、システム開発部のナガタニです。
今回は、radtest コマンドを使用したグローバル経由でのRadius認証の検証を行う手順について紹介します。

正直やり方自体は特に捻りもなく割と簡単にできるのですが、ネットで調べると基本的にローカル内での検証のやり方しか出てこず...

また、Radius認証ってローカル内で完結するってことはまずありえないし、実際の運用に近い形で検証を行いたかったっていうのもあったので、今回紹介しようと思いました。

用意するもの

  1. FreeRadiusがインストールされたローカルサーバ
  2. FreeRadius, DaloRadius がインストールされたAWSサーバ

1 はradtestコマンドを使えるようにするためだけのサーバーです。
radtestコマンドを使用するには、FreeRadiusをインストールしておく必要があります。

2 は 1 で構築したローカルサーバーからグローバル経由で検証を行うためのRadiusサーバーです。
Radiusアカウントを作成したいので、アカウント管理ができるDaloRadiusをインストールしておきましょう。

今回はAWSでサーバーを構築しておりますが、ほかのプラットフォームでもできますので、自分の好きなものを使用してください。基本的にやり方は同じです。

イメージ的には 1 がRadiusクライアントで 2 がRadiusサーバといった感じになります。

FreeRadiusがインストールされたローカルサーバの構築

構築手順についてはこちらのサイトで分かりやすく書かれていますので、参考にしてください。
また、今回はradtestコマンドを使えるようにするのが目的なので、clientやuserの設定は必要ありません。

FreeRadius, DaloRadius がインストールされたAWSサーバの構築

AWSでEC2インスタンスを立ち上げて、FreeRadiusとDaloRadiusをインストールしておきます。
DaloRadiusのインストール方法はこちらのサイトで分かりやすく書かれていますので、参考にしてください。

RADIUSアカウントを登録する

上記で構築したAWSサーバにRadius認証の検証を行うためのRadiusアカウントを作成します。

DaloRadius 管理画面にログインする

インストールしたDaloRadiusにアクセスしてログインします。

特に弄ってなければ、Username:administrator, Password:radius でログインできます。

アカウントを作成する

1. Management ⇒ New User の順に選択する



2. Username Authentication に Username と password を入力して Apply をクリックする

これでアカウントが作成できました。今回はtestuser, testpassword で作成しています。
また、作成したアカウントは List Users で確認できます。



グローバルIPからの認証を許可するためClientの設定を変更する

今回はグローバルのクライアントから認証を行うため、clients.conf に以下の設定を追記します。

client all {
  ipaddr = 0.0.0.0/0
  secret = testing123
}

0.0.0.0/0 ですべてのIPからの認証を許可しております。
secret キーは今回は testing123 にしておきましょう。
これでRadiusを再起動すれば完了です。

ローカルサーバーからAWSサーバーにRadius認証を行う

これで準備が整いましたので、実際にローカルからAWSサーバに対してRadius認証を行いましょう。
ローカルサーバで以下のradtestコマンドを実行します。

$ radtest testuser testpassword {AWSサーバのIP} 1812 testing123

構成で言うと、

radtest {ユーザ名} {パスワード} {AWSサーバのIP} 1812 {secretキー}

といった形になります。

成功すると、以下のようにAccess-Acceptが返ってきます。

Sent Access-Request Id 43 from 0.0.0.0:48774 to {AWSサーバのIP}:1812 length 78
        User-Name = "testuser"
        User-Password = "testpassword"
        NAS-IP-Address = 127.0.0.1
        NAS-Port = 1812
        Message-Authenticator = 0x00
        Cleartext-Password = "testpassword"

これで、グローバル経由でのRadius認証に成功しました。

Radius認証に失敗する場合

上記のradtestを実行してもレスポンスがなく以下のようにタイムアウトする場合は

(0) No reply from server for ID 43 socket 3

AWSサーバ側の1812ポートにアクセス制限がかかっている可能性があります。

インバウンドルールを編集して1812ポートのUDPを追加しましょう。

まとめ

いかがでしたでしょうか。
まあ、普通にローカルで行っているやり方と基本的に変わりはないので、そんなに難しくなかったと思います。
ただ、意外とこのやり方が載っていなかったので今回は紹介させていただきました。

少しでも参考になれば幸いでございます。

最後に

私が所属するシステム開発のサービスサイト「SEKARAKU Lab(セカラク ラボ)」を開設しました。
ビヨンドは、サーバーの設計・構築から運用までをワンストップでお任せいただけますので、サーバーサイド開発でお困りの方はお気軽にお問い合わせください。
SEKARAKU Lab:[https://sekarakulab.beyondjapan.com/](https://sekarakulab.beyondjapan.com/)

では、以上となります。
ありがとうございました!

この記事がお役に立てば【 いいね 】のご協力をお願いいたします!
2
読み込み中...
2 票, 平均: 1.00 / 12
6,648
X facebook はてなブックマーク pocket
[2024.6.30 CentOS support ended] CentOS server migration solution

[2024.6.30 CentOS support ended] CentOS server migration solution

[2025.6.30 Amazon Linux 2 support ended] Amazon Linux server migration solution

[2025.6.30 Amazon Linux 2 support ended] Amazon Linux server migration solution

[Osaka/Yokohama] Actively recruiting infrastructure engineers and server side engineers!

[Osaka/Yokohama] Actively recruiting infrastructure engineers and server side engineers!

The person who wrote this article

About the author

Tatsuya Hase

Joined Beyond Co., Ltd. as a new graduate.

We develop web systems (development of services and systems that run on browsers, such as web services, digital content, and business management systems) and game APIs (development of programs that communicate with application games).

We also develop private/custom apps for Shopify.

Originally worked at the Osaka office, but transferred to the Yokohama office in 2019.
His hobbies are baseball/karaoke/anime