{"id":1594,"date":"2016-01-16T17:15:43","date_gmt":"2016-01-16T08:15:43","guid":{"rendered":"http:\/\/www.nightmare-yk.com\/?p=1594"},"modified":"2016-02-23T08:18:26","modified_gmt":"2016-02-22T23:18:26","slug":"centos7-radius%e5%a4%96%e9%83%a8%e3%83%97%e3%83%ad%e3%82%b0%e3%83%a9%e3%83%a0%e5%91%bc%e3%81%b3%e5%87%ba%e3%81%97","status":"publish","type":"post","link":"http:\/\/www.nightmare-yk.com\/?p=1594","title":{"rendered":"CentOS7-RADIUS\u5916\u90e8\u30d7\u30ed\u30b0\u30e9\u30e0\u547c\u3073\u51fa\u3057-"},"content":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306f(^-^*)\/<br \/>\n\u4e88\u544a\u901a\u308a\u3001RADIUS\u306b\u3064\u3044\u3066\u66f8\u3053\u3046\u3068\u601d\u3044\u307e\u3059\u2606\u4eca\u56de\u306f\u3001\u8a8d\u8a3c\u6642\u306e\u5916\u90e8\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u547c\u3073\u51fa\u3057\u306b\u3064\u3044\u3066\u3067\u3059\u266a<br \/>\n\u3067\u306f\u65e9\u901f\uff01<\/p>\n<p>\u307e\u305a\u3001\u5fc5\u8981\u306a\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<\/p>\n<table style=\"table-layout:fixed;\">\n<tr>\n<td>\n<div style=\"overflow-x:auto;\">\n<pre># yum install freeradius-perl<\/pre>\n<\/p><\/div>\n<\/td>\n<\/tr>\n<\/table>\n<p>\u6b21\u306bperl\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u547c\u3073\u51fa\u3059\u3088\u3046\u306b\u8a2d\u5b9a\u3092\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<table style=\"table-layout:fixed;\">\n<tr>\n<td>\n<div style=\"overflow-x:auto;\">\n<pre># cp -p \/etc\/raddb\/sites-available\/default \/etc\/raddb\/sites-available\/default.org\r\n# vi \/etc\/raddb\/sites-available\/default\r\n\uff5e\r\nauthorize {\r\n    perl\r\n    update control {\r\n       Auth-Type := perl\r\n    }\r\n\u30fb\u30fb\u30fb\r\nauthenticate {\r\n        perl\r\n\u30fb\u30fb\u30fb\r\n}<\/pre>\n<\/p><\/div>\n<\/td>\n<\/tr>\n<\/table>\n<p>perl\u306e\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u547c\u3076\u3088\u3046\u306b\u8a2d\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<table style=\"table-layout:fixed;\">\n<tr>\n<td>\n<div style=\"overflow-x:auto;\">\n<pre># cd \/etc\/raddb\/mods-enabled\r\n# ln -s ..\/mods-available\/perl perl\r\n# cp -p \/etc\/raddb\/mods-available\/perl \/etc\/raddb\/mods-available\/perl.org<\/pre>\n<\/p><\/div>\n<\/td>\n<\/tr>\n<\/table>\n<p>\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u30d1\u30b9\u3092\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<table style=\"table-layout:fixed;\">\n<tr>\n<td>\n<div style=\"overflow-x:auto;\">\n<pre># vi \/etc\/raddb\/mods-available\/perl\r\n\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5909\u66f4\r\nfilename = ${modconfdir}\/${.:instance}\/example.pl\r\n\u2193\r\nfilename = ${modconfdir}\/${.:instance}\/test.pl<\/pre>\n<\/p><\/div>\n<\/td>\n<\/tr>\n<\/table>\n<p>\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002example.pl\u3092\u4f8b\u306b\u4f5c\u308b\u3068\u3044\u3044\u304b\u3068\u601d\u3044\u307e\u3059\u266a<br \/>\nperl\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u4e2d\u3067\u306f\u3001\u8a8d\u8a3c\u306e\u30c7\u30fc\u30bf\u3092\u30d5\u30a1\u30a4\u30eb\u306b\u66f8\u304d\u51fa\u3059\u3088\u3046\u306b\u3057\u3066\u3044\u307e\u3059\u3002\u307e\u305f\u3001RLM_MODULE_OK\u3092\u8fd4\u308a\u5024\u306b\u3059\u308b\u3053\u3068\u3067\u3001\u5168\u3066\u8a8d\u8a3cOK\u306b\u3057\u3066\u3044\u307e\u3059(\uff1e\u25bd\uff1c\uff1b\uff1b<\/p>\n<table style=\"table-layout:fixed;\">\n<tr>\n<td>\n<div style=\"overflow-x:auto;\">\n<pre># touch \/etc\/raddb\/mods-config\/perl\/test.pl\r\n# chown root:radiusd \/etc\/raddb\/mods-config\/perl\/kome.pl\r\n# vi \/etc\/raddb\/mods-config\/perl\/test.pl\r\n\uff5e\r\nuse strict;\r\nuse warnings;\r\nuse Data::Dumper;\r\n\r\nour (%RAD_REQUEST, %RAD_REPLY, %RAD_CHECK);\r\n\r\nuse constant {\r\n        RLM_MODULE_REJECT   => 0, # immediately reject the request\r\n        RLM_MODULE_OK       => 2, # the module is OK, continue\r\n        RLM_MODULE_HANDLED  => 3, # the module handled the request, so stop\r\n        RLM_MODULE_INVALID  => 4, # the module considers the request invalid\r\n        RLM_MODULE_USERLOCK => 5, # reject the request (user is locked out)\r\n        RLM_MODULE_NOTFOUND => 6, # user not found\r\n        RLM_MODULE_NOOP     => 7, # module succeeded without doing anything\r\n        RLM_MODULE_UPDATED  => 8, # OK (pairs modified)\r\n        RLM_MODULE_NUMCODES => 9  # How many return codes there are\r\n};\r\n\r\nuse constant    L_DBG=>   1;\r\nuse constant    L_AUTH=>  2;\r\nuse constant    L_INFO=>  3;\r\nuse constant    L_ERR=>   4;\r\nuse constant    L_PROXY=> 5;\r\nuse constant    L_ACCT=>  6;\r\n\r\nsub authorize {\r\n        my $val;\r\n\r\n        open OFP,\">>\/tmp\/test.log\";\r\n        print OFP Dumper(\\%RAD_REQUEST);\r\n        close OFP;\r\n\r\n        return RLM_MODULE_OK;\r\n}\r\n\r\nsub authenticate {\r\n        return RLM_MODULE_OK;\r\n}<\/pre>\n<\/p><\/div>\n<\/td>\n<\/tr>\n<\/table>\n<p>\u8a2d\u5b9a\u3092\u53cd\u6620\u3055\u305b\u307e\u3059\uff01<\/p>\n<table style=\"table-layout:fixed;\">\n<tr>\n<td>\n<div style=\"overflow-x:auto;\">\n<pre># systemctl restart radiusd<\/pre>\n<\/p><\/div>\n<\/td>\n<\/tr>\n<\/table>\n<p>\u5b9f\u969b\u306b\u8a66\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u30fc(\uff1d\u2312\u25bd\u2312\uff1d)<\/p>\n<table style=\"table-layout:fixed;\">\n<tr>\n<td>\n<div style=\"overflow-x:auto;\">\n<pre># radtest test pass localhost:1812 0 testing123\r\n\uff5e\r\nSending Access-Request Id 216 from 0.0.0.0:60941 to 127.0.0.1:1812\r\n        User-Name = 'test'\r\n        User-Password = 'pass'\r\n        NAS-IP-Address = 192.168.8.8\r\n        NAS-Port = 0\r\n        Message-Authenticator = 0x00\r\nReceived Access-Accept Id 216 from 127.0.0.1:1812 to 127.0.0.1:60941 length 20\r\n<\/pre>\n<\/p><\/div>\n<\/td>\n<\/tr>\n<\/table>\n<p>\u30d5\u30a1\u30a4\u30eb\u3092\u898b\u3066\u307f\u307e\u3057\u3087\u3046\u2606<\/p>\n<table style=\"table-layout:fixed;\">\n<tr>\n<td>\n<div style=\"overflow-x:auto;\">\n<pre># cat \/tmp\/test.log\r\n\uff5e\r\n$VAR1 = {\r\n          'User-Name' => 'test',\r\n          'User-Password' => 'pass',\r\n          'NAS-Port' => '0',\r\n          'NAS-IP-Address' => '192.168.8.8',\r\n          'Message-Authenticator' => '0xde3f40c1c067bc9c0e17311e1ef79e16'\r\n        };<\/pre>\n<\/p><\/div>\n<\/td>\n<\/tr>\n<\/table>\n<p>\u304a\u304a\u66f8\u304b\u308c\u3066\u3044\u307e\u3059\u306d\uff01w(*\uff9fo\uff9f*)w<br \/>\nfreeradius-python\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3053\u3068\u3067\u3001python\u3082\u4f7f\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<div class='wp_social_bookmarking_light'>\n            <div class=\"wsbl_facebook_like\"><div id=\"fb-root\"><\/div><fb:like href=\"http:\/\/www.nightmare-yk.com\/?p=1594\" layout=\"button_count\" action=\"like\" width=\"100\" share=\"false\" show_faces=\"false\" ><\/fb:like><\/div>\n            <div class=\"wsbl_google_plus_one\"><g:plusone size=\"medium\" annotation=\"none\" href=\"http:\/\/www.nightmare-yk.com\/?p=1594\" ><\/g:plusone><\/div>\n    <\/div>\n<br class='wp_social_bookmarking_light_clear' \/>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306f(^-^*)\/ \u4e88\u544a\u901a\u308a\u3001RADIUS\u306b\u3064\u3044\u3066\u66f8\u3053\u3046\u3068\u601d\u3044\u307e\u3059\u2606\u4eca\u56de\u306f\u3001\u8a8d\u8a3c\u6642\u306e\u5916\u90e8\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u547c\u3073\u51fa\u3057\u306b\u3064\u3044\u3066\u3067\u3059\u266a \u3067\u306f\u65e9\u901f\uff01 \u307e\u305a\u3001\u5fc5\u8981\u306a\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002 # yum install freeradius-perl \u6b21\u306bperl\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u547c\u3073\u51fa\u3059\u3088\u3046\u306b\u8a2d\u5b9a\u3092\u5909\u66f4\u3057\u307e [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1588,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true},"categories":[3],"tags":[210,291,22,288],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.nightmare-yk.com\/wp-content\/uploads\/2016\/01\/RADIUS-WiFi.jpg?fit=592%2C395","jetpack_likes_enabled":true,"jetpack_sharing_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"http:\/\/www.nightmare-yk.com\/index.php?rest_route=\/wp\/v2\/posts\/1594"}],"collection":[{"href":"http:\/\/www.nightmare-yk.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.nightmare-yk.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.nightmare-yk.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.nightmare-yk.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1594"}],"version-history":[{"count":5,"href":"http:\/\/www.nightmare-yk.com\/index.php?rest_route=\/wp\/v2\/posts\/1594\/revisions"}],"predecessor-version":[{"id":1798,"href":"http:\/\/www.nightmare-yk.com\/index.php?rest_route=\/wp\/v2\/posts\/1594\/revisions\/1798"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.nightmare-yk.com\/index.php?rest_route=\/wp\/v2\/media\/1588"}],"wp:attachment":[{"href":"http:\/\/www.nightmare-yk.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1594"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.nightmare-yk.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1594"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.nightmare-yk.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1594"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}