Often times, I employ a CentOS VirtualBox virtual machine (VM) as a development, testing and staging environment, I love the flexibility of virtual environments for testing and development work before moving my work to production environments.
Recently I ran a yum update and yum upgrade on a CentOS 6.4 VM and subsequently rebooted it, only to be greeted by a blank screen following bootup. A quick search of virtual TTY terminals yielded a login prompt.
Search of the usual logs (/var/log/messages and /var/log/dmesg) did not yield anything useful, however, the /var/log/Xorg.0.log displayed some interesting messages. Of particular interest were;
"... (EE) Failed to load module "vboxvideo" (module requirement mismatch, 0)"
... (EE) No drivers available."
Fatal server error:"
... no screens found"
A bit of Google revealed "http://www.centos.org/modules/newbb/print.php?form=1&topic_id=41799&forum=55&order=ASC&start=0" So I followed suit and backed up the /etc/X11/xorg.conf file and rebooted :) All is well...
Welcome to my blog, For more information about me, visit my website at https://www.kush.com.fj. This blog is mostly just a journal.
4/04/2013
3/28/2013
Snort 2.9 on CentOS 6.3 (continued) with Barnyard2
This is a continuation of the post on installing Snort 2.9 on CentOS
6.4 (http://nkush.blogspot.com.au/2013/03/snort-29-on-centos-63.html).
This post installs Barnyard2 on the host.
Barnyard is an output system for Snort. If effectively allows better snort performance by enabling Snort to produce binary output which is then processed by Barnyard.
Barnyard processes the binary Snort output files (unified2 binary) and stores the processed data into a database back-end, for example MySQL. The advantage of using Barnyard instead of the database output from Snort is that Barnyard is able to "cache" the data in case the database is unavailable.
Barnyard is able to be executed in three modes, this example employs the continual mode with bookmarking. A bookmark (waldo) file is employed to keep track of the progress of Barnyard processing. In case of Barnyard failure, it can resume where it left off based on the bookmark file.
Installation:
If all goes well then you should see events being logged into your event table in the barnyard2 database.
Errors:
Barnyard is an output system for Snort. If effectively allows better snort performance by enabling Snort to produce binary output which is then processed by Barnyard.
Barnyard processes the binary Snort output files (unified2 binary) and stores the processed data into a database back-end, for example MySQL. The advantage of using Barnyard instead of the database output from Snort is that Barnyard is able to "cache" the data in case the database is unavailable.
Barnyard is able to be executed in three modes, this example employs the continual mode with bookmarking. A bookmark (waldo) file is employed to keep track of the progress of Barnyard processing. In case of Barnyard failure, it can resume where it left off based on the bookmark file.
Installation:
- Install and configure MySQL
- yum -y install mysql mysql-server mysql-devel mysql-bench
- service mysqld start
- /usr/bin/mysql_secure_installation
- Download and install Barnyard2 from http://securixlive.com/barnyard2/download.php
- wget http://securixlive.com/download/barnyard2/barnyard2-1.9.tar.gz
- tar zxvf barnyard2-1.9.tar.gz
- cd barnyard2-1.9
- ./configure --with-mysql --with-mysql-libraries=/usr/lib64/mysql/
- make
- make install
- Configure Barnyard to process Snort output
- Change Snort config to output to the unified file format
- output unified2: filename merged.log, limit 128, mpls_event_types, vlan_event_types
- Change the Barnyard config (/usr/local/etc/barnyard2.conf)
- config logdir: /var/log/barnyard2
- config hostname: localhost
- config interface: ethX
- config daemon
- config set_gid:nnnn
- config set_uid:nnnn
- config show_year
- config umask: 066
- config waldo_file: /var/log/snort/barnyard2.waldo
- input unified2
- output database: log, mysql, user=snort password=password dbname=barnyard2 host=localhost
- Create the MySQL database for Barnyard
- mysqladmin -u root -p create barnyard2
- mysql -u root -p -D barnyard2 < ./schemas/create_mysql
- Grant privileges to database
- mysql -u root -p
- GRANT ALL PRIVILEGES ON barnyard2.* TO snort@localhost WITH GRANT OPTION;
- SET PASSWORD FOR snort@localhost=PASSWORD('password');
- Prepare Barnyard2
- touch /var/log/snort/barnyard2.waldo
- chown -R snort:snort /var/log/snort
- Run Barnyard then Snort
- barnyard2 -c /usr/local/etc/barnyard2.conf -d /var/log/snort/ -w /var/log/snort/barnyard2.waldo -f merged.log -u snort -g snort -D
- snort -c /etc/snort/snort.conf -i eth4 -u snort -g snort -D
If all goes well then you should see events being logged into your event table in the barnyard2 database.
Errors:
- ERROR: unable to find mysqlclient library (libmysqlclient.*)
- ./configure --with-mysql-libraries=/usr/lib64/mysql/
- ERROR: Unable to open directory '' (No such
file or directory)
ERROR: Unable to find the next spool file! - Ensure that the waldo file is specified (by the -w option included as a command line argument or in the config file)
- WARNING: Can't extract timestamp extension from 'alert'using base ''
- Ensure that the unified2 file is specified (by the -f option included as a command line argument or in the config file)
- FATAL ERROR: Absdir is not a subset of the logdir
- Ensure that the logdir is configured in the Barnyard configuration file
- FATAL ERROR: database: mysql_error: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
- Ensure that the MySQL service/daemon is running
3/16/2013
Snort 2.9 on CentOS 6.3
Snort is a signature based network intrusion detection system (NIDS) which has become a defacto standard for NIDS. In addition to being used as a NIDS, Snort may also be used as a simple network traffic packet sniffer or logger.
A number of Snort dynamic preprocessors are available which enables the development of rules to attack detection.
Snort is an open source product and available for most popular network operating systems. Snort rules are also available commercially from Sourcefire.
The following instruction detail the installation of Snort 2.9.4 on a CentOS 6.3 64bit host. The installation instructions include the installation of Snort rules available to registered Snort users, as well as third party rules available from EmergingThreats.
Installation:
Snort exiting
I plan to have a subsequent blog post to record instructions for installing and configuring barnyard, oinkmaster and BASE. Instructions in a previous post using an older version of Snort and CentOS can be found at http://nkush.blogspot.com.au/2011/10/installing-snort-2912-on-centos-57.html
References
A number of Snort dynamic preprocessors are available which enables the development of rules to attack detection.
Snort is an open source product and available for most popular network operating systems. Snort rules are also available commercially from Sourcefire.
The following instruction detail the installation of Snort 2.9.4 on a CentOS 6.3 64bit host. The installation instructions include the installation of Snort rules available to registered Snort users, as well as third party rules available from EmergingThreats.
Installation:
- Install dependencies
- yum -y update
- yum -y install gcc flex bison wget make
- yum -y install zlib zlib-devel
- yum -y install libpcap libpcap-devel
- yum -y install pcre pcre-devel
- rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm #(or rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm for 32 bit machines)
- yum -y update
- yum -y install libdnet libdnet-devel
- Download and install DAQ
- cd /root/
- wget http://www.snort.org/downloads/2216 -O daq-2.0.0.tar.gz
- tar zxvf daq-2.0.0.tar.gz
- cd daq-2.0.0
- ./configure
- make
- make install
- Download and install Snort
- wget http://www.snort.org/downloads/2225 -O snort-2.9.4.1.tar.gz
- tar zxvf snort-2.9.4.1.tar.gz
- cd snort-2.9.4.1
- ./configure --enable-sourcefire
- make
- make install
- Download and install Snort Rules
- mkdir -p /etc/snort/rules
- mkdir -p /var/log/snort
- cd /etc/snort
- Manually download the rules file to /etc/snort/ (You need to be signed in to get the registered user rules). In this case it was snortrules-snapshot-2940.tar.gz
- tar zxvf snortrules-snapshot-2940.tar.gz
- mv ./etc/* /etc/snort/
- rmdir /etc/snort/etc
- OPTIONAL: Download and install Emerging Threats rules
- wget http://rules.emergingthreats.net/open/snort-2.9.0/emerging.rules.tar.gz -O emerging.rules.tar.gz
- tar zxvf emerging.rules.tar.gz
- Create Snort accounts
- groupadd snort
- useradd snort -g snort -d /var/log/snort -s /sbin/nologin -m
- chown -R snort:snort /etc/snort
- chown -R snort:snort /var/log/snort
- Edit the Snort configuration file
- vi /etc/snort/snort.conf
- ipvar HOME_NET x.x.x.x/x/
- ipvar EXTERNAL_NET !$HOME_NET
- var RULE_PATH rules
- var SO_RULE_PATH so_rules
- var PREPROC_RULE_PATH preproc_rules
- var WHITE_LIST_PATH rules
- var BLACK_LIST_PATH rules
- OPTIONAL: include $RULES_PATH/emerging.conf
- Test the Snort installation
- snort -u snort -g snort -c /etc/snort/snort.conf -T
- If all goes well you should see this
Snort exiting
I plan to have a subsequent blog post to record instructions for installing and configuring barnyard, oinkmaster and BASE. Instructions in a previous post using an older version of Snort and CentOS can be found at http://nkush.blogspot.com.au/2011/10/installing-snort-2912-on-centos-57.html
References
- http://fedoraproject.org/wiki/EPEL
- http://snort.org/docs
- http://nkush.blogspot.com.au/2011/10/installing-snort-2912-on-centos-57.html
- ERROR: /etc/snort/snort.conf(253) Could not stat dynamic module path "/usr/local/lib/snort_dynamicrules": No such file or directory.
- mkdir -p /usr/local/lib/snort_dynamicrules
- ERROR: /etc/snort/snort.conf(511) => Unable to open address file /etc/snort/rules/white_list.rules, Error: No such file or directory
- touch /etc/snort/rules/white_list.rules
- ERROR: /etc/snort/snort.conf(511) => Unable to open address file /etc/snort/rules/black_list.rules, Error: No such file or directory
- touch /etc/snort/rules/black_list.rules
3/03/2013
Installing and Configuring OpenVPN 2.3 on Microsoft Windows Small Business Server 2003
My previous posts (http://nkush.blogspot.com.au/2012/08/installing-openvpn-22-on-centos-63-64bit.html and http://nkush.blogspot.com.au/2011/10/installing-openvpn-22-on-centos-57.html) have been on installing OpenVPN on Linux.
This post is slightly different as it installs and configures OpenVPN on a Microsoft Windows Small Business Server (SBS). The SBS installation is also different from the previous write-ups since this configuration uses Ethernet bridging instead of tunneling.
Although SBS comes with Layer2 Tunneling Protocol (L2TP) and Point-to-point Tunelling Protocol (PPTP) for Virtual Private Network (VPN), some users may want to use an Secure Sockets Layer (SSL) based VPN such as OpenVPN. The default installation location, i.e. C:\Program Files\OpenVPN\ is used in the instructions below
Installation:
This post is slightly different as it installs and configures OpenVPN on a Microsoft Windows Small Business Server (SBS). The SBS installation is also different from the previous write-ups since this configuration uses Ethernet bridging instead of tunneling.
Although SBS comes with Layer2 Tunneling Protocol (L2TP) and Point-to-point Tunelling Protocol (PPTP) for Virtual Private Network (VPN), some users may want to use an Secure Sockets Layer (SSL) based VPN such as OpenVPN. The default installation location, i.e. C:\Program Files\OpenVPN\ is used in the instructions below
Installation:
- Before downloading and installing OpenVPN, the server needs to have IP forwarding enabled. This is trivial in *nix based systems, but requires a hack in the Windows registry. Edit the parameters and set IPEnableRouter to 1
- HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\IPEnableRouter
- Reboot the server to ensure the changes made above take effect
- Download and install the OpenVPN application[1] from http://openvpn.net/index.php/open-source/downloads.html
- Open a command prompt and change to the default installation directory
- Start> Run> cmd
- cd C:\Program Files\OpenVPN
- Ensure that the path C:\Program Files\OpenVPN\bin\ is added to the system environment PATH
- set PATH=%PATH%;C:\Program Files\OpenVPN\bin\
- Copy the file C:\Program Files\OpenVPN\easy-rsa\vars.bat.sample to C:\Program Files\OpenVPN\easy-rsa\vars.bat
- cd C:\Program Files\OpenVPN\easy-rsa\
- copy vars.bat.sample vars.bat OR run the init-config.bat script
- Edit the file (edit) and change the following
- Since key lengths less than 2048 are not recommended[2], change the key size to be 4096
- set KEY_SIZE=4096
- Configure the following
- KEY_COUNTRY
- KEY_PROVINCE
- KEY_CITY
- KEY_ORG
- KEY_EMAIL
- KEY_CN
- KEY_NAME
- KEY_OU
- PKCS11_MODULE_PATH
- PKCS11_PIN
- Setup environment variables by executing the vars.bat script
- Initialise the keys directory and empty the keys database and serial number by executing clean-all.bat. WARNING: this will delete any existing keys
- Create certificate for the certificate authority (CA), this will generate the certificate signing request, the CA certificate (ca.crt) and CA key (ca.key).
- build-ca.bat
- Create the Diffie Hellman files. These files are used for the key exchange to ensure the confidentiality over an insecure channel. Based on the length of the key used (KEY_SIZE) it may take a while
- build-dh.bat
- Create the server certificate and key and commit them
- build-key-server.bat <SERVER-NAME>
- Create user machine certificates and keys and commit them (one for each user/machine)
- build-key.bat <USER-MACHINE>
- Note: when generating individual user/machine certificate and keys ensure that the common names are unique and for maintenance reasons, its easier if you match the user/machine and the common name
- Copy the server configuration file to the configuration directory
- cd C:\Program Files\OpenVPN\sample-config
- copy server.ovpn ..\config\
- Edit the server config file. You may use the full path of the certificates and keys, or copy them into the same directory as your configuration file.
- cd C:\Program Files\OpenVPN\config
- edit server.ovpn
- port 1194
- proto udp
- dev tap
- dev-node MyTap
- ca ca.crt
- cert <SERVER-NAME>.crt
- key <SERVER-NAME>.key
- dh dh<KEY_SIZE>.pem
- ifconfig-pool-persist ipp.txt
- server-bridge 10.8.0.4 255.255.255.0 10.8.0.50 10.8.0.100
- push "route <LAN-NETWORK> <LAN-NETMASK>"
- keepalive 10 120
- comp-lzo
- max-clients 5
- status openvpn-status.log
- log-append openvpn.log
- verb 3
- mute 5
- Change the TAP adapter
- Rename to suit the configured name above, in the case of this example "MyTap"
- Set a static IPv4 address of 10.8.0.4 (or whatever is specified in 14.11 in the server-bridge setting
- Start the OpenVPN service and check the logs for any errors
Routing changes:
- You may also need to make routing changes. Depending on your router the settings may differ, but the basic requirement is to add a static route to the VPN tunnel network, i.e. 10.8.0.0/24 to the OpenVPN server.
- If the server does not have a WAN IP address and is located behind a router performing NAT, then port forwarding rules should be implemeneted to port formward traffic on UDP port 1194 to the VPN server.
Client Configuration:
- client
- dev tap
- proto udp
- remote <SERVER-WAN> 1194
- resolv-retry infinite
- nobind
- persist-key
- persist-tun
- ca ca.crt
- cert <USER-MACHINE>.crt
- key <USER-MACHINE>.key
- comp-lzo
- verb 3
- route-method exe
- route-delay 5
Note: SBS running as the Domain Controller (DC) only allows Terminal Services to run in Administration mode, i.e. only two concurrent Remote Desktop Protocol (RDP) sessions, and one local console session. It does not run in Application mode, which allows additional licenses to be installed
References:
- http://openvpn.net/index.php/open-source/downloads.html
- http://csrc.nist.gov/publications/nistpubs/800-131A/sp800-131A.pdf
Subscribe to:
Posts (Atom)