Author Archives: dsackr

How to save iptables on a GoDaddy VPS that will stay after a reboot – hint: its not iptables-save!

There is a lot of information on iptables on the internet – a lot of great posts, however it took me a while to find out how to save iptables on a GoDaddy VPS (virtual private server ) in a way that is persistent (stays after a reboot).

The rules your VPS uses when iptables are restarted or the server is rebooted are found in file /etc/sysconfig/iptables. Best practice is to add rules to your server using the iptables command, but as you know, those rules won’t stay after you restart the service or reboot the server.

Once you have iptables running the way you want – you can type iptables-save and it will output on the screen your iptable rules as you would want them in the /etc/sysconfig/iptables file, but it does not save those rules to your /etc/sysconfig/iptables file. It just outputs it to the screen – no matter how many forums and blogs out there say otherwise.

So here is what I do when working with iptables, in order to save my changes:

  1. add rules using iptables commands
  2. validate they work as expected
  3. backup my existing /etc/sysconfig/iptables file using this command:
    • cp /etc/sysconfig/iptables /etc/sysconfig/iptables.rules
  4. run the iptables-save command, redirecting the output to /etc/sysconfig/iptables using this command:
    • iptables-save > /etc/sysconfig/iptables

If you did that correctly – your new rules will persist after a reboot or restart of the iptables service.

On a sidenote – its good practice to setup a cron job to stop iptables every 5 mins while you are working on them. This way, if you lock yourself out, all you have to do is wait 5 mins and you can get back on the box to undo whatever you have done. Just don’t forget to stop the cronjob after you are done working with iptables.

Effective Ad Campaign: deciding your max bid for Google Adsense price per click (PPC)?

Are you looking to create an effective ad campaign? That can be a long worth while conversation. In this article, I’m going to focus on one aspect of creating an effective ad campaign: How do you know what to bid in Google Adsense for your max bid? Its a simple equation:

 PPC = M * WCR * ROI

If that makes sense to you, then you are all set and don’t need to read the rest of this post… Otherwise, continue reading.

In my experience, the max bid is a question that most small businesses don’t ask until they are filling out the Adsense forms for their ad. That’s easy to understand, there are a lot of things to consider when spending capitol to enhance your business, but in truth this one question that will determine how effective your campaign will be and the equation above will determine the right price point.

There are a few things you must know to make the right decision. Some are obvious and easy to determine like the sale price of your product and your costs to produce it. A more difficult number is your website conversation rate. This is the number of people that actually buy your product verses the number of people that see your site.

You also need to consider your return on investment. For every dollar you spend in advertising, you are going to want to earn that dollar back plus… what? Ten percent? Fifty percent? That would be your ROI.

Ok – lets run some numbers. Lets say your product sells for $15 and costs you $10. Your margin (M) is $5. You look at your site traffic and see your website conversation rate is 2%. And you already know you want a 50% return on your money or $1.50 for every $1 you spend. Great; now lets plug in the numbers to the equation:

PPC = $5 * 0.02 * 0.50

Your max bid for a click on a Google Ad is $0.05. In this case, Google Ads don’t make sense for you since a bid of five cents won’t put you on the page! Your numbers will be different of course.

WordCamp Phoenix started today!

I’m at the 401 level class for WordCamp Phoenix! So for, its been pretty great. There was a little bit of a debate regarding smart phone adoption verses “feature” phones and a good conversation around QR codes. I’m learning a lot regarding developing plugins that interact with the admin panel – specifically best practices around the code itself. Very geeky and pretty cool!

Tomorrow is the main event. I’m pretty excited about it!

Showing Sharepoint Appended Comments in a dataview webpart

I searched for hours on this one when I came across a few good posts.  The first one I came across talks about using a custom form in display mode to show all of the history from an “Append Changes to Existing Text” field.  Here is a link to that post:

http://unitedsupplyco.sharepointsite.net/publicfacing/bensblog/Lists/Posts/Post.aspx?ID=41#Comments

The author suggests that he/she doesn’t know how to make this work in a dataview webpart.  When I tried this, I got this error:

object reference not set to an instance of an object

I would have likely lived with a custom form as the solution, however since it didn’t work for me, I continued to search.  Next I found a post that basically gives the same solution but this time in a dataview webpart! That post is here:

http://sympmarc.com/2011/02/07/showing-all-versions-of-append-changes-to-existing-text-in-a-data-view-web-part-dvwp

Awesome, except I was still getting an error.  Both posts suggest the solution is to replace the xsl line:

<xsl:value-of select=”[your column name]” disable-output-escaping=”yes” />

with this line:

<SharePoint:AppendOnlyHistory runat=”server” FieldName=”[your column name]” ControlMode=”Display”/>

You should, obviously, replace the [your column name] with the name of your SharePoint column.  Since this was the same solution in both posts (one in a custom form webpart and the other in a dataview webpart), I knew my error message must be from something I’m missing.

Then I figured it out through trial and error.  When I replaced my column name – I took the name from the xsl line – in my case it was {@Project_x0020_Notes} – and put it in the new non-xsl line.  That is when I get the error message.  So I tried removing the curly brackets – no luck.  I tried removing the @ sign – still no luck.  Then, in a total shot in the dark, I tried using the SharePoint friendly name “Project Notes” instead of the xsl formated name Project_x0020_Notes.

BAM! That worked and now I can display all the appended comments in a dataview webpart!  Hope that helps you!

 

PCI Compliance

If you have a server that is involved in eCommerce – you MUST be PCI complaint.  Here are a few steps to get a virtual private server running cpanel/whm PCI complaint:

Disable TRACE or TRACK method

  1. Access your Web Hosting Manager (WHM)
  2. Under Service Configuration, click the link for Apache Configuration
  3. Click the Global Configuration link
  4. The second option is TraceEnable.  Set this to OFF.
  5. Restart Apache

Disable weak ciphers

I logged into my WHM (11.24) > Apache Configuration > Global Configuration, and here is a direct cut and paste:

ALL:!ADH:!NULL:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:-LOW:+SSLv3:+TLSv1

More to come…

iptables – quick how to block a port (and save it)

If you don’t know what iptables are – don’t bother reading this post.

I had a recent issue with the vncserver on my virtual private server – I don’t use the service and wouldn’t have turned it on, however the hosting provided I acquired the vps from included it in their base build, enabled and listening on both ports 5902 and 5903.  I turned the service off (using ‘chkconfig vncserver off’).  But, ever after that – my server was still responding to ports 5902 and 5903.

Ok – so if its not vncserver – I don’t know what it is.  But ‘netstat -tp’ didn’t reveal anything listening on those ports.  So rather than waste a lot of time trying to figure it out – I figured I would take the easy route and block the port.  This is how I did it:

iptables -A INPUT -p tcp –dport 5902 -j DROP
iptables -A INPUT -p tcp –dport 5903 -j DROP

I derived those commands from here: http://www.linuxforums.org/forum/linux-security/29397-closing-ports.html using input from Goran.

Ok – telnet to those ports no longer responds – great!  But then I rebooted the server (actually I just restarted iptables using ‘service iptables restart’).  Now my server is replying to those ports again.  DOH!

I realized I need to save the firewall rules after I ran them.  I read a lot about exporting and importing the rules using iptables-save and iptables-restore – but this seemed like overkill.  I finally found this: http://www.linuxquestions.org/questions/red-hat-31/how-to-save-iptables-415929/

‘service iptables save’

Volla – worked like a champ!  Hope it helps you!

How to set different prices for each store view in Magento

If you have more than one Magento website (say a wholesale site for retailer clients and a retail site for consumers) you may find yourself wanting to set one price for site A and a different price for site B.  Here is how:

Step 1.  In the Admin panel, goto System, Configuration, Catalog, then Price.

Step 2. Change Price from Global to Website.

Step 3. You should see “Website” on the price page for the product now, instead of “Global”.

Step 4. For each product you want to set different prices on – select the product, then in the upper left corner you will see the option to chose your store view.  Select the first store

Step 5. Set the price for the first store and click “Save and Continue Editing”

Step 6. Select the store view for your second store and set the price for that store

Step 7. Repeat step 6 until all of your store have the prices you want.