CRAB server firewall.iptables now fixed, so it will restart without a reboot.

For those of you familiar with my Linux server, y’all know that I run many custom BASH, Perl, and Python scripts.  We are going to discuss today my iptables firewall script, or actually the fact that I took the time to repair it.   Since upgrading the server to Fedora 20 in September 2014, my firewall script would start fine, but would choke on restarting, reloading, or running it over itself.  The end result would be that the server would sever all ports with the outside, effectively taking it down, needing a reboot to get it back online.  This was a real PITA, since I couldn’t really make any changes to the firewall without reboot.  I thought it was an end result of the OS changing from SysV init scripts to a systemd system.  How wrong I was….  The cause was simply a typo that I made while adding a feature, and a ‘done’ without a ‘while’ and a ‘fi’ without an ‘if’ stopped the script from accepting the restart and reload argument.  Most of the iptables rulesets were created before this typo, so it gave the ‘appearance’ that it was working properly.  Debugging a script of this size is a fairly daunting task, as the main firewall script is a healthy 50 pages, and its configuration file (one of a half dozen helper files) is about 7 pages long.  Since I’ve had a few questions about this firewall, I’ll share it with everybody…..

Download links are only viewable to logged in users.  All the other helper files, as well as these are all available upon request.  If you are a logged in user, and downloading these files, remove the .txt extension from the config and main files….

This is the screen information if the VERBOSE variable is set to 1 (Select the pop-out gadget to see this properly formatted)

Loader Loading...
EAD Logo Taking too long?

Reload Reload document
| Open Open in new tab

This is the configuration file that allows for easy firewall config.     (Select the pop-out gadget to see this properly formatted)

Loader Loading...
EAD Logo Taking too long?

Reload Reload document
| Open Open in new tab

This is the MAIN iptables firewall script that should be run at start.  (Select the pop-out gadget to see this properly formatted)

Loader Loading...
EAD Logo Taking too long?

Reload Reload document
| Open Open in new tab

All in all, it was a fairly productive week off.  I have a few other minor syntax errors to chase down, but the firewall is operating within normal parameters…..

 

Security Camera BASH script to merge Zoneminder events into mp4 videos

The following script is a BASH (Bourne Again Shell) script that will take zoneminder camera events and merge them into mp4 videos that can easily be archived, or viewed.  The script will also ftp the resultant videos to a remote ftp server.

Zoneminder is a bit cumbersome to locate a particular event or time using the mysql events, or the ZM timeline, but this script streamlines that a bit, allowing you to use VLC or whatever and speed it up to ‘scan’ your day’s or week’s events…..

Very easy to configure as everything is set up using variables.  The script will create a directory name of the current date that it’s run under your home directory, or wherever you choose.

I have it set to run as a cron event daily, but you can set it to run weekly or how often you choose by changing the mtime value, and configuring the cron event to match.

Loader Loading...
EAD Logo Taking too long?

Reload Reload document
| Open Open in new tab

Download [4.13 KB]

So as not to fill up the FTP server, I wrote a prune command that will delete those videos older than 60 days.  Also set to run as a cron event on the FTP server.  It will accept the following syntax:

/path.to.prune/prune </directory.path.containing.video.directories/

Loader Loading...
EAD Logo Taking too long?

Reload Reload document
| Open Open in new tab

Download

You will need to strip the .txt from both scripts and set them to chmod 700 and run them under the cron of the proper user.

Fender Bassman AB165 Mod – Switchable bass slope resistor part 1 – Remove death cap and bypass ground switch

This mod is the preface to putting in a switchable slope resistor for the bass channel.  First, unless you want to drill a hole to mount a switch, you may as well use the unneeded ‘ground switch’.  Also, if your amp still has the death cap, it will have to go, as well.  😉 You will need two 8 inch lengths of cloth covered stranded wire, if you wish to stay ‘period specific’.  Otherwise, you can use regular stranded wire, if that doesn’t concern you.  (I would keep the wire that you remove in case you wish to revert….) THIS LINK, Angela, has everything you might need, from cloth covered wire, to caps, or whatever.  So, besides the two 8 inch lengths of wire, you will need basic soldering skills.

And MAKE SURE that you discharge the caps, and verify it (like the video below) and UNPLUG the amp, since you will be working on the AC mains.

DO NOT MODIFY A RARE LEO FENDER AA864 CIRCUIT!!  ALSO, DO NOT ATTEMPT TO WORK ON THESE AMPS UNLESS YOU KNOW WHAT YOU ARE DOING, AS THEY CONTAIN VOLTAGES THAT ARE LETHAL AND WILL KILL YOU!!!

That being said, here’s a great video showing you how absolutely easy it is to discharge the filter caps in a tube amp.  This is how I’ve done it my whole life.  Remember, when in doubt, measure the B+ with a DMM!

In the picture at the right, you will notice the area that we will be concerned with, 20160909_104348_001and should be fairly common across the different Bassman circuits:  AA864, AA165, AB165….  You will notice on the right, that this amp has had the power cord replaced, and connected the hot and neutral wires to the two wire socket.  These wires are daisy chained across the ground switch before reaching the power switch and fuse holder.

20160909_105639-modFirst, we will remove the two small lengths of cloth covered wire connecting the black wire to the ground switch and the fuse holder.  As you can see in the picture to the left, I have removed those two wires from the terminals marked by the red arrows.

Next,we will remove the two small lengths of cloth covered wire connecting 20160909_111324_001-modthe white wire to the ground switch as well as the main power switch.  As you can see in the picture at the right, the points that I removed those wires from marked by red arrows.  You will also notice that the ‘death cap’ has been removed, as marked by the two green arrows.  (I actually just snipped off the lead going through the hole.)

20160909_112615Next, in preparation for actually wiring things back up, I removed the black and white power wires from the two wire socket.  I also cleaned out all the terminals of excess solder as you can see in the picture at the left.  I used a solder removal tool, but a cheap alternative is to use a round toothpick while heating up the terminal. 😉

Finally, we get to start wiring things back up!!  In the picture at the right,20160909_113804-mod you will notice that I slightly changed the orientation a little bit.  Now, the cloth covered wire is attached from the same direction as the white power cord.  (It’s far easier to get both wires through the terminal in the same direction.  I also marked the connection points with arrows.

Last connection!  20160909_120152-modIn the picture at the left, you can see that I connected the black wire to the fuse holder.  Now, we have the ground switch bypassed, and it can either be used, or replaced.   I will be installing a switchable bass slope resistor in the next installment.  I will remind you that solder ‘flows’ toward heat.  😉

Last check!  20160909_123918If you haven’t a lot of experience in doing things like this, I will suggest that you use a DMM to check continuity of all the changes that you have made.  Since I have 40 years experience, I simply plugged it in, and turned it on.  You will notice the maintenance stand that I built in an earlier post.  It makes it a lot easier to work on (and then test) your Bassman amp after you make changes.  I suggest that you make one.  Keep tuned for part 2.  😉

 

Fender Bassman AB165 Mod – Bass Ch. Tone Mod Easy (Slope Resistor Cont.)

This is the sixth installment on modifying a vintage Fender Bassman amp.  This will be a continuation of the last segment’s topic of altering the Bass Ch Slope Mod schematicvalue of the bass channel’s ‘slope’ resistor.  Last time, we took it from the stock 100K value down to 47K.  This time, we will push it even further down to 33K.  This should raise the gain a bit more and give the sound even more bite to it.  Once again, I am posting the schematic and layout Bass Ch Slope Mod layoutso that you can see exactly what we are talking about.  But, please remember to make absolutely SURE that the circuit is totally safe before touching anything.  This link to an earlier mod has a great  video that shows how easy it is to ensure that the filter caps are discharged in a tube amp.  Make SURE to watch the video!!

DO NOT MODIFY A RARE LEO FENDER AA864 CIRCUIT!!  ALSO, DO NOT ATTEMPT TO WORK ON THESE AMPS UNLESS YOU KNOW WHAT YOU ARE DOING, AS THEY CONTAIN VOLTAGES THAT ARE LETHAL AND WILL KILL YOU!!!

First, here’s a clip of the unmodified bass channel.  (100K slope resistor, and the hi-cut cap in the circuit.)

Bass Channel Unmodified

 

From the last segment, this is with the slope resistor changed to 47K, and the hi-cut cap removed from the circuit.

Bass and Guitar Channel 47K Ohm bass slope A/B

 

Finally, this is with the slope resistor changed to 33K and of course the hi-cut cap removed from the circuit.

Bass and Guitar Channel 33K Ohm bass slope A/B

 

Another possible value might be 68K for a reduction in the overall gain, (actually, a slight increase in gain from the stock 100K) and a more treble sound (a bit less treble than stock).  So, you get the picture.  Lowering the slope resistor value will raise the gain, and decrease the treble, and give it more bite.  At any rate, this gives you an idea of how changing that slope resistor will change the overall gain and voicing.  Remember, if you want to play a bass guitar through the bass channel, just flip the deep switch on, which will help to eliminate the higher frequencies.  😉

Tech, music, and general ramblings…..