Posted: March 18th, 2011 | Author: Gregg | Filed under: Linux, Tech | Tags: asus, backup, bash, cron, Linux, polarcloud, router, script, tomato, tomato cron backup, tomato router backup | 2 Comments »
I recently was given the task to automate the backups of several remote routers that we manage that run tomato firmware.
Here is the Tomato developer’s site: www.polarcloud.com/tomato
The main goals were:
- To use https
- To be automated (Cron)’d later
- To scale from 1 to 1XXX routers
I tested it on Tomato Firmware 1.28 using my ASUS RT-N16 router, but it should work for any Tomato-firmware router.
There will be some slight modifications to run in cron, but let me know and I’ll be glad to help.
Download the .zip file here: tomatobackup1405
Extract the file so the full path will be /root/tomatobackup1405
Read the README inside the folder
chmod +x tomatobackup1405.sh
Add your hosts to the tomatobackup1405_hosts.cfg file
If successful, you will see a subfolder with the date YYYYMMDD and the file with CoName-tomato_v_.cfg
If there are connection problems, you’ll see an error message.
EDIT: There was a python rewrite by Sam@orgraphone.org
Feel free to check it out here
Let me know if you have any thoughts or suggestions.
Posted: April 27th, 2009 | Author: Gregg | Filed under: Asterisk VoIP, Linux, Tech, Uncategorized | Tags: asterisk backup, Asterisk VoIP, at backup asterisk, atd, automated asterisk backup, automated backup, automatic ftp connection, backup asterisk, backup asterisk files, backup asterisk script, backup etc/asterisk, bash, centos, connect ftp bash, cron, cron backup, cron backup asterisk, ftp bash, gz, gz asterisk, interactive backup, Linux, safe1405, tar, tar asterisk, voip | 6 Comments »
Safe1405 is a bash script that will backup the popular Asterisk directories and place them in a tar.gz file. The script can be used in 1 of 2 modes.
The first mode is interactive, with a menu to choose:
- Backup Everything (/etc/asterisk, Voicemail, Recordings, Sounds)
- Just VM
- Just Recordings
- Just Sounds
After the file is created, it will prompt to upload to a remote FTP server.
The second mode is silent, and is best suited for automated execution via cron or at.
Just enable the UNATTENDED and PUT_FTP variables by setting them to “1”. You can directly edit the paths to each directory if yours are non-standard.
The script can be directly downloaded here: Safe1405 Download Link
# Author: Gregg Hansen - www.thiscoolsite.com
# Safely tar and gzip Asterisk files
# Version 1.0 20090427
#-Backs up all important Asterisk files - Tar/Gz
#-Choose the file name, or Date by default
#-GUI-like. Able to be silent for cron, or interactive
#EDIT the below ABSOLUTE paths to match your directory structure:
#Filename is FILEDATE-SERVERNAME.tar.gz
#Enable unattended mode/Remote FTP put (useful for Cron):
# Backup of /etc/asterisk ONLY (default)
# 1 = On, 0 = Off
### Interactive Mode Functions ###
echo -n "Prompt> "
case $INPUT in
tar cfvz $FILENAME $ETC_AST $VM $MON $VAR_LIB
tar cfvz $FILENAME $ETC_AST
tar cfvz $FILENAME $VM
tar cfvz $FILENAME $MON
tar cfvz $FILENAME $VAR_LIB
echo -en "Upload $FILENAME to FTP? (y or n) "
if [ "$INPUT" == "y" ]; then
### Unattended Mode Functions ###
tar cfvz $FILEDATE-$SERVERNAME-ETC-AST.tar.gz $ETC_AST ##Uncomment##$VM #$MON #$VAR_LIB
ftp -ivn <<EOF
user $FTP_USER $FTP_PASS
#### Start Program Flow ###
#Unattended Function Call(s)
if [ "$UNATTENDED" == "1" ]; then
if [ "$PUT_FTP" == "1" ]; then
#Interactive Function Calls
Leave a comment if you have questions/suggestions or would like help setting up the script.
Posted: March 30th, 2009 | Author: jwiltse | Filed under: Linux, Mac, Tech | Tags: apple, centos, centos on mac, debian, debian mac, grub, install centos mac, install centos mac mini, Linux, linux on a mac, linux on mac, linux on new mac mini, Mac, mac mini, single boot, single boot linux new mac mini | 3 Comments »
See IMPORTANT NOTES section below… there’s currently a catch with rebooting….
If you find a fix for the reboot issue, please leave a comment (that will email me)..
Special thanks to Victor Costan http://blog.costan.us
Step 1 – Get your linux on the HD
-Power On / Insert Linux Install Disk With Kernel 2.6.26 or higher / Power Off
-Power On / Wait 4 Seconds / Hold “c” key to boot from DVD drive
-I couldn’t get linux to work after deleting the EFI partition, so don’t.
-Get to your distro’s partitioning utility and delete the main MAC partition
-After deleting the big partition, create your linux partitions
-If you delete the EFI partition on accident, the Leopard install will fix it
-Direct the installer to put GRUB on the first sector of your /boot partition
-Install whatever other options you want and let installer run
-Remove Linux Install Disk / Insert MAC OSX Install Disk / Reboot
Step 2 – Tell MAC‘s Open Firmware What To Do
-Power On / Wait 4 Seconds / Hold “c” key to boot from DVD drive
-Get to “Terminal” under “Utilities” on MAC Installation Setup
-Type the following command to determine how your /boot partition was identified
-Type the following command to set that partition as bootable (mine was disk0s2)
bless –device /dev/disk0s2 –setboot –legacy –verbose
-After these steps, linux will boots fine but when trying to reload it will hangs (more likely the shutdown process hangs). It appears to require a hard reset at this time…bummer.
-Earlier Kernels (Such as 2.6.18 in Centos 5.2 and lower) may install successfully but do not properly load drivers for all the hardware once installed.
WINDOWS KEYBOARD NOTES
Hold “c” key to boot from DVD drive
Hold “F12” key to eject the DVD drive
Hold “ALT” to emulate the option key (not used in this procedure)
Debian Success Documented here (by Thomas Glanzmann): http://lkml.indiana.edu/hypermail/linux/kernel/0903.1/01828.html
Discussion and bless command from Veiho in Ubuntuforums : http://ubuntuforums.org/archive/index.php/t-493393.html
Status on reload problem being worked by ubuntu developers: https://bugs.launchpad.net/ubuntu/+source/linux
Posted: March 19th, 2009 | Author: Gregg | Filed under: Tech | Tags: bash, copy paste, freebsd, Linux, Mac, microsoft, osx, putty, terminal, unix | No Comments »
This is probably the first post I’ve done that links to content that I had no part in creating/publishing. Dave over at Neozaz.com posted an great article about the pros and cons of different terminals/OS(s) and his experience over the years.
Check it out here.
Posted: February 26th, 2009 | Author: Gregg | Filed under: Linux, Tech | Tags: cracker, dont be hacked, encrypt, hacker, Linux, poison dns, public wifi, safe browsing, shell, ssh, ssh tunnel, tuennel web traffic, tunnel web browsing, windows | No Comments »
Whenever you are on a Public WiFi connection, you need to have your traffic encrypted so no one can snoop on what you are doing or poison your DNS/etc. Since every wireless packet is broadcast over the open-air, anyone can snoop in on your traffic. Unencrypted sessions can be captured and your precious passwords grabbed by the evil ‘Cracker’ (Cracker=Bad Hacker). I briefly discussed this in a previous post when I was in Japan, but it’s time to provide a detailed howto because too many people are getting taken advantage of.
A linux box that you have public access to and a valid username
Windows, Linux, or Mac as your OS for the client machine
1. Download PuTTY and save the .exe to your desktop
2. Make sure you have Firefox installed
3. Open PuTTY
4. Type in the address or hostname of your public Linux server that you have access to
5. Expand the +SSH option in the left-pane of the PuTTY program
6. Click on ‘Tunnels’
7. Type in 8888 for the Source port
8. Click on the ‘Dynamic’ radio button below
9. Click Add
10. Make sure it looks like my screenshot
11. Click on ‘Open’ and connect to your Linux server
12. Log in with your user and password
13. Once logged in, minimize your PuTTY Session and switch to Firefox
14. In Firefox: Click on ‘Tools’ at the top, then Options
15. Click on the Advanced tab
16. Click on the Network sub-tab
17. Click on Settings
18. Click the ‘Manual Proxy Configuration’ radio button
19. The line that says ‘SOCKS Host’ put ‘localhost’ and port ‘8888’, SOCKS V5 below
20. Click OK
Now all of your TCP web traffic will run through the encrypted SSH tunnel to your Linux server, then go out to the internet. Lets take it one step further and have your DNS lookups sent through the tunnel too.
1. In the address bar, type: ‘about:config’ and hit enter (don’t include the ticks)
2. Hit OK, I know what I’m doing on the prompt
3. Search for DNS in the top field and click on the line that reads:
network.proxy.socks_remote_dns until it is set to ‘TRUE’
4. Type in ‘whatismyip.com’ in the address bar and see if it shows the IP of your Linux server’s Public IP and not the Public IP of the network you are currently on. If you really want to see the magic happening, open up wireshark and watch the packets go by as you browse the web. All SSH packets with the exception of UDP.
If you have any questions or help, leave a comment and I will assist.
Happy (Safe) Browsing!
Posted: February 4th, 2009 | Author: Gregg | Filed under: Asterisk VoIP, Linux, Tech | Tags: Asterisk VoIP, balance trunks, distribute calls, freepbx, freepbx round robin, fxo, Linux, load balance, pbx in a flash, round robin, zap, zaptel | 2 Comments »
I’ve seen several posts around the net from users that want to distribute the calls across multiple trunks with FreePBX. The main reason being that they have a deal with a provider, and each line has 4,000 minutes for free, etc. After looking around at the different methods to accomplish this, it become very clear what must happen.
If your trunks are FXO ports/Analog then you are in luck.
Go to the FreePBX interface, click on Trunks.
-Add a trunk
-Put ‘r0’ for the Zap identifier (that’s R zero)
-Set the round robin Zap as your outbound route and enjoy!
Simple and clean, enjoy.