Skip to content

X2OX/zerotier-central-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JetBrains Open Source Licenses MIT license

Introduce

ZeroTier's Telegram node management robot, can manage devices, monitor and notification node online and offline, new device access.

The project uses Vercel's Serverless function as the backend, Firebase's Realtime Database as the database, and UptimeRobot as the timed task, and interacts through the Telegram Bot API.

Safety first, so the configuration is more cumbersome. Firebase's Realtime database requires rules to be set. But it’s not necessary, it’s just that you may be maliciously attacked.

Because the interface path is fixed, if the project is open source, it may be called maliciously. So the interface of Telegram Webhook has IP verify. The interface used for UptimeRobot call has Token verify.

Similarly, Telegram Bot has also taken protective measures. Without filling in the Telegram ID, anyone can use the bot, but there is no notification function. Only when the Telegram ID is filled in, the notification function is available. Because bots need to know the Chat ID to send messages, and group use is not currently supported.

Deployment

One-click deployment

Manual deployment

  1. Fork Repo
  2. Import deployment in Vercel

Get environment variable

Must

ZEROTIER_CENTRAL_TOKEN

Open ZeroTier Account Center click New Token generate

ZEROTIER_NETWORK_ID

Open ZeroTier Network copy NETWORK ID

TELEGRAM_BOT_TOKEN

Open Telegram BotFather new bot

Optional

FIREBASE_URL

Used to store data

  1. Open Firebase Console new project
  2. New Realtime Database, copy database address
  3. Set rules, use random string instead of X_SECRET
{
    "rules":{
        "X_SECRET":{
            ".read":true,
            ".write":true
        }
    }
}
  1. Splice databaseURL+X_SECRET, example: https://vervel-default-rtdb.firebaseio.com/x2ox
TELEGRAM_ID

Used for authentication and notification. Can be obtained through Bot's /info command or other methods

TIMER_TOKEN

used to cooperate with UptimeRobot to check status regularly. It's a random string.

Configure environment variable

Used Webhook

  1. Bind a custom domain name for the project, it must be a single domain name (Telegram requires a non-wildcard certificate).
  2. Set by curl -F "url=https://<DOMAIN>/api/zerotier" https://api.telegram.org/bot<YOURTOKEN>/setWebhook

Turn on notifications

Open UptimeRobot Add monitoring, DOMAIN is your configured domain name, TIMER_TOKEN is a random string in the environment variable, the final address is https://<DOMAIN>/api/timer?token=<TIMER_TOKEN>

Contribute

TODO

  • Add FRP API

Thanks

  • Vercel supply Open Source project sponsorship
  • JetBrains supply Open Source Licenses
  • ZeroTier
  • Firebase
  • UptimeRobot

Powered by Vercel