Blacklist or whitelist

From AllStarLink Wiki
Revision as of 19:58, 15 October 2017 by imported>Wd6awp
Jump to navigation Jump to search

Occasionally it becomes necessary to limit connections to your node. The blacklist is used block a small number of nodes. The whitelist allows only listed notes to connect.

It's very easy to manage both list with these Asterisk CLI commands:

  • Blacklist
    • database put blacklist 1998 "any comment"
    • database del blacklist 1998
    • database show blacklist
  • Whitelist
    • database put whitelist 1000 "any comment"
    • database del whitelist 1000
    • database show whitelist
  • Both
    • database show

Blacklist Configuration

Add this to extensions.conf just below the [radio-secure] context.


; To add a node to the blacklist: 
; database put blacklist 1998 “any comment”
; to remove:
; database del blacklist 1998
; to list
; database show blacklist
exten => _XXXX!,1,NoOp(${CALLERID(num)})
exten => _XXXX!,n,GotoIf($[${DB_EXISTS(blacklist/${CALLERID(num)})}]?blocked)
exten => _XXXX!,n,Goto(radio-secure,${EXTEN},1)
exten => _XXXX!,n(blocked),Hangup

exten => _XXXX!,1,NoOp(${CALLERID(num)})
exten => _XXXX!,n,GotoIf($["${IAXPEER(CURRENTCHANNEL)}" = ""]?radio-secure,${EXTEN},1)  ;permit local IPs
exten => _XXXX!,n,GotoIf($[${DB_EXISTS(whitelist/${CALLERID(num)})}]?radio-secure,${EXTEN},1)
exten => _XXXX!,n,Hangup

In iax.conf modify the [radio] context by adding and/or commenting context = lines.

type = user
disallow = all
allow = ulaw
allow = adpcm
allow = gsm
codecpriority = host
;context = radio-secure
;context = whitelist
context = blacklist
transfer = no

Notes: Neither list blocks outbound connections. Both lists cannot be used at the same time and apply to all nodes on the server.