How to configure Bind name server as caching LAN server on FreeBSD
On FreeBSD 8.x and higher this manual should work fine. Bind is default installed.
Edit /etc/namedb/named.conf and add/change the following.
options {} block
listen-on {
127.0.0.1;
192.168.1.2;
};
forwarders {
8.8.8.8;
8.8.4.4;
};At the bottom of the file add your zones, example:
zone "kitara.nl" {
type master;
file "/etc/namedb/master/domain.tld-forward.db";
};Edit your master file and add/edit this to your needs, open /etc/namedb/master/domain.tld-forward.db
$TTL 1h
kitara.nl. SOA kitara.nl. nobody.kitara.nl. 42 1d 12h 1w 3h
; Serial, Refresh, Retry, Expire, Neg. cache TTL
NS ns.kitara.nl.
A 77.74.48.170
* A 77.74.48.170
localhost A 127.0.0.1
www A 77.74.48.170
prn A 172.16.32.12Now edit /etc/rc.conf and add the startup value.
named_enable="YES"
Now start named
/etc/rc.d/named start
Now test your server by throwing in some queries:
# Short output host google.com 127.0.0.1 # More output dig @127.0.0.1 google.com
How to test your mail server SMTP communication with Telnet
SMTP without Authentication
In the below example lines starting with the number 220, 221, 250 and 354 are the responses.
telnet smtp.xs4all.nl 25 220 smtp-vbr10.xs4all.nl ESMTP Sendmail 8.13.8/8.13.8; Tue, 5 Jul 2011 20:07:48 +0200 (CEST) HELO kitara.nl 250 smtp-vbr10.xs4all.nl Hello srv.kitara.nl [77.74.48.170], pleased to meet you MAIL FROM: reply@kitara.nl 250 2.1.0 reply@kitara.nl... Sender ok RCPT TO: marius@kitara.nl 250 2.1.5 marius@kitara.nl... Recipient ok DATA 354 Enter mail, end with "." on a line by itself Subject: Your Subject here Your data here, note the blank line above! . 250 2.0.0 smtp-vbr10.xs4all.nl accepted message p65I7m0V043931 quit 221 2.0.0 smtp-vbr10.xs4all.nl closing connection Connection closed by foreign host.
SMTP with Authentication
This example is quite the same as the above one only it implements authentication.
telnet smtp.xs4all.nl 25 220 smtp-vbr10.xs4all.nl ESMTP Sendmail 8.13.8/8.13.8; Tue, 5 Jul 2011 20:07:48 +0200 (CEST) HELO kitara.nl 250 smtp-vbr10.xs4all.nl Hello srv.kitara.nl [77.74.48.170], pleased to meet you AUTH LOGIN <base64 encoded username, mostly full email> <base64 encoded password> 235 2.0.0 OK Authenticated MAIL FROM: reply@kitara.nl 250 2.1.0 reply@kitara.nl... Sender ok RCPT TO: marius@kitara.nl 250 2.1.5 marius@kitara.nl... Recipient ok DATA 354 Enter mail, end with "." on a line by itself Subject: Your Subject here Your data here, note the blank line above! . 250 2.0.0 smtp-vbr10.xs4all.nl accepted message p65I7m0V043931 quit 221 2.0.0 smtp-vbr10.xs4all.nl closing connection Connection closed by foreign host.
Here a handy tool to encode or decode your data to base64.
http://ostermiller.org/calc/encode.html (Zip)
And remember kids, don't spam
How to add bots to your Urban Terror server via RCON
First of all you need to configure your server first! For more info about that check here.
Now you should have your server all up and running, next thing is having control over your bots.
bot configuration
First enable the use of bots
/rcon bot_enable 1 /rcon reload
Next, lets add bots.
/rcon addbot <type> [level] [team] [ping] [nick]
addbot arguments
type
Define the name of the bot type here, chose one from the list below.
level
Define a number from 1 to 5 here to set how good the bots will try to hunt you down!
team
Define the color name Red or Blue to set the team this bot belongs to.
ping
Define the average ping time the bot will have, if you define this to a low value the bots will respond fast, I recommend setting this to 40 on a local LAN and 75 on a WAN connection.
nick
Define the nickname of the bot, I usually give a simple name like Bot1, Bot2, Bot3, etc...
addbot examples
/rcon addbot Chicken Blue 75 Bot1 /rcon addbot Cockroach Blue 75 Bot2 /rcon addbot Mantis Blue 75 Bot3
In case you want to get rid of one or all bots, simply kick them!
/rcon kick [nickname] /rcon kick allbots
Here is a simple Bash example that you could use to add or remove bots:
#!/bin/bash # Add bot echo -e "\xFF\xFF\xFF\xFFaddbot Chicken Blue 75 BOTNAME\n" | /usr/bin/nc -D -4 -d -n -u 127.0.0.1 27960 # Remove bot echo -e "\xFF\xFF\xFF\xFFkick BOTNAME\n" | /usr/bin/nc -D -4 -d -n -u 127.0.0.1 27960
Here is a list of the bots names, weapons and their accessories they are carrying.
| Name: | Boa |
| Primary: | ZM LR300 ML |
| Secondary: | H&K MP5K |
| Sidearm: | .50 Desert Eagle |
| Grenades: | HE Grenades |
| Item 1: | Kevlar Vest |
| Item 2: | - |
| Item 3: | - |
| Name: | Cheetah |
| Primary: | Kalashnikov AK103 |
| Secondary: | Franchi SPAS-12 |
| Sidearm: | .50 Desert Eagle |
| Grenades: | HE Grenades |
| Item 1: | Kevlar Vest |
| Item 2: | - |
| Item 3: | - |
| Name: | Chicken |
| Primary: | H&K G36 |
| Secondary: | H&K MP5K |
| Sidearm: | .50 Desert Eagle |
| Grenades: | HE Grenades |
| Item 1: | Kevlar Vest |
| Item 2: | - |
| Item 3: | - |
| Name: | Cobra |
| Primary: | ZM LR300 ML |
| Secondary: | H&K MP5K |
| Sidearm: | .50 Desert Eagle |
| Grenades: | Smoke Grenades |
| Item 1: | Kevlar Vest |
| Item 2: | - |
| Item 3: | - |
| Name: | Cockroach |
| Primary: | H&K UMP45 |
| Secondary: | - |
| Sidearm: | Beretta 92G |
| Grenades: | Flash Grenades |
| Item 1: | Kevlar Vest |
| Item 2: | - |
| Item 3: | - |
| Name: | Cougar |
| Primary: | H&K G36 |
| Secondary: | - |
| Sidearm: | Beretta 92G |
| Grenades: | Flash Grenades |
| Item 1: | Silencer |
| Item 2: | Kevlar Vest |
| Item 3: | - |
| Name: | Goose |
| Primary: | H&K 69 |
| Secondary: | H&K UMP45 |
| Sidearm: | .50 Desert Eagle |
| Grenades: | - |
| Item 1: | Extra Ammo |
| Item 2: | Kevlar Vest |
| Item 3: | - |
| Name: | Mantis |
| Primary: | ZM LR300 ML |
| Secondary: | - |
| Sidearm: | Beretta 92G |
| Grenades: | - |
| Item 1: | Laser Sight |
| Item 2: | Silencer |
| Item 3: | Kevlar Vest |
| Name: | Penguin |
| Primary: | ZM LR300 ML |
| Secondary: | - |
| Sidearm: | .50 Desert Eagle |
| Grenades: | - |
| Item 1: | Laser Sight |
| Item 2: | Silencer |
| Item 3: | Kevlar Vest |
| Name: | Puma |
| Primary: | ZM LR300 ML |
| Secondary: | - |
| Sidearm: | Beretta 92G |
| Grenades: | - |
| Item 1: | Laser Sight |
| Item 2: | Silencer |
| Item 3: | Kevlar Vest |
| Name: | Python |
| Primary: | H&K G36 |
| Secondary: | Franchi SPAS-12 |
| Sidearm: | .50 Desert Eagle |
| Grenades: | HE Grenades |
| Item 1: | Kevlar Vest |
| Item 2: | - |
| Item 3: | - |
| Name: | Raven |
| Primary: | H&K PSG-1 |
| Secondary: | H&K MP5K |
| Sidearm: | .50 Desert Eagle |
| Grenades: | - |
| Item 1: | Kevlar Vest |
| Item 2: | Silencer |
| Item 3: | - |
| Name: | Scarab |
| Primary: | H&K G36 |
| Secondary: | H&K MP5K |
| Sidearm: | .50 Desert Eagle |
| Grenades: | - |
| Item 1: | Kevlar Vest |
| Item 2: | Silencer |
| Item 3: | - |
| Name: | Scorpion |
| Primary: | Remington SR8 |
| Secondary: | H&K MP5K |
| Sidearm: | Beretta 92G |
| Grenades: | HE Grenades |
| Item 1: | Kevlar Vest |
| Item 2: | - |
| Item 3: | - |
| Name: | Tiger |
| Primary: | Kalashnikov AK103 |
| Secondary: | - |
| Sidearm: | Beretta 92G |
| Grenades: | HE Grenades |
| Item 1: | Medkit |
| Item 2: | Kevlar Vest |
| Item 3: | - |
| Name: | Widow |
| Primary: | ZM LR300 ML |
| Secondary: | H&K MP5K |
| Sidearm: | Beretta 92G |
| Grenades: | - |
| Item 1: | Kevlar Vest |
| Item 2: | Laser Sight |
| Item 3: | - |
How to install an Urban Terror server with bots on FreeBSD
This will install an Urban Terror server running under the user urban with 4 bots enabled on the server.
First of all we install the binaries, I prefer installing them from the ports, in case you don't have root access you might want to manually download from http://www.urbanterror.info. The configuration is quite the same so you should be able to install on your own.
For the port install use:
cd /usr/ports/games/iourbanterror/ make WITHOUT_CLIENT=1 \ WITHOUT_GAMELIBS=1 \ WITH_DEDICATED=1 \ WITHOUT_CURL=1 \ WITHOUT_OPENAL=1 \ WITHOUT_MUMBLE=1 \ WITHOUT_VORBIS=1 \ WITH_TEAMARENA=1 install clean
Lets get some coffee, cause this installation might take a while... The installation requires downloading UrbanTerror411.zip from one of the mirrors which is around 1GB in size
After installing you need to add a user to run the server.
pw user add urban -mI don't set a password for this account simply because I mostly su into it
So...
su - urbanFirst create the required directories
mkdir -p .ioUrbanTerror/q3ut4 cd .ioUrbanTerror/q3ut4
In this directory you need to add the configuration files: server.cfg / mapcycle.txt / bots.cfg
server.cfg
sets "Admin" "Marius van Witzenburg" sets "Email" "marius@kitara.nl" set rconpassword "This_Is_Your_RCON_Password" set g_gametype "0" set sv_hostname "Fire in the hole!" set g_respawndelay "1" set bot_enable "1" set g_teamautojoin "1" set g_maxteamkills "5" set g_respawnprotection "3" // (restart/map/nextmap/cyclemap) set g_allowVote "536870926" set g_log "" set g_logroll "0" set fraglimit "50" set timelimit "15" // Startup map map ut4_turnpike // Add bots exec bots.cfg
In case you want to change this configuration, check out: http://www.urbanterror.info/docs/180-/
mapcycle.txt
ut4_turnpike ut4_abbey ut4_prague ut4_mandolin ut4_algiers ut4_austria ut4_sanc ut4_riyadh ut4_thingley
I limited the map list to the maps that work fine with bots.
bots.cfg
kick allbots addbot boa 4 blue 25 "Bot 1" addbot chicken 4 blue 25 "Bot 2" addbot cockroach 4 blue 25 "Bot 3" addbot goose 5 blue 25 "Bot 4"
You can start the server by manual but I would advice you do run the server with this script in tmux or in GNU Screen.
start.sh
#!/bin/bash # Dedicated # 1 don't report # 2 report to master servers myExit() { kill $$ exit $? } trap myExit SIGINT while true do /usr/local/bin/ioUrTded \ +set fs_game q3ut4 \ +set dedicated 1 \ +set net_ip 192.168.1.5 \ +set net_port 27960 \ +set com_hunkmegs 128 \ +exec server.cfg echo "server crashed on `date`" > /usr/home/urban/last_crash.txt done
Run it by doing
chmod 700 start.sh ./start.sh
In case you want this server to be reachable for the public, don't forget to set dedicated to 2.
Good luck! If you have any questions, let me know!
How to send a message to your iPhone via Pushme.to with PHP or Bash and Curl
After having Pushme.to installed on my iPhone for over 3 months now I finally had the time to work on some scrips to make it work in different languages for use on servers that I manage.
The PHP version is the less version I use but may be handy for some people.
PHP Version:
function pushMeTo($username, $message, $signature) { $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, 'http://pushme.to/' . $username . '/'); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, 'message=' . urlencode($message) . '&signature=' . urlencode($signature)); curl_exec($curl); curl_close($curl); } pushMeTo('username', 'Hello world!', 'God');
A more used version is the commandline (Bash) version:
Bash version:
#!/bin/bash username="username" message="Hello world" signature="God" /usr/local/bin/curl -F "message=$message" -F "signature=$signature" "http://pushme.to/$username/"
I currently use these for server monitoring on FreeBSD like the GEOM Raid bay and S.M.A.R.T. status of the disks and website monitoring which works quite nice. And in case the internet connection drops I have a backup via SMS with a serial connected cellphone. So this should be quite failsafe
If you have any other language that you want to use such as Perl just let me know and I could write it for you.
I hope you find these scripts useful. Happy texting!
How to sync files to a ftp server with the use of ftpsync on FreeBSD
In the ports of FreeBSD I found a nice tool to sync a local directory to a remote FTP server.
First install ftpsync:
cd /usr/ports/ftp/ftpsync make install clean
Next create a config file to configure ftpsync for synchronization:
localdir=/home/mariusvw/backups ftpserver=rstore.kitara.nl ftpdir=/ ftpuser=username ftppasswd=password
Next you have two options for syncing...
Get-sync from server:
ftpsync.pl -g cfg=financenetwerk_eu-v1.cfg
Put-sync to server:
ftpsync.pl -n cfg=financenetwerk_eu-v1.cfg
You can add the -p flag to not-prune directories on the target.
I don't use this program anymore for syncing but I can tell you, it works great if you want to easy upload a website to a live server.




