Oct 11

Python Script Execution

Learning Python and ran into an issue trying to get my first script to run. When I ran the script by calling it from an HTML file, I would get a 500 Server Error. In the logs I saw this:

[Mon Oct 10 22:48:24.670771 2016] [cgi:error] [pid 312899:tid 140374432446208] [client 75.134.73.141:32291] AH01215: suexec policy violation: see suexec log for more details:

So I SSH’d into the box to try running the script manually, and got this:

-bash: ./test.py: /usr/bin/python^M: bad interpreter: No such file or directory

As it turns out, I was editing in JetBrains Webstorm on Windows, and uploading to a Linux server. Windows enters in new line returns as CRLF, where as Unix operating systems will only work if they see LF.

In WebStorm, you can change this setting by going to File, Line Separators and changing it. This is on a per file basis, and only needed for scripts being run through an interpreter. Running the script directly (python test.py) worked fine.

Jun 05

Story Spine

A member of our club introduced us to the concept of a Story Spine, used primarily to assist in developing story outlines. It also can be used as a great impromptu guide for creating a story as an alternative for Table Topics. I developed a MS PowerPoint version with animation to help people stay on track, formatted for projector usage.

Here is a link to the file:

Story-Spine

Jun 05

Advanced Custom Fields – Shortcode

Ran into an issue where I wanted to create an interface where I could dynamically use the output of the ACF plugin within the pages, to allow a combination of the ACF and WSIWYG editor. I ended up creating the following function and adding it to ‘functions.php’ in my template:

/* Advanced Custom Fields Shortcode */
function get_acf( $atts ) {

    // Attributes
    $atts = shortcode_atts(
        array(
            'field' => '',
        ),
        $atts,
        'getacf'
    );

    // Return only if has field attribute
    if ( isset( $atts['field'] ) ) {
        //$field_value =
        return get_field($atts['field']);
    }

}
add_shortcode( 'getacf', 'get_acf' );

Feb 17

Table Topics Ideas

I recently tried to mix in a couple of skills for a recent Toatmasters meeting Table Topics session.

I took photo’s of really unusual houses I found on the internet, put them into a slide show, and asked participants to either try to sell the house, or to convince us why their house was an awesome place.

One participant acted as a real estate agent, another told us why their house was like living in their dream vacation all the time, another pretended to be the housing association president and point out why the house was not a good fit for the neighborhood.

Great time overall, and it had people practice both impromptu speaking and using a projector at the same time.

 


 

Feb 17

Cisco ASA IKE Vulnerability

https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-20160210-asa-ike

Massive issue that should be addressed ASAP. Classified as a PATCH NOW level of concern.

Feb 13

vCenter – unable to perform vMotion or storage vMotion

If you get the error ‘The operation is not allowed in the current state’, try restarting the management agents on the hosts (non disruptive, other than you will lose vSphere client connectivity):

VMware KB Article – Restart Management Agents

Restarting the Management agents on ESXi

To restart the management agents on ESXi:

From the Direct Console User Interface (DCUI):

  1. Connect to the console of your ESXi host.
  2. Press F2 to customize the system.
  3. Log in as root.
  4. Use the Up/Down arrows to navigate to Restart Management Agents.Note: In ESXi 4.1 and ESXi 5.0, 5.1, 5.5 and 6.0 this option is available under Troubleshooting Options.
  5. Press Enter.
  6. Press F11 to restart the services.
  7. When the service restarts, press Enter.
  8. Press Esc to log out of the system.

 

From the Local Console or SSH:

  1. Log in to SSH or Local console as root.
  2. Run these commands:/etc/init.d/hostd restart
    /etc/init.d/vpxa restart

Feb 13

Unable to connect to the MKS: Internal Error

Ran into this issue on vSphere 5.5 & 6.0(base, U1, U1b) using the full client.

Power off the VM, remove from inventory, browse the datastore, right click the VMX file, add to inventory. This resolved my issues.

Nov 07

Cisco PBR route-map update

We recently ran into an issue when updating an ACL we used in a Cisco PBR configuration. We changed the name of the ACL, and updated the route-map to reflect the new ACL name. All traffic stopped being processed by the route-map as it if wasn’t even in the configuration. Luckily for us this situation had the effect of all traffic followed the routing table, as opposed to going into the bit bucket.

Cisco identified the following bug as being responsible: CSCty21119

The workaround was to remove the route-map from the interface and reapply it. Essentially the TCAM wasn’t updating with the changes, and upon deletion of the old ACL the router didn’t know what to do because it was referencing a non-existent ACL.

Nov 07

WordPress – Restrict Login by IP

Enable the use of HTACCESS overrides:

sudo nano -w /etc/apache2/sites-available/xxx.conf

Add this line:
AllowOverride All

-----

If you have a static IP and want to restrict access, a simple way is to lock down access to the wp-login.php file using .htaccess to control:

<files wp-login.php>
order deny,allow
deny from all
# whitelist Your First IP address
allow from xxx.xxx.xxx.xxx
# whitelist Your Second IP address
allow from xxx.xxx.xxx.xxx
#whitelist a /24 subnet (10.1.1.0 /24 example)
allow from 10.1.1.0/24
</files>

—–

Multiple Files Example:

<FilesMatch "index\.php|index\.html">
 Order deny,allow
 Deny from all
 Allow from x.x.x.x
 Allow from 10.1.0.0/24
</FilesMatch>