Entries Tagged as 'Security'

Quick Random Password Generator for Perl

Mostly writing this for my own future benefit, but if this can help someone else in the process, perfect.

Basically, create random strings of random sizes using random characters until the size of the resulting string is greater than 16. Pretty simple.


my @alphanumeric = ('a'..'z', 'A'..'Z', 0..9,'!','_','-');
my @numeric = (0..9);
my $randpassword = '';

until ( length($randpassword) > 16 ) {
        $randpassword = $randpassword . join '', map $alphanumeric[rand @alphanumeric], 0..(rand @numeric);

print "$randpassword\n"

Save the resulting file as "randpasswd.pl" on a Linux system (I used Ubuntu), set as executable, and run it in a command line to generate a random password.

How to disable TLSv1 on Sophos UTM9 WAF for PCI

As freaking annoying as it is that the Sophos UTM, a security appliance, doesn't pass a PCI compliance scan, what's worse is that the process for disabling TLSv1 for sites running behind the Sophos WAF is not documented anywhere currently that I can find.

So, in an effort to help the community at large, I decided to docuemnet how I fixed it.

First, I was able to find excellent docuemnetation by a community member on how to disable TLSv1 for the Sophos Admin interface:


This is helpful, but I also needed to know how to disable TLSv1 for sites that run behind the Sophos WAF.

After (a lot) of digging, I found that the sites running behind the Sophos WAF do so through the Sophos Service "reverseproxy". This is the service we need to edit to remove TLSv1 support.

The above documentation talks about hwo to go about logging into the command line on a Sophos UTM9, so I won't repeat it. Once you're logged in, you'll need to run the following commands:

sudo vim /var/storage/chroot-reverseproxy/usr/apache/conf/httpd.conf

Update these to lines:

#SSLProtocol all -SSLv2 -SSLv3

to this

SSLProtocol +TLSv1.1 +TLSv1.2

The restart the 'reverseproxy" service with the following command:

sudo /var/mdw/scripts/reverseproxy restart

Check that you can no longer acccess your site using TLSv1 with the following command (updating it with your own domain name):

openssl s_client -connect utdream.org:443 -tls1

You'll get a handshake failed error if TLSv1 has been properly disabled:

SSL handshake has read 0 bytes and written 0 bytes

How to disable TLSv1.0 for PCI Compliance in Apache 2.2

Just recently our PCI compliance scanner started complaining about TLSv1.0 being enabled on our web server, so I had to go figure out how to disable it. The following is what I ended up with in our VirtualHost config which did what I wanted it to:
<VirtualHost xx.xx.xx.xx:443>
        SSLEngine on
        SSLProtocol +TLSv1.1 +TLSv1.2
        SSLCompression off
        SSLHonorCipherOrder On
        Header always append X-Frame-Options SAMEORIGIN

PCI Compliance TLSv1.0I simply removed the "all" option I had there previously and just manually enabled the TLSv1.1 and TLSv1.2. I also added the "Header" bit so that common browsers wouln't put our site in frames.

Now, checking our SSL certificate using the SSL Server Test we get an A rating. The downgrade from A+ being due to an upstream older SHA1 hash that we have no way to change and doesn't directly effect the security of our site, so as far as I'm concerned we look good.

The draw back is that older machines, such as those running Windows XP and versions of Android older than 4.2.2 will no longer be able to connect to us. Sorry about that. Since this is required for PCI compliance, there's not much we can do.

Fixing "JRun too busy or out of memory" for PCI compliance

One of our servers here at Vivio is routinely scanned for PCI compliance purposes. Until just recently, we've been using FuseGuard (A Web Application Firewal, or "WAF"), to block intrusion attempts to our web application. With new PCI standards that force us to allow PCI scans through our WAF (or IDS or whatever), we had to allow these requests through, but that brought to light another, different, problem.

During the PCI scan, our Apache logs would get a lot of the following error messages:

[notice] jrApache[13857: 62679]  returning error page for JRun too busy or out of memory

Initially we thought that since the message was coming from the JRun connector, that the issue had something to do with the connector. However, after quite a bit more research, we found it had to do with JRun itself, and the specific number of post parameters it's configured to accept. Any more then the default "100" post parameters, and you'll get the error you see above.

To change the number of post parameters, you will need to update your neo-runtime.xml file. For our case, ours was found here:

NEO XML Example

IMPORTANT: Editing this file isn't particularly easy. Opening it in VIM gives you a big wall of text.

By increasing the following parameter from 100 to 300, we were able to succesfully complete our PCI scan:

<var name='postParametersLimit'><number>300.0</number></var>

Hopefully this helps anyone else having this issue.

Apache 2.4 - 403 Forbidden (AH01630: client denied by server configuration)

I recently updated one of my development machines to Ubuntu 13.10 which now uses Apache 2.4 by default. In my case, I had updated a machine that was previously running Ubuntu version 13.04 and had been running Apache 2.2.

Apache 2.4After the upgrade, I was disturbed to find that none of my sites worked! I kept getting Apache 403 (Forbidden) error messages. I figured the upgrade had changed my configurations or something... but after fruitlessly messing with the config files (and seeing nothing wrong with them) I figured I'd look in the apache error log, which is located in /var/log/apache2/error.log by default on Ubuntu 13.10. To my surprise, I found lots of the following errors:

AH01630: client denied by server configuration: /path/to/my/sites

I had never seen that before. Then I noticed at the top of the log file "AH00163: Apache/2.4.6 (Ubuntu)". Ohhhhh....  So we're using the new 2.4 eh? After some google searches, I found out that Apache 2.4 comes with some security enhancements that attempt to make it more difficult for hackers to hide their files on a compromised system. That's neat, but I need to get my sites to work.

After reading a bit of the 2.4 Access Control Documentation, I found that a quick easy fix is to add a directory rule to your main apache config file (/etc/apache2/apache2.conf by default on Ubuntu):

<Directory /path/to/my/sites>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted

Restart Apache, and boom, all sites are now loading just fine. The idea behind these rules is to make it so that hackers who, say, use SQL injection to access your PHP site, have a harder time hiding their files in obscure directories on your system, amond other things.

Hope this helps!