• Hey Guest, we're evolving the future of TeaSpeak.
    You're invited to join the discussion here!

Server Hello I don’t want some countries to log in to my Teaspeak server. How can I prevent them?

heartles39

Fanatic member
Hello
I don’t want some countries to log in to my Teaspeak server. How can I prevent them?
 
Last edited:

Vafin

TeaFanatic
Perhaps you will find the answer in this topic
 

Kevinos

Fanatic member
Premium User
You can use this php script, you can modify it to block certain countries easily
.

PHP:
<?php
require("ts3admin.class.php");

// Ignorowane grupy / Ignore groups
$ignorowana_grupa = 69;

$powod_kicka = "Wykryto VPN. Wyjdź z VPN żeby móc korzystać normalnie z serwera."; // Kick Information
$login_query = "serveradmin"; //login query
$haslo_query = "123456789"; //password query
$adres_ip = "127.0.0.1"; //address ip server
$query_port = "10011"; //port query
$port_serwera = "9987"; //server port
$nazwa_bota = "VPN_GUARD"; //name bot

$ts = new ts3Admin($adres_ip, $query_port);

if(!$ts->getElement('success', $ts->connect()))  {
      die("Brak polaczenia z serwerem..");
}

$ts->login($login_query, $haslo_query);

$ts->selectServer($port_serwera);

$ts->setName($nazwa_bota);

while(true) {
sleep(1);
$clientList = $ts->clientList("-ip -groups");



foreach($clientList['data'] as $val) {


$groups = explode(",", $val['client_servergroups'] );

if(in_array($ignorowana_grupa, $groups) || ($val['client_type'] == 1)) {
continue;
}

$file = file_get_contents('http://iphub.info/api.php?ip='.$val['connection_client_ip'].'&showtype=4');
$file = json_decode($file, true);
if($file['proxy'] == 1) {
$ts->clientKick($val['clid'], "server", $powod_kicka);
}
}
}
?>
Normally change this line to =>>

PHP:
$file = file_get_contents('http://iphub.info/api.php?ip='.$val['connection_client_ip'].'&showtype=4');

too $file = file_get_contents('http://ip-api.com/json/'.$val['connection_client_ip']);

if($file['proxy'] == 1) {
   
too if($file['country'] == "Canada") {
I'm sorry I don't have a server to try
 
Last edited:

otalportista

Fanatic member
You can use this php script, you can modify it to block certain countries easily
.

PHP:
<?php
require("ts3admin.class.php");

// Ignorowane grupy / Ignore groups
$ignorowana_grupa = 69;

$powod_kicka = "Wykryto VPN. Wyjdź z VPN żeby móc korzystać normalnie z serwera."; // Kick Information
$login_query = "serveradmin"; //login query
$haslo_query = "123456789"; //password query
$adres_ip = "127.0.0.1"; //address ip server
$query_port = "10011"; //port query
$port_serwera = "9987"; //server port
$nazwa_bota = "VPN_GUARD"; //name bot

$ts = new ts3Admin($adres_ip, $query_port);

if(!$ts->getElement('success', $ts->connect()))  {
      die("Brak polaczenia z serwerem..");
}

$ts->login($login_query, $haslo_query);

$ts->selectServer($port_serwera);

$ts->setName($nazwa_bota);

while(true) {
sleep(1);
$clientList = $ts->clientList("-ip -groups");



foreach($clientList['data'] as $val) {


$groups = explode(",", $val['client_servergroups'] );

if(in_array($ignorowana_grupa, $groups) || ($val['client_type'] == 1)) {
continue;
}

$file = file_get_contents('http://iphub.info/api.php?ip='.$val['connection_client_ip'].'&showtype=4');
$file = json_decode($file, true);
if($file['proxy'] == 1) {
$ts->clientKick($val['clid'], "server", $powod_kicka);
}
}
}
?>
Normally change this line to =>>

PHP:
$file = file_get_contents('http://iphub.info/api.php?ip='.$val['connection_client_ip'].'&showtype=4');

too $file = file_get_contents('http://ip-api.com/json/'.$val['connection_client_ip']);

if($file['proxy'] == 1) {
  
too if($file['country'] == "Canada") {
I'm sorry I don't have a server to try
I think its not a good way. Its better block directly in firewall i think.
 

farhadhelix

TeaFanatic
Hello
I don’t want some countries to log in to my Teaspeak server. How can I prevent them?
for the best result and the best solution is to use a frontend firewall with country IP addresses . you can open/close any country you want on it
with a mikrotik(RouterOS) as frontend firewall on your VPS you can do mostly anything you want
 

heartles39

Fanatic member
for the best result and the best solution is to use a frontend firewall with country IP addresses . you can open/close any country you want on it
with a mikrotik(RouterOS) as frontend firewall on your VPS you can do mostly anything you want
I could not. Do you have a video?