Difference between revisions of "Blacklist or whitelist"

From AllStarLink Wiki
Jump to navigation Jump to search
Line 12: Line 12:
** <code>*CLI> database show</code>
** <code>*CLI> database show</code>
''Note'': WA3DSP [https://hamvoip.org/downloads/node-ban-allow.sh menu script] for above commands.  
''Note'': WA3DSP wrote a [https://hamvoip.org/downloads/node-ban-allow.sh menu script] for above commands.  
==Blacklist Configuration==
==Blacklist Configuration==

Revision as of 23:04, 16 October 2017

Occasionally it becomes necessary to limit connections to your node. With this configuration you can either blacklist (block) or whitelist (allow) inbound connections. Outbound connections are not blocked. The lists are managed with these Asterisk CLI commands:

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

Note: WA3DSP wrote a menu script for above commands.

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

Note: Only one list can be used at a same time and it applies to all nodes on the server. If using the whitelist all nodes on the local server ( are allowed.