Sunday, 9 September 2012

master domain

Use /usr/share/doc/bind-*/sample/etc/named.conf to see examples of configuration

Install the bind packages
#yum install bind-chroot system-config-bind -y

Run the bind configuration utility which will create the config files for you.
#system-config-bind

Create a new master zone

Wednesday, 5 September 2012

configure httpd to use passwords and/or network location to restrict access to content

Install apache
#yum install httpd -y

#######################################################################
USING PASSWORDS TO RESTRICT ACCESS
#######################################################################

Edit the apache config
#vim /etc/httpd/conf/httpd.conf

<Directory "/var/www/html/protected">
    AllowOverride Authconfig
</Directory>

Create the protected area

#mkdir /var/www/html/protected
#echo "Only authorised personal can see this" > /var/www/html/protected/index.html

Use htpasswd to create an auth file
#htpasswd -c -m /var/www/userfile username

Create the following file with the following config
#vim /var/www/html/protected/.htaccess

AuthName "Access to protected area"
AuthType Basic
AuthUserFile /var/www/userfile
require valid-user

Restart apache
#service httpd restart

You should then be prompted when you try and access http://servername/protected

#######################################################################
USING NETWORK LOCATION TO RESTRICT ACCESS
#######################################################################

Edit the apache config
#vim /etc/httpd/conf/httpd.conf

Directory "/var/www/html/protected">
    Order allow,deny
    Allow from .example.com
    Deny from All
</Directory>

Restart apache
#service httpd restart



Tuesday, 4 September 2012

configure httpd to use a SSL certificate signed by a certifying authority

You will need to use the CA created using configure-certificate-authority-ca

Install apache and mod_ssl packages
#yum install httpd mod_ssl -y

Create a key
#openssl genrsa -out server.example.com.key 1024

Create a certificate signing request
#openssl req -new -key server.example.com.key -out server.example.com.csr

Sign the certificate with the CA
#cp server.example.com.csr /etc/pki/CA/newreq.pem
#/etc/pki/tls/misc/CA.pl -sign

Copy the signed cert somewhere into the /var/www tree somewhere or make sure that it has the correct security context
#mkdir /var/www/certs
#mv /etc/pki/CA/newreq.pem /var/www/certs/server.example.com.crt
#mv server.example.com.key /var/www/certs/server.example.com.key

Edit /etc/httpd/conf.d/ssl.conf

SSLCertificateFile /var/www/certs/server.example.com.cert
SSLCertificateKeyFile /var/www/certs/server.example.com.key

Restart apache
#service httpd restart

Test connection!

configure a certificate authority (CA) and sign certificate requests


Install the perl openssl package
# yum install openssl-perl

Change to the directory where the CA.pl script is located
# cd /etc/pki/tls/misc/

Create the CA
# ./CA.pl -newca

Make the CA Certificate available using http or some other method.

Configure POP/IMAP to use SSL/TLS for secure communication

This needs to be done after creating the certificate authority

#yum install dovecot -y

Edit /etc/dovecot.conf to allow on the protocols you require by changing the protocols value

Edit /etc/pki/dovecot/dovecot-openssl.cnf with the relevant information

Delete the old certificates
#rm /etc/pki/dovecot/private/dovecot.pem
#rm /etc/pki/dovecot/certs/dovecot.pem

Run the mkcert script
#/usr/share/doc/dovecot-1.0.7/examples/mkcert.sh

Restart dovecot
#service dovecot restart

Open the required ports on the firewall

ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:imaps
ACCEPT     udp  --  anywhere             anywhere            state NEW udp dpt:imaps
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:pop3s
ACCEPT     udp  --  anywhere             anywhere            state NEW udp dpt:pop3s

You can test this using mutt, copy the ca certificate to the .mutt directory in the users home directory and run mutt

#mutt -f imaps://user@server

Check the maillog of the server 

Sep  4 13:32:40 auth1 sendmail[6037]: q84KWdRd006036: to=<adam@auth1.example.com>, ctladdr=<root@auth1.example.com> (0/0), delay=00:00:01, xdelay=00:00:00, mailer=local, pri=30529, dsn=2.0.0, stat=Sent
Sep  4 13:34:02 auth1 dovecot: imap-login: Login: user=<user>, method=PLAIN, rip=::ffff:172.16.118.135, lip=::ffff: TLS