shoutcast + monitoring + restart + script + cron

Shoutcast servers which are running on shared hosts usually get shut down quite frequently by procwatch. While it is important to stay within system limits it is also important to have those servers running till you shift to dedicated hosting 😀
Here’s a quick and dirty shell script to monitor and restart shoutcast services. Drop it in cron to run every 15 minutes and you will never have to worry about your shoutcast going down.


#!/bin/bash
### Script to restart shoutcast server/transcoder when it's down
### Imtiaz a Khan http://blog.netbrix.net on 21 May 2007

prcs=`ps -ef | grep “sc_serv\|sc_trans” | grep -v grep > /tmp/monitor.log && cat /tmp/monitor.log | tr -s ” ” | cut -d” ” -f2,8 | grep -v grep | wc -l`
if [ ! $prcs ] || [ $prcs -lt 4 ]
then
/usr/bin/killall sc_trans_linux
/usr/bin/killall sc_serv
nohup sc_serv &
nohup sc_serv sc_serv_low.conf &
cd sc_trans_040
make_playlist
nohup sc_trans_linux &
nohup sc_trans_linux sc_trans_low.conf &

###Send out the mails to inform
echo “shoutcast services restarted at `date`”| mail -s “ALARM: shoutcast services on `hostname`” khanimtiaz@gmail.com
#echo “shoutcast services restarted at `date`”| mail -s “ALARM: shoutcast services on `hostname`” youremailid
else
echo “shoutcast services running fine on `date`”| mail -s “OK: shoutcast services on `hostname`” khanimtiaz@gmail.com
#echo “shoutcast services running fine on `date`”| mail -s “OK: shoutcast services on `hostname`” youremailid
fi

Make sure you replace the paths to the binaries and email ids. Also after a point getting a “everything OK” mail every 15 minutes gets irritating so just comment out the lines in the else portion when you’re happy with the script.

This script can be modified to monitor many other services that you’re running and facing problems with. Please Contact us for implementation on your server or for modifications.

Linux Security + prevent password brute forcing + ssh security + firewall + iptables

This is a quick and dirty how to on setting up a firewall + Bruteforce detection/prevention mechanism + AntiDOS system on your dedicated Linux server.
Assumes root access

    APF

APF is a policy based iptables firewall system designed for ease of use and configuration.

mkdir $HOME/src
cd $HOME/src
wget http://www.rfxnetworks.com/downloads/apf-current.tar.gz
tar -xvzf apf-current.tar.gz
cd apf-0.9.6-1/
./install.sh
vi /etc/apf/conf.apf
(edit the IG_TCP line and add ports you need. Also the directive to run it in demo mode)

/etc/init.d/apf start

    AntiDOS

Antidos is a log parsing script made for r-fx.org’s APF (advanced policy
firewall). It’s purpose is to parse specific log formats for network attacks
against a given system; and take certain actions.

vi /etc/apf/ad/conf.antidos
(edit the config for alerts and other options)
/etc/init.d/apf restart

    BFD

BFD is a modular shell script for parsing applicable logs and checking for authentication failures. There is not much complexity or detail to BFD yet and likewise it is very straight-forward in its installation, configuration and usage. The reason behind BFD is very simple; the fact there is little to no authentication and brute force auditing programs in the linux community that work in conjunction with a firewall or real-time facility to place bans.

cd $HOME/src
wget http://www.rfxnetworks.com/downloads/bfd-current.tar.gz
tar -zxf bfd-current.tar.gz
cd bfd-0.9/
./install.sh
vi /usr/local/bfd/conf.bfd
(edit alarm settings, email address etc.)

A cron job gets added to run bfd at intervals to detect and abn brute force attempts.

This is just an example of what can be done to stop hackers in there tracks. There’s a lot more which we can help you with on your servers.

Please WRITE TO US for this and other security or system administration related question/requirements/qoutes.

email to photo gallery

When you just can’t wait to share the moment

An implementation of this concept(with video ability also) is available for testing here

Often while travelling you come accross situations which are worthy of being shared and sometimes you wish you could do it instantly rather than wait to find a docking station. Well it’s possible.

We were recently contemplating what would be the simplest solution to do this and here’s the concoction we came up with:

  1. ofcourse a mms enabled camera phone and the hosting to run your gallery
  2. procmail to catch the mail and process it
  3. metamail to extract the image attachments
  4. mojomail to maintain a optional distribution list
  5. a nifty little php script to do the gallery jhingbang

I wrote the recipe for procmail and wired it with mojomail to give it a test run. It runs real sweet! Mojomail rocks because dadamail doesn’t have a dada_send.pl or atleast it’s too damn buggy also once you get popular for good photography your fans spread the word and you need a robust list management s/w to take care of the subscriptions.

The gallery script which we wrote is pretty basic as in it takes the images from where the procmail processing dumps them, generates the thumbnails and displays them on a page as clickables. I also figured a way to add descriptions to the images extracting it from the message body. Some mobile service providers tend to add there own images to the mms well that’s easily managed, in the gallery script just suppress the operator logos.

This is work in progress and I’m looking for a demo server where I can set it all up as right now it’s on a clients server and we can’t really push traffic onto his server 😉 ! Request you to give suggestions as to how we can further improve this application.

Server setup for YouTube clones -mencoder+ffmpeg+ffmeg-php+flvtool2+mplayer+libraries+etc.+etc.

This service works with Dreamhost post the horrible Debian update as well

It works for Bluehost servers post recent updates.


Service Options




Ok we’ve been getting a few requests for setting up servers for youtube clones. The back and forth on mail is kinda “not happening” so I’ve written a quick list of what we “need” to get it all rolling and fast! Here’s the list:

  • I need the ssh details of the server. Usually if you came to this page you already tried a bit of poking around so you know what ssh is.
  • I also need to know if you already have a you tube clone script setup (try Social Media, vshare or clipshare). If you do I’ll need to know so that I can test using that script. For an additional negotiable amount, usually $30 but may vary upon complexity, I can help you setup your youtube clone.
  • I also need to pay bills (occasional trip to the Bahamas and the weekend parties at the Tiki bar…. Hilton is just so pretentiously expensive), so I charge for this service. USD 50 is what I expect and I can send you my paypal details if you’re interested and are able to paypal.
  • Since a few people ripped us off we need the payment before we start the work
  • Depending on how your server is setup it takes about 24 hours to set it all up. I can throw in the test application if you’re looking for a script as well please let me know upfront so that I can let you know any reasonable additional charges involved for this script .

So there you are now ping me when you’re ready…. mail me through the Contact Form Here’s a List of scripts we have successfully setup on shared as well as dedicated hosting

  • PHPmotion
  • HWDVideoShare component for Joomla
  • Achtube component for Joomla
  • Clipshare (all versions)
  • Vshare
  • videoshare(agriya)
  • Rayzz
  • social media
  • OSTube
  • PHPFox
  • other custom made scripts for various sites which want to be left anonymous(probably haven’t discovered the magic of reciprocal link exchanges yet 🙁 )

Go ahead and make the payment and while at it also send the ssh information in the encrypted secure message so that I can get on the job right away:


Service Options




yum install on godaddy servers + yum howto on FC4

Keep forgetting how to setup Yum successfully on godaddy servers 🙂 Here’s sthe sticky just in case I need it again!!!


rpm -Uvh ftp://fr2.rpmfind.net/linux/fedora/core/updates/4/i386/libxml2-python-2.6.20-1.FC4.i386.rpm
rpm -Uvh ftp://fr2.rpmfind.net/linux/fedora/core/4/i386/os/Fedora/RPMS/python-elementtree-1.2.6-4.i386.rpm
rpm -Uvh ftp://fr2.rpmfind.net/linux/fedora/core/4/i386/os/Fedora/RPMS/python-sqlite-1.1.6-1.i386.rpm
rpm -Uvh ftp://fr2.rpmfind.net/linux/fedora/core/updates/4/i386/rpm-python-4.4.1-23.i386.rpm
rpm -Uvh ftp://ftp.univie.ac.at/systems/linux/fedora/4/i386/os/Fedora/RPMS/python-urlgrabber-2.9.6-1.noarch.rpm
rpm -Uvh ftp://fr2.rpmfind.net/linux/fedora/core/updates/4/i386/yum-2.4.1-1.fc4.noarch.rpm
yum update yum