Category Archives: Sysadmin - Page 2

Upgrade Perl on FreeBSD with portupgrade

Upgrading perl is very simple. It just takes a long time to compile everything again. See the script below how to do it. If you have an other version of perl from which you upgrade don’t forget to change the version number then!

# lang/perl5.12 is out. If you want to switch to it from, for example
#  lang/perl5.10, that is:
# Portupgrade users:
 
# 0) Fix pkgdb.db (for safety):
pkgdb -Ff
 
# 1) Reinstall new version of Perl (5.12):
env DISABLE_CONFLICTS=1 portupgrade -o lang/perl5.12 -f perl-5.10.\*
 
# 2) Reinstall everything that depends on Perl:
portupgrade -fr perl

[warn] (2)No such file or directory: Failed to enable the ‘httpready’ Accept Filter

What to do when you find this nasty error!
The solution is pretty simple!

Performing sanity check on apache22 configuration:
Syntax OK
Starting apache22.
[Wed Sep 17 22:01:58 2008] [warn] (2)No such file or directory: Failed to enable the 'httpready' Accept Filter

Just open shell prompt and type the following command to load accf_http under FreeBSD :

kldload accf_http

Restart apache:

/usr/local/etc/rc.d/apache22 restart

Type the following command so that driver get loaded at the time of booting system:

echo 'accf_http_load="YES"' >> /boot/loader.conf

Request a SSL certificate

When you often use openSSL there are a couple of commands which are handy and come by often. Here are a few of those command that come by regularly.

General OpenSSL Commands

These commands allow you to generate CSRs, Certificates, Private Keys and do other miscellaneous tasks.

  • Generate a new private key and Certificate Signing Request
    openssl req -out CSR.csr -new -newkey rsa:2048 -nodes -keyout privateKey.key

     

  • Generate a self-signed certificate (see How to Create and Install an Apache Self Signed Certificate for more info)
    openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout privateKey.key -out certificate.crt

     

  • Generate a certificate signing request (CSR) for an existing private key
    openssl req -out CSR.csr -key privateKey.key -new

     

  • Generate a certificate signing request based on an existing certificate
    openssl x509 -x509toreq -in certificate.crt -out CSR.csr -signkey privateKey.key
  • Remove a passphrase from a private key
    openssl rsa -in privateKey.pem -out newPrivateKey.pem

Checking Using OpenSSL

If you need to check the information within a Certificate, CSR or Private Key, use these commands. You can also check CSRs and check certificates using our online tools.

  • Check a Certificate Signing Request (CSR)
    openssl req -text -noout -verify -in CSR.csr
  • Check a private key
    openssl rsa -in privateKey.key -check
  • Check a certificate
    openssl x509 -in certificate.crt -text -noout
  • Check a PKCS#12 file (.pfx or .p12)
    openssl pkcs12 -info -in keyStore.p12

Debugging Using OpenSSL

If you are receiving an error that the private doesn’t match the certificate or that a certificate that you installed to a site is not trusted, try one of these commands. If you are trying to verify that an SSL certificate is installed correctly, be sure to check out the SSL Checker.

  • Check an MD5 hash of the public key to ensure that it matches with what is in a CSR or private key
    openssl x509 -noout -modulus -in certificate.crt | openssl md5
    openssl rsa -noout -modulus -in privateKey.key | openssl md5
    openssl req -noout -modulus -in CSR.csr | openssl md5
  • Check an SSL connection. All the certificates (including Intermediates) should be displayed
    openssl s_client -connect :443

Converting Using OpenSSL

These commands allow you to convert certificates and keys to different formats to make them compatible with specific types of servers or software. For example, you can convert a normal PEM file that would work with Apache to a PFX (PKCS#12) file and use it with Tomcat or IIS. Use our SSL Converter to convert certificates without messing with OpenSSL.

  • Convert a DER file (.crt .cer .der) to PEM
    openssl x509 -inform der -in certificate.cer -out certificate.pem
  • Convert a PEM file to DER
    openssl x509 -outform der -in certificate.pem -out certificate.der
  • Convert a PKCS#12 file (.pfx .p12) containing a private key and certificates to PEM
    openssl pkcs12 -in keyStore.pfx -out keyStore.pem -nodes

    You can add -nocerts to only output the private key or add -nokeys to only output the certificates.

  • Convert a PEM certificate file and a private key to PKCS#12 (.pfx .p12)
    openssl pkcs12 -export -out certificate.pfx -inkey privateKey.key -in certificate.crt -certfile CACert.crt

source: http://www.sslshopper.com/article-most-common-openssl-commands.html

Backup Exec 2012 – HP MSL 2024

I installed Backup Exec 2012 on a new DL380 Machine which I connected to our HP MSL 2024. When I started to backup our environments all the backup’s ran into problems.

They all run into one of this two errors:

  1. Adamm Mover Error: Write Failure!
  2. An unknown error has occurred.

And for both Symantec Backup Exec 2012 blamed the tape drive. A device attached to the computer doesn’t work correctly. I ran all the HP Tape storage tools tests and they all indicated that the MSL was working correctly. After digging into google I found the solution for this problem on the site from Symantec  (http://www.symantec.com/business/support/index?page=content&id=TECH61192).

Disabling SCSI Information from HP did the trick. 

Disable the HP Management Agents:  
Go to Control Panel > HP Management Agents, select the Services tab, then move SCSI Information to the Inactive Agents column.  Retry the backup job.
If it still fails, try moving the performance monitor agent to the disabled column and try the backup again.
Disable the following HP services, and reboot the server and test another backup:  –  HP Insight Server Agents
–  HP Insight Storage Agents
–  HP Insight Foundation Agents
   –  HP WMI Storage Providers service
NOTE: Not all three services may be present. Only disable what is listed above.

Send postfix-logwatch from previous day

I like to monitor my mail servers with postfix-logwatch which is a great tool to tell what was happening on you’re server. And because I don’t wanna miss anything I added the following line to my crontab to mail me an update every night around 4 in the morning.

0       4       *       *       *       
    root    /usr/bin/zcat /var/log/maillog.0.bz2 
    | /usr/local/bin/postfix-logwatch 
    | mail -s "Mailserver log summary for: `hostname`" sysadmin@example.com

All of this in actually in one line in my cronfile but it does not fit the page :). If you don’t compress you’re logs. remove bz2 and use cat instead of zcat.

telnet client for a ssl line.

Sometimes it is handy to debug services by hand. For plain services telnet is always a handy tool. But it is completely useless for ssl encoded services. But OpenSSL to the rescue!

openssl s_client -connect

Test SMTP server using telnet

The steps to test a email server are quite simple.
below you will find the steps to do so.
In these examples mail.example.com is the domain of the server which is tested.

> telnet mail.example.com 25
< 220 fallback.xeed.nl ESMTP Postfix
> EHLO test.com
< 250-mail.example.com
< 250-PIPELINING
< 250-SIZE 10240000
< 250-VRFY
< 250-ETRN
< 250-ENHANCEDSTATUSCODES
< 250-8BITMIME
< 250 DSN
> MAIL FROM: foo@test.com
<
250 OK – MAIL FROM foo@test.com
> RCPT TO: User@test.com
< 250 OK – Recipient User@test.com
> DATA
<  354 Send data. End with CRLF.CRLF
> type the message and end with <return> . <return>
< 250 OK
> QUIT
< 221 closing connection

The output of the server may vary from server to server. but the commands are the same.

 

Exchange Webmail Redirect to https

With de default installation of exchange with a SSL certificate users get a pesky 403 error. This is because SSL is required. Which of course is a good thing on it self but people nearly always forget to type the https in there browsers.The easiest way to redirect to the secure https site is by creating a file “Default.html” and add the following code to that file.

<xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
         Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"?
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>Redirecting...</title>
        <meta http-equiv="refresh" content="0;url=https://{YOURHOSTNAME}/owa" />
    </head>
<body>
    Redirecting you to the webmail site...<br />
    If Nothing happens click here: <a href="https://{YOURHOSTNAME}/owa">https://{YOURHOSTNAME}/owa</a>.
</body>
</html>

[Example in File]

After you have created the file set IIS to allow none
https traffic. This setting can be found under Sites
-> Default Web Site -> SSL Settings. Untag the Require SSL Tickbox. And you are all set.