IRCS (IRC Services) by acidvegas

The UnrealIRCd team does not officially provide support for any services packages that you may be using or want to use. This forum is provided so the community can help each other with services issues.

Moderator: Supporters

Locked
acidvegas
Posts: 8
Joined: Sat Feb 04, 2017 12:58 am
Location: Olympia, Greece
Contact:

IRCS (IRC Services) by acidvegas

Post by acidvegas »

https://github.com/acidvegas/ircs

IRC Services (IRCS)
A services bot for the Internet Relay Chat (IRC) protocol.

Information
The IRCS project is basically, a stripped down version of Anope's ChanServ, HostServ, & NickServ bots, all crammed into one.

Compatibility
This was developed for usage with the latest version of UnrealIRCd.

Configuration
The bot will require network operator privledges, so make sure you set that up in your IRCd configuration.
Make sure you have set::channel-command-prefix defined in your config and the "!" character is included.
You will also need to edit config.py and change the Connection & Admin settings.
The admin_host setting should be the hostname of the person(s) who control the database.
For example, if your IRC ident is [email protected], you would set the admin_host to equal chat.hard.com.
You will get the lowest ping having the bot connect to localhost on the same box as the IRCd is running.

Dynamic Hostname Voicing
A VHOST can be added to your IRCd configuration for mobile users to login to in order to get auto-voice in channels while having a dynamic hostname.
Run /mkpasswd bcrypt <password> on your server, and copy the encrypted password.
Add the following into your unrealircd.conf file:

Code: Select all

vhost {
    vhost voice.me;
    mask { *; };
    login voice.me;
    password <encypted_password>;
};
You can now tell the people you trust with having auto-voice to setup their client to run /vhost voice.me <password> (the plain-text password, not the encrypted password) on connect. They should also setup a delay before auto joining channels.

Tor Setup & Information
Because network operators and bots, such as this one, might be ran on localhost, it is recommended to setup a separate local IP address for Tor connections.
By default, any person connection to an IRCd via a hidden service onion URL will have localhost (127.0.0.1) as their host. We are going to setup 127.0.0.2 as the Tor host IP address.
Setup the Tor local IP address with ip addr add 127.0.0.2/32 dev lo
Edit your /etc/tor/torrc and add the following:

Code: Select all

HiddenServiceDir /var/lib/tor/hidden_service/
HiddenServicePort 6667 127.0.0.2:6667
HiddenServicePort 6697 127.0.0.2:6697
Note: You might have other ports to listen on, this is just an example. Any IRC port needs to forward to 127.0.0.2:<port> like above.

Commands
Global

Code: Select all

Command 	Description
@help 	Information about the commands.
@info 	Information about the bot.
!filter enable 	Turn on word filters. (+G)
!filter disable 	Turn off word filters. (-G)
!identify <nick> 	Identify yourself as the owner of <nick>.
Admin Channel

Code: Select all

Command 	Description
!defcon enable 	Turn on channel protection. (+lL 1 #lobby)
!defcon disable 	Turn off channel protection. (-lL #lobby)
!flood enable 	Turn off flood control. (+f [10j#i5,10n#N5]:15)
!flood disable 	Turn on flood control. (+f [10j#i5,10n#N5,50t]:15)
!mutetor enable 	Sets mode +b ~q:[email protected] in the channel. (Requires Tor users to have voice to talk.)
!mutetor disable 	Removes the +b ~q:[email protected] in the channel.
!protect 	Sets mode +e (Ban Exception) and +I (Invite Exception) to everyone in the channel / tor database.
!protect reset 	Removes all +e (Ban Exception) and +I (Invite Exception) modes.
!tordefcon disable 	Turn off Tor protection. (-b *[email protected])*
!tordefcon enable 	Turn on Tor protection. (+b *[email protected])*
Admin

Code: Select all

Command 	Description
!bans 	List the total number of bans in the database.
!bans restore 	Add a permanent Z:Line for every host in the ban database.
!bans sync 	Add all current permanent Z:Lines to the ban database.
!husers 	List all users connected but not joined to any channel(s).
!husers join <channel> 	Force join all hidden users into <channe>.
!husers kill 	Kill the connection of all hidden users.
!husers kline 	K:Line the connection of all hidden users.
!husers zline 	Z:Line the connection of all hidden users.
!reset bans 	Reset all bans in the database and remove all *:Lines on the IRCd.
!reset chans 	Reset the ChanServ database.
!reset database 	Reset the entire database.
!reset nicks 	Reset the NickServ database.
!reset vhosts 	Reset the HostServ database.
!reset <channel> 	Reset the <channel> ChanServ database.
!tor 	List all registered Tor fingerprints.
!tor add <nick> <fingerprint> 	Register a Tor fingerprint.
!tor del <nick> 	Delete a Tor fingerprint.
ChanServ

Code: Select all

Command 	Description
!join <channel> 	Joins <channel>.
!part <channel> 	Parts <channel>.
!mode <channel> 	Read all the auto-mode hosts for <channel>.
!mode <channel> <mode> 	Read all the <mode> auto-mode hosts for <channel>.
!mode <channel> <mode> +<ident> 	Automatically +<mode> a user matching <ident>.
!mode <channel> <mode> -<ident> 	Remove automatic +<mode> from a user matching <ident>.
HostServ

Code: Select all

Command 	Description
!vhost 	Read all the auto-vhost hosts.
!vhost add <ident> <vhost> 	Automatically change the host of a user matching <ident> to <vhost>.
!vhost del <ident> 	Remove automatic vhost change from user matching <ident>.
NickServ Command 	Description
!register <nick> <fingerprint> 	Register a nickname.
!nick del <nick> 	Un-register a nickname.
!nick 	List all registered nicknames.
Command Information
Most commands are handled through private messaging the bot.
All of the commands can only be ran by the user(s) with the admin_host hostname, except for the Global commands.
All Permanent Z:Lines are saved in the BAN table in the database and can be used to be restored when restarting or updating the IRCd.
The ChanServ feature is to setup automatic modes on idents. Make sure that if you setup any channel modes for users, that you !join the channel first. The automatic modes are execute when a person joins the channel, so if you add any modes for a user that is already in a channel, they will have to /cycle from the channel.
The HostServ feature will automatically do a /chghost on idents with a registered vhost. Clients using a vhost through this bot should put a delay on before they join channels automatically.
The NickServ feature is so people can recover their nick in the event that another person is using it. This works through the use of SSL certificate fingerprints. Users will have to generate a certificate and setup their client to use it. You can get a users fingerprint by doing a /whois on the user and look for the line thats says "client certificate fingerprint". If you do not see this line, the user is either not using an SSL certificate, or has setup their client or certificate incorrectly. This way, if someone is using their nick, they can private message the bot !identify <nick>, the bot will perform a /whois on that user, verify the certificate fingerprint, and if it matches, the bot will automatically kill the connection of the person using the stolen nickname. Users can not register their nick on their own. The admin has to register it for them in order to prevent KILL abuse.
The Tor feature is so that you can allow Tor connections to the IRCd via a hidden service onion address, whilst being able to maintain control with a ban exemption list that uses SSL client certificates. All clients with a matching fingerprint in the TOR table in the database will be able to still join a channel when !tordefcon enable has been used.

Command Examples
Add an auto-mode !mode #dev v +[email protected].
Delete an auto-mode !mode #dev v -[email protected].
Register a registered vhost !vhost add [email protected] cant.stop.me.
Delete a vhost !vhost del [email protected].
Register a nick !register acidvegas e74d46f19ff468f5e8e349cc285df96585ba4f16b64902e334e6e76afe76a798.
Delete registered nick !nick del acidvegas.
Locked