Fixing an IPTables Startup Error on CentOS 6

If you’re running CentOS 6 on a virtual server, you may run into the following problem when you try to restart iptables:

# service iptables restart
iptables: Setting chains to policy ACCEPT: security raw nat[FAILED]filter 
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Unloading modules:                               [  OK  ]
iptables: Applying firewall rules:                         [  OK  ]

It’s a fairly simple fix. First, open up /etc/init.d/iptables in your favorite text editor, and look for this section of code:

   echo -n $"${IPTABLES}: Setting chains to policy $policy: "
    ret=0
    for i in $tables; do
        echo -n "$i "
        case "$i" in
            raw)
                $IPTABLES -t raw -P PREROUTING $policy \
                    && $IPTABLES -t raw -P OUTPUT $policy \
                    || let ret+=1
                ;;

After the “case” line, and before the “raw)” line — i.e. between lines 5 and 6, above — add the following:

           security)
               $IPTABLES -t filter -P INPUT $policy \
                   && $IPTABLES -t filter -P OUTPUT $policy \
                   && $IPTABLES -t filter -P FORWARD $policy \
                   || let ret+=1
               ;;

When you’re done, the whole section should look like this:

   echo -n $"${IPTABLES}: Setting chains to policy $policy: "
    ret=0
    for i in $tables; do
        echo -n "$i "
        case "$i" in
            security)
                $IPTABLES -t filter -P INPUT $policy \
                    && $IPTABLES -t filter -P OUTPUT $policy \
                    && $IPTABLES -t filter -P FORWARD $policy \
                    || let ret+=1
                ;;
            raw)
                $IPTABLES -t raw -P PREROUTING $policy \
                    && $IPTABLES -t raw -P OUTPUT $policy \
                    || let ret+=1
                ;;

Then, restart iptables, and things should be fine.

# service iptables restart
iptables: Setting chains to policy ACCEPT: security raw nat[  OK  ]filter 
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Unloading modules:                               [  OK  ]
iptables: Applying firewall rules:                         [  OK  ]

How to Run Multiple Instances of VLC on OS X

VLC is one of the very best media players out there, but on OS X it’s got one minor frustration: unlike other players (Quicktime Player, for example), VLC on the Mac only allows a single player instance at a time. Unless you get tricky. Here’s how.

We’re going to create an Applescript “droplet” which will create a new instance of VLC any time you drop a playable media file onto it. Start by opening up the Script Editor app — it’s in the Applications/Utilities folder by default — and create a new script with the following contents:

on run
    do shell script "open -n /Applications/VLC.app"
    tell application "VLC" to activate
end run

on open theFiles
    repeat with theFile in theFiles
        do shell script "open -na /Applications/VLC.app " & quote & (POSIX path of theFile) & quote
    end repeat
    tell application "VLC" to activate
end open

Next, select the save command, but before you save it out, change the file format to “Application” using the pop-up selector in the Save… dialog:

Script EditorScreenSnapz002

If you save this to your Desktop, you can simply drag and drop any media file that VLC can play back onto it, and it’ll open up the movie in a brand-new instance of VLC.

Installing Splunk on El Capitan

If you try to install Splunk Enterprise on an El Capitan system, you’re going to run into some errors when you try starting it up:

$ /Applications/Splunk/bin/splunk start
dyld: Library not loaded: /Users/eserv/wrangler-2.0/build-home/ember/lib/libmongoc-1.0.0.dylib
  Referenced from: /Applications/Splunk/bin/splunkd
  Reason: image not found
dyld: Library not loaded: /Users/eserv/wrangler-2.0/build-home/ember/lib/libmongoc-1.0.0.dylib
  Referenced from: /Applications/Splunk/bin/splunkd
  Reason: image not found
dyld: Library not loaded: /Users/eserv/wrangler-2.0/build-home/ember/lib/libmongoc-1.0.0.dylib
  Referenced from: /Applications/Splunk/bin/splunkd
  Reason: image not found
Did not find "disabled" setting of "kvstore" stanza in server bundle.

In order to get around this, execute the following commands:

$ sudo mkdir -p /Users/eserv/wrangler/build-home/6.2.6
$ sudo ln -s /Applications/Splunk/lib /Users/eserv/wrangler/build-home/6.2.6/lib

$ sudo mkdir -p /Users/eserv/wrangler-2.0/build-home/ember/
$ sudo ln -s /Applications/Splunk/lib /Users/eserv/wrangler-2.0/build-home/ember/lib

Then execute

$ /Applications/Splunk/bin/splunk restart

and everything should work fine.