项目作者: travelping

项目描述 :
Erlang AAA session implementation for erGW
高级语言: Erlang
项目地址: git://github.com/travelping/ergw_aaa.git
创建时间: 2016-09-19T12:00:10Z
项目社区:https://github.com/travelping/ergw_aaa

开源协议:GNU General Public License v2.0

下载


erGW-AAA - AAA component for the erGW project

Build Status
Coverage Status
Erlang Versions

This is a companion project for the erGW project to provide an abstract
AAA (Authentication, Authorization and Accounting) interface for protocols
based on erGW.

Supported backend providers are:

  • a local dummy (mock)
  • RADIUS

Work on progress:

  • DIAMETER
  • flexible configuration
  • the dropped attribute_map feature might be readded

In the future possible other providers are:

  • LDAP (Authentication and Authorization only)

TERMINATION CAUSE MAPPING

When ergw needs to terminate an AAA session, the termination reasons to be included in those messages (e.g. CCR-T or ACR stop in diameter and Accounting-Request stop in Radius) are provided by the ergw to the ergw_aaa in the session data in the format of atoms.
Each AAA handler can have a mapping configured to map these to termination causes of the corresponding protocol/interface.
See RFCs: RFC2866, RFC3588.
An example of this mapping:

  1. %% DIAMETER config example
  2. % ...
  3. {handlers, [
  4. % ...
  5. {ergw_aaa_ro, [
  6. {function, 'ergw-pgw-epc-ro'},
  7. {'Destination-Realm', <<"test.apn.net">>},
  8. {termination_cause_mapping, [
  9. {normal, 1},
  10. {administrative, 4},
  11. {link_broken, 5},
  12. {upf_failure, 5},
  13. {remote_failure, 1},
  14. {cp_inactivity_timeout, 1},
  15. {up_inactivity_timeout, 1},
  16. {peer_restart, 1},
  17. {'ASR', 1},
  18. {error, 1},
  19. {timeout, 1},
  20. {conn_error, 1},
  21. {rate_limit, 1},
  22. {ocs_hold_end, 1},
  23. {peer_reject, 1}
  24. ]}
  25. ]}
  26. % ...
  27. ]},
  28. %...
  1. % RADIUS config example
  2. % ...
  3. {ergw_aaa_radius, [
  4. {server, {{192,168,255,1}, 1813, <<"radproxy">>}},
  5. {termination_cause_mapping, [
  6. {normal, 1},
  7. {administrative, 6},
  8. {link_broken, 2},
  9. {upf_failure, 9},
  10. {remote_failure, 9},
  11. {cp_inactivity_timeout, 4},
  12. {up_inactivity_timeout, 4},
  13. {peer_restart, 7},
  14. {'ASR', 6},
  15. {error, 9},
  16. {timeout, 4},
  17. {conn_error, 10},
  18. {rate_limit, 10},
  19. {ocs_hold_end, 10},
  20. {peer_reject, 10}
  21. ]}
  22. ]}
  23. % ...

BUILDING

Using rebar3:

  1. # rebar3 compile

CONFIGURATION

For all releases in the 3.x stream, the configuration syntax might change at
any point and might not be backward compatible.

Example of possible config.

  1. {ergw_aaa,
  2. [{functions,
  3. [{'ergw-pgw-epc',
  4. [{handler, ergw_aaa_diameter},
  5. {'Origin-Host', <<"ergw-pgw.dia.example.net">>},
  6. {'Origin-Realm', <<"dia.example.net">>},
  7. {transports, [
  8. [{connect_to, <<"aaa://srv1.dia.example.net;transport=sctp">>},
  9. {recbuf, 32768}]
  10. ]},
  11. ]}
  12. ]},
  13. {handlers,
  14. [{ergw_aaa_static,
  15. [{'NAS-Identifier', <<"NAS-Identifier">>},
  16. {'Acct-Interim-Interval', 600},
  17. {'Framed-Protocol', 'PPP'},
  18. {'Service-Type', 'Framed-User'},
  19. {'Node-Id', <<"PGW-001">>},
  20. {'Charging-Rule-Base-Name', <<"m2m0001">>},
  21. {rules, #{'Default' =>
  22. #{'Rating-Group' => [3000],
  23. 'Flow-Information' =>
  24. [#{'Flow-Description' => [<<"permit out ip from any to assigned">>],
  25. 'Flow-Direction' => [1] %% DownLink
  26. },
  27. #{'Flow-Description' => [<<"permit out ip from any to assigned">>],
  28. 'Flow-Direction' => [2] %% UpLink
  29. }],
  30. 'Metering-Method' => [1],
  31. 'Precedence' => [100]
  32. }
  33. }
  34. }
  35. ]},
  36. {ergw_aaa_radius, [
  37. {server, {{127,0,0,1}, 1812, <<"secret">>}},
  38. {termination_cause_mapping, [
  39. {normal, 1},
  40. {administrative, 6},
  41. {link_broken, 2},
  42. {upf_failure, 9},
  43. {remote_failure, 9},
  44. {cp_inactivity_timeout, 4},
  45. {up_inactivity_timeout, 4},
  46. {peer_restart, 7},
  47. {'ASR', 6},
  48. {error, 9},
  49. {timeout, 4},
  50. {conn_error, 10},
  51. {rate_limit, 10},
  52. {ocs_hold_end, 10},
  53. {peer_reject, 10}
  54. ]}
  55. ]},
  56. {ergw_aaa_rf, [{transport, 'ergw-pgw-epc'}]},
  57. {ergw_aaa_ro, [
  58. {transport, 'ergw-pgw-epc'},
  59. {termination_cause_mapping, [
  60. {normal, 1},
  61. {administrative, 4},
  62. {link_broken, 5},
  63. {upf_failure, 5},
  64. {remote_failure, 1},
  65. {cp_inactivity_timeout, 1},
  66. {up_inactivity_timeout, 1},
  67. {peer_restart, 1},
  68. {'ASR', 1},
  69. {error, 1},
  70. {timeout, 1},
  71. {conn_error, 1},
  72. {rate_limit, 1},
  73. {ocs_hold_end, 1},
  74. {peer_reject, 1}
  75. ]}
  76. ]}
  77. ]},
  78. {services,
  79. [{'Default', [{handler, 'ergw_aaa_static'}]},
  80. {'RADIUS-Auth', [{handler, 'ergw_aaa_radius'},
  81. {server, {{127,1,0,1}, 1812, <<"secret">>}}]},
  82. {'RADIUS-Acct', [{handler, 'ergw_aaa_radius'},
  83. {server, {{127,2,0,1}, 1813, <<"secret">>}}]},
  84. {'Rf', [{handler, 'ergw_aaa_rf'}]},
  85. {'Gx', [{handler, 'ergw_aaa_gx'}]}
  86. {'Gy', [{handler, 'ergw_aaa_ro'}]}
  87. ]},
  88. {apps,
  89. [ {'Origin-Host', <<"local.host">>},
  90. {procedures,
  91. [{default,
  92. [{session, ['Default']},
  93. {procedures, [{authenticate, ['RADIUS-Auth']},
  94. {authorize, ['RADIUS-Auth']},
  95. {start, ['RADIUS-Acct', 'Rf']},
  96. {interim, ['RADIUS-Acct', 'Rf']},
  97. {stop, ['RADIUS-Acct', 'Rf']},
  98. {{gx, 'CCR-Initial'}, ['Gx']},
  99. {{gx, 'CCR-Update'}, ['Gx']},
  100. {{gx, 'CCR-Terminate'}, ['Gx']},
  101. {{gy, 'CCR-Initial'}, ['Gy']},
  102. {{gy, 'CCR-Update'}, ['Gy']},
  103. {{gy, 'CCR-Terminate'}, ['Gy']}]}
  104. ]}
  105. ]}
  106. ]}
  107. ]},