BSD 07 2015
BSD 07 2015
BSD 07 2015
STORAGE APPLIANCE
IT SAVES YOUR LIFE.
Losing one bit - that’s all it takes. One single bit, and
your file is gone.
tHE soLution
the mini boasts these state-of-the-
The FreeNAS Mini has emerged as the clear choice to
art features:
save your digital life. No other NAS in its class offers
ECC (error correcting code) memory and ZFS bitrot
• 8-core 2.4GHz Intel® Atom™ processor
protection to ensure data always reaches disk • Up to 16TB of storage capacity
without corruption and never degrades over time. • 16GB of ECC memory (with the option to upgrade
to 32GB)
• 2 x 1 Gigabit network controllers
No other NAS combines the inherent data integrity • Remote management port (IPMI)
and security of the ZFS filesystem with fast on-disk • Tool-less design; hot swappable drive trays
• FreeNAS installed and configured
encryption. No other NAS provides comparable power
and flexibility. The FreeNAS Mini is, hands-down, the
best home and small office storage appliance you can
buy on the market. When it comes to saving your
important data, there simply is no other solution.
http://www.iXsystems.com/mini
Intel, the Intel logo, Intel Atom and Intel Atom Inside are trademarks of Intel Corporation in the U.S. and/or other countries.
FREENAS
CERTIFIED
STORAGE
with over six million downloads, As one of the leaders in the storage industry, you
know that you’re getting the best combination
Freenas is undisputedly the most
of hardware designed for optimal performance
popular storage operating system with FreeNAS. Contact us today for a FREE Risk
in the world. Elimination Consultation with one of our FreeNAS
experts. Remember, every purchase directly supports
Sure, you could build your own FreeNAS system:
the FreeNAS project so we can continue adding
research every hardware option, order all the
features and improvements to the software for years
parts, wait for everything to ship and arrive, vent at
to come. And really - why would you buy a FreeNAS
customer service because it hasn’t, and finally build it
server from anyone else?
yourself while hoping everything fits - only to install
the software and discover that the system you spent
days agonizing over isn’t even compatible. Or...
http://www.iXsystems.com/storage/freenas-certified-storage/
Intel, the Intel logo, the Intel Inside logo and Xeon are trademarks of Intel Corporation in the U.S. and/or other countries.
EDITORS’ WORD
Dear Readers,
T
he new BSD is released! We would like to
present to you the new issue of BSD maga-
zine. Inside, you will find articles, stories, inter-
views and much more. Moreover our experts share Editor in Chief:
their knowledge and offer technical tips and tricks for Ewa Dudzic
[email protected]
Python programmers. The authors present their own
Contributing:
point of view, share opinions and experiences about Michael Shirk, Andrey Vedikhin, Petr Topiarz,
Transport Layer Switching. In the other articles, you Solène Rapenne, Anton Borisov, Jeroen van Nieuwenhuizen,
José B. Alós, Luke Marsden, Salih Khan,
will find all the information you need on how to use Arkadiusz Majewski, BEng, Toki Winter, Wesley Mouedine
the popular tool – WebHTTrack. You will also have Assaby, Rob Somerville
opportunity to read more about NetBSD and its ports Top Betatesters & Proofreaders:
Annie Zhang, Denise Ebery, Eric Geissinger, Luca
system. You will learn about Pkgsrc which is the Ferrari, Imad Soltani, Olaoluwa Omokanwaye, Radjis
framework that is useful to build third party packages Mahangoe, Mani Kanth, Ben Milman, Mark VonFange
for this system. You will see how to create a package Special Thanks:
and hopefully submit it. This issue covers the inter- Annie Zhang
Denise Ebery
view with Shawn Webb who tells you more about the
HardenedBSD Project. Art Director:
Ireneusz Pogroszewski
DTP:
We tried to cover as much as we could in this issue Ireneusz Pogroszewski
so everyone can benefit from this edition, and I would [email protected]
like to believe that we succeeded. Inside you will find
great authors, like David Carlier, Rui Silva, Leonardo Senior Consultant/Publisher:
Paweł Marciniak
Neves Bernardo, Jeremiah Brott, Mervyn Heng, Bob [email protected]
Monroe, Shawn Webb, Luca Ferrari who I also send CEO:
my thanks to for their dedication and hard work by Ewa Dudzic
[email protected]
providing the great articles.
Publisher:
Hakin9 Media SK
02-676 Warsaw, Poland
Enjoy Reading, Postepu 17D
Ewa & BSD Team Poland
worldwide publishing
[email protected]
www.bsdmag.org
4 07/2015
CONTENTS
NetBSD definition video. We want to see it being used by kids all over the
world to learn programming. If you love your Pi you’ll definitely
NetBSD and pkgsrc-wip 8 love to hack it.
David Carlier
In this article, David will tell you more about NetBSD and its ports Reviews
system. Pkgsrc is the framework to build third party packages for
this system. You will see how to create a package and hopefully WebHTTrack 42
submit it. Hence, the pkgsrc should already be in your system. Mervyn Heng
Otherwise, a full guide is available in David’s article. This tool is simple to install and use yet incredibly useful in
supporting Application Security testing to find vulnerabilities
Programming and also facilitating offline analysis of malicious code, as well
as malware embedded in websites. It is supported on multiple
Python Programming. Practical Project – platforms so try it today.
Weather Forecast! 12
Rui Silva Banana Pi Pro 44
In this article, Rui is going to implement a Python module to read Bob Monroe
data from an API, process the information and display it, using What happens when you take the popular Raspberry Pi (RPi)
Python plotting library, in a friendly way. microcomputer and hand it over to a Chinese company? You get
an even more powerful and feature packed microcomputer with
Security a similar name, the Banana Pi Pro. I guess “Blueberry” must
have been taken already. The Banana Pi Pro is slightly larger
Secure Log Server With Rsyslog 18 than the RPi but it sure has more items added on. This board
Leonardo Neves Bernardo is a super-sized microcomputer if you look at the specs alone.
Leonardo will discuss how to create a secure syslog server using
rsyslog and how to protect syslog messages with Transport Interview with ...
Layer Switching (TLS). Some advanced rsyslog configurations
will be covered. Shawn Webb Tells You All About HardenedBSD
Project 46
Raspberry Pi Hacking 26 Luca Ferrari & BSD Team
Jeremiah Brott
The Raspberry Pi is a credit-card sized computer that plugs
into your TV and a keyboard. It’s a capable little PC which can
be used for many of the things that your desktop PC does, like
spreadsheets, word-processing and games. It also plays high-
6 07/2015
InterDrone is Three Awesome Conferences:
A BZ Media Event
*BSD
NETBSD
CORNER
NetBSD
and pkgsrc-wip
DAVID CARLIER
I
t is recommended to install pkglint which will serve to => Describes briefly the package, more explanations
produce a better package. Indeed, as its suffix sug- in DESCR file
gests (lint, the historical C code analyser), it will check
the whole package structure, the Makefile, the checksum WRKSRC= ${WRKDIR}/yara-${YAVER}
and so on.
Secondly, you need to choose a main category for your li- => WRKDIR represents where the source port will be
brary or application, even if your future package can possi- extracted (generally it is work/<package name>-<version>)
bly recover several. For the article, we will choose security/
yara, the popular malware searcher library, as an example. USE_TOOLS+= pkg-config automake autoreconf
COMMENT= Pattern matching swiss knife for malware .include „../../security/yara/Makefile.common” =>
researchers Makefile.common is used by at least two packages
8 07/2015
(in our case py-yara) and it regroups common informa- @comment $NetBSD: PLIST,v 1.1 2015/06/06 08:18:17 pettai
tion, could be the dependencies, the version ... Exp $
bin/yara
.include „../../mk/bsd.pkg.mk” => Mandatory file to in- bin/yarac
clude, it contains the main necessary variables include/yara.h
include/yara/ahocorasick.h
Now, let’s have a look at the Makefile.common include/yara/arena.h
include/yara/atoms.h
# $NetBSD: Makefile.common,v 1.3 2015/06/14 21:28:44 pettai Exp $ include/yara/compiler.h
# include/yara/error.h
# used by security/yara/Makefile include/yara/exec.h
# used by security/py-yara/Makefile include/yara/filemap.h
include/yara/hash.h
DISTNAME= => In case the archive does not
v3.3.0 include/yara/libyara.h
have the same name as the package when it is down- include/yara/limits.h
loaded from the MASTER_SITES set below, this vari- include/yara/modules.h
able needs to be set include/yara/object.h
include/yara/re.h
YAVER= ${DISTNAME:S/v//} => Simply defining the include/yara/rules.h
version, in this case we just subtract the v prefix include/yara/scan.h
include/yara/sizedstr.h
MASTER _ SITES= ${MASTER _ SITE _ GITHUB:=plusvic/yara/ include/yara/strutils.h
archive/}=> Some predefined popular URLs like github include/yara/types.h
here, or Sourceforge through predefined variables, include/yara/utils.h
hence we just need to give the rest lib/libyara.la
lib/pkgconfig/yara.pc
DIST _ SUBDIR= yara man/man1/yara.1
MAINTAINER= [email protected] man/man1/yarac.1
HOMEPAGE= https://plusvic.github.io/yara/
LICENSE= apache-2.0 => Likewise, it exists with Patches
some predefined licenses, 2 clause BSD, different flavors Sometimes, the software in question needs to be patched
of GPL ... or we can define a custom one, a simple text in order to work properly. The patches subfolder should
file to place inside the licenses subfolder then the user contain the necessary diff files, by convention named
will need to add in its ACCEPTABLE_LICENSES environ- patch-<path to the file, dashes replaces by underscores>.
ment variable, hence accepting explicitly this license in In our case, we have patch-libyara_proc.c which just
order to build the package needs to add NetBSD support ... The patchset is created
via make patches ...
DESCR and PLIST
We talked earlier about the DESCR file, it is simply a text $NetBSD: patch-libyara_proc.c,v 1.1 2015/06/06 08:18:17
file which describes more completely the package in ques- pettai Exp $
tion like below.
Add NetBSD support
YARA is a tool aimed at (but not limited to) helping mal-
ware researchers to identify and classify malware sam- --- libyara/proc.c.orig 2015-06-06 06:50:32.000000000
ples. With YARA you can create descriptions of malware +0000
families (or whatever you want to describe) based on +++ libyara/proc.c
textual or binary patterns. @@ -153,7 +153,7 @@ int yr_process_get_memory(
#include <yara/mem.h>
We also need to know the list of files to be (un)installed
relative to the variable PREFIX (usually /usr/pkg). It is #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \
the role of the PLIST file. - defined(__OpenBSD__) || defined(__MACH__)
www.bsdmag.org 9
*BSD
NETBSD
CORNER
10 07/2015
PROGRAMMING
Python Programming.
Practical Project – Weather
Forecast!
RUI SILVA
•
Transform the data, so that it can be fed to the plot
module
Plot a graph with the weather forecast for the next
• Read data from an API (http://openweathermap.org) week
• Save the raw data in a file for safekeeping
{u’list’: [{u’clouds’: {u’all’: 0}, u’name’: u’Yafran’, u’coord’: {u’lat’: 32.06329, u’lon’: 12.52859}, u’weather’:
[{u’main’: u’Clear’, u’id’: 800, u’icon’: u’01d’, u’description’: u’Sky is Clear’}], u’dt’: 1437555483, u’main’:
{u’temp’: 31.92, u’grnd_level’: 958.15, u’temp_max’: 31.923, u’sea_level’: 1028.38, u’humidity’: 29, u’pressure’:
958.15, u’temp_min’: 31.923}, u’id’: 2208791, u’wind’: {u’speed’: 1.81, u’deg’: 212.001}}, {u’clouds’: {u’all’:
8}, u’name’: u’Zuwarah’, u’coord’: {u’lat’: 32.931198, u’lon’: 12.08199}, u’weather’: [{u’main’: u’Clear’, u’id’:
800, u’icon’: u’02d’, u’description’: u’Sky is Clear’}], u’dt’: 1437555483, u’main’: {u’temp’: 26.62, u’grnd_
level’: 1027.37, u’temp_max’: 26.623, u’sea_level’:
…
u’main’: {u’pressure’: 1013, u’temp_min’: 32, u’temp_max’: 32, u’temp’: 32, u’humidity’: 46}, u’id’: 2524119,
u’wind’: {u’speed’: 1, u’deg’: 110}}, {u’clouds’: {u’all’: 0}, u’name’: u’Rosolini’, u’coord’: {u’lat’:
36.824242, u’lon’: 14.94779}, u’weather’: [{u’main’: u’Clear’, u’id’: 800, u’icon’: u’01d’, u’description’: u’Sky
is Clear’}], u’dt’: 1437555556, u’main’: {u’temp’: 27.82, u’grnd_level’: 1024.46, u’temp_max’: 27.823, u’sea_
level’: 1026.39, u’humidity’: 93, u’pressure’: 1024.46, u’temp_min’: 27.823}, u’id’: 2523581, u’wind’: {u’speed’:
1.61, u’deg’: 277.501}}], u’cnt’: 15, u’calctime’: 0.0059, u’cod’: u’200’}
12 07/2015
Get information from API import requests
We are going to process the information from the Open def get_forecast(url):
Weather Map API. Let’s use this URL to get the forecast „”” Return the forecast data in json
for a group of cities: http://api.openweathermap.org/da- „””
ta/2.5/box/city?bbox=12,32,15,37,10&cluster=yes. r = requests.get(url)
Now we need a function to get the json data from this return r.json()
URL. For this we will use the requests library. This library
is not a Python built-in module so you have to install it. If you print the result for the url above, you get some-
You still remember how to install packages, using pip? thing like on Listing 1. Now, save the data in a file with
a datetime in the name (Ex: forecast-2015522.json). You
$ pip install requests still remember how to do it, right? Now, let’s break down
the json structure. You can use any online tool to “pret-
Now that we have all the dependencies we need, let’s ty print” the data you just received, so that you can better
create a simple Python file, that will hold all our code for understand its current structure: Listing 2.
this module. Let’s call it module4.py.
Now we have to import our request dependencies and Data transformation
create a function to get the forecast data in json. Try to do Let’s think a little about the data structure that we need:
this alone before looking at the example: we want to present, for each city, a bar chart, comparing
www.bsdmag.org 13
PROGRAMMING
Listing 6. Creating and running a script ind = np.arange(N) # the x locations for the groups
#!/usr/bin/python width = 0.35 # the width of the bars
14 07/2015
tion in the list above. Again, try to do it yourself before
looking at the next example: Listing 3. This will return
something like it is shown on Listing 4.
• cities: the list of city names In this case, the underscore indicates that the first
• temperatures: the list of the temperatures, maintain- argument returned by the function is being deliberately
ing the same order of the cities list ignored. You can assign the value to a variable, but in
• humidities: the list of humidities, maintaining the this case it would never be used…
same order of the cities also Using the ax (Axes object – check the documentation
on http://matplotlib.org/api/axes_api.html#matplotlib.axes.
Create a function that receives the raw json data from Axes), we create a bar for the temperatures and another for
the API, processes it and returns a dict with the informa- the humidities (check the examples for more options too).
www.bsdmag.org 15
PROGRAMMING
After that, we only have to display the chart, which should If you don’t want to bother searching and testing the
be something like this (if you want the full source code for functions supplied, you can check the code that gener-
this graph generation you can get it. See Figure 1.). ated this graph on Listing 7.
Now, this bar chart is too simple and not that informa-
tive… You should play a bit with these options to create ABOUT THE AUTHOR
a chart that is actually useful:
Rui Silva is a Python developer who loves open source. He started
• ax.set_ylabel working as a freelancer in 2008, while he finished his degree
• ax.set_title in Computer Science in Universidade do Minho. After graduation,
• ax.set_xticks he started pursuing a master’s degree, choosing the field of parallel
• ax.set_xticklabels computation and mobile and ubiquitous computing. He ended up
• ax.legend only finishing the mobile and ubiquitous computing course. In his
3 years of freelancing, he worked mostly with Python, developing
Try to create this chart: Figure 2. django websites, drupal websites and some magento stores. He also
You can notice that we have the value of each column had to do some system administration. After that, he started working
above it and labels for the cities. There is also a legend in Eurotux Informática, S.A. where he develops websites using Plone,
in the upper right corner and a title for the graph, which django and drupal. He is also an IOS developer and sometimes he
is much more informative than the previous, don’t you performs some system administration tasks. Besides his job, he works
agree? as a freelancer using mainly django and other Python frameworks.
def show_plot(data):
“”” # Exec the script
“”” url = ‘http://api.openweathermap.org/data/2.5/box/city?b
cities = tuple(data[‘cities’]) box=12,32,15,37,10&cluster=yes’
temperatures = tuple(data[‘temperatures’]) data = get_forecast(url)
humidities = tuple(data[‘humidities’]) processed_data = process_data(data)
N = len(cities) show_plot(processed_data)
16 07/2015
SECURITY
• how to use rsyslog to centralize syslog messages and TLS • basic understanding of syslog protocol
• how to use advanced techniques of rsyslog • basics of Linux shell.
L
ogs are one of the most important security assets and there is no associated terminal, therefore it isn’t pos-
inside IT environments. Without logs it’s almost sible to display messages. Firstly, daemons started to
impossible to follow audit trails. There are a lot of write messages inside log files associated with a daemon
types of logs and some types are very different from oth- to allow system administrators to watch messages. Even
ers. Sometimes the sources of logs are different, for ex- though the problem of saving important messages perma-
ample from a Unix system, Windows system or network nently was solved, system administrators had a lot of log
appliance. Sometimes logs are generated from operating files to take care of, each one with its own format.
systems and sometimes they are generated by applica- In the 1980s, Eric Allman, creator of sendmail software,
tions. Moreover, you can generate your own personal log created syslog as a separate daemon to control the mes-
message. sage flow from sendmail daemon. As syslog is a totally
Very often, logs reside only inside one computer. If this separate daemon, some other Unix daemons started to
computer is compromised, all log information is almost in- use it. Gradually, syslog’s popularity increased and nowa-
stantly invaluable. Therefore, a log server is one of the days, almost all Unix daemons use syslog. Although other
most important security artifacts inside networks. log formats, like Windows Event Log or Apache Common
Some advanced features and configurations covered in Log, exist and are used in some market niches, syslog is
this article are based on the ideas of Rainer Gerhards, the most known log format.
creator of rsyslog software and RELP Protocol and author Programs send information to syslog, usually by sys-
of RFC 5424. Rainer is a visionary and pioneer in modern log syscall. The messages can then be logged to vari-
syslog infrastructure, although it is not possible to assure ous files, devices, or computers, depending on the sender
that his ideas will prevail in the future. of the message and its severity. Multiple destinations are
permitted.
Basics of log and syslog
Almost every software that runs inside a Unix system is Format of syslog messages
a daemon. By definition, a daemon runs in the background Each syslog message consists of four parts:
18 07/2015
Program name user.info, kern.crit
Specifies the program source that created the message.
Examples are login: and kernel:. Actions are the destinations of the messages. Actions
can be a file or device or the address of a log server.
Facility Examples of actions:
Specifies the subsystem that produced the message, for
example, all daemons related to mail management send /var/log/messages
messages to facility mail. Facilities used nowadays are: /dev/console
@loghost
• kern – Kernel messages
• user – General userland messages Let’s see an example of a complete syslogd.conf:
• mail – Messages related to e-mail subsystems
• daemon – Daemon (server process) messages kern.crit /var/log/messages
• auth – Authentication or security messages ftp.none,kernel.*,daemon.* /var/log/messages
• security – Alias to auth facility *.emerg /dev/console
• mark – Used internally
• authpriv – Non-system authentication and authoriza- In the above example, we see that is possible to use as-
tion messages terisks to get all priorities or to get all facilities. Keyword
• syslog – Messages from syslog daemon none stands for no priority of the given facility. It’s possi-
• lpr – Printer messages ble to use multiple actions for the same selector.
• news – Messages related to Usenet news
• uucp – Unix to Unix Copy Protocol messages Network Use
• cron – Cron messages Syslog has network support, hence syslog is a protocol as
• ftp – Messages related to FTP subsystems well as a daemon. Syslog protocol was standardized by
• local0 through local7 – User specified facilities IETF RFC 3164 (The BSD syslog Protocol, August 2001).
RFC 3164 becomes obsolete by RFC 5424 (The Syslog
Priority Protocol, March 2009). Syslog protocol uses UDP port
Priority specifies the level of the message. 514 for communication.
Possible priority values are: There are some advantages to converting messages
emergency, alert, critical, error, warning, notice, info and from other formats and transferring them via a syslog pro-
debug. tocol through networks. The traditional Unix syslog ser-
vice allows programs to send log messages over a net-
Message itself work to a central server that records them.
The final part of a syslog message contains the message In general, syslog daemons are compatible with each
itself. other. It’s possible to send messages from rsyslog to sys-
log-ng or from traditional syslog to rsyslog and so on.
Traditional syslog (sysklogd) In traditional syslog, the @ character is used at the be-
Traditional syslog, or sysklogd is the most used log dae- ginning of an action in order to send messages to another
mon. The traditional syslog daemon has not had signifi- host (i.e. @loghost). To start a syslog daemon listening in
cant changes during the last decades. The syslog project network, the ‘-r’ argument is used.
is focused more on stability than on new features.
Syslogd.conf or syslog.conf are the files used to con- Why rsyslog?
figure syslog daemon. The configuration format is very Traditional syslog lacks of a lot of functionalities. Even though
simple. Each line of syslogd.conf is a set of one or more traditional syslog has network support, there is no possibil-
selectors and an action. A selector is a set of facility and ity to secure communication without external software. Af-
priority joined by period character. Example of selector: ter the creation of traditional syslog, some other syslog dae-
mons were created, syslog-ng and rsyslog. It’s not possible
kern.crit to make a comparison between traditional syslog and rsys-
log or syslog-ng, because there are big differences.
It’s possible to put several selectors together, using com- Syslog-ng is a very good and complete software, but
ma character. Let’s see one example: some functionalities are enabled only in the paid version.
www.bsdmag.org 19
SECURITY
Another minor issue related to syslog-ng is that the # rsyslogd -c5 -f /etc/rsyslog.conf
configuration file isn’t compatible with traditional
syslog and this, depending on the environment, can be With ps command, it’s possible to check if rsyslog is run-
a problem. ning:
Rsyslog project is the newer project related to syslog.
Rsyslog project is focused on new functionalities and in- # ps -ef | grep rsyslog | grep -v grep
tends to maintain all features under a GPL license. The root 11034 1 0 21:19 ? 00:00:00 rsyslogd
great improvement of rsyslog regarding security concerns -c5 -f /etc/rsyslog.conf
is that rsyslog supports Syslog TLS.
Some advantages of rsyslog from syslog-ng are: na- And inside /var/log/messages rsyslog will print 2 lines to
tive support for MySQL and PostgreSQL, TLS/SSL na- confirm it started:
tive support, GSS-API and RELP support, and so on. The
complete list of differences between syslog-ng and rsys- 2011-10-16T21:19:47.916889-02:00 neves-laptop kernel:
log can be found at http://www.rsyslog.com/doc/rsyslog_ imklog 5.8.4, log source = /proc/kmsg started.
ng_comparison.html. 2011-10-16T21:19:47.917187-02:00 neves-laptop rsyslogd:
Considering the above, I recommend using rsyslog in- [origin software=”rsyslogd” swVersion=”5.8.4”
stead other software. If you are not convinced yet, some x-pid=”11034”
Linux distributions are. Nowadays, almost all Linux dis- x-info=”http://www.rsyslog.com”] start
tributions are using rsyslog as official syslog daemon.
Unfortunately, other flavours of Unix aren’t following the At this moment, rsyslog is exactly a replacement to tra-
same way. ditional syslog. Even an old syslog.conf can be used di-
rectly as a rsyslog.conf. Flag -c specifies the level of
Installing rsyslog compatibility that rsyslog will support and -f points to the
First of all, remove your legacy syslog daemon. Download configuration file.
the latest rsyslog software from http://www.rsyslog.com/ With command egrep -v „^#|^$” /etc/rsyslog.conf
rsyslog-5-8-4-v5-stable/. Extract and install: we see our configured parameters inside rsyslog, shown
in Listing 1.
# tar -zxvf rsyslog-5.8.4.tar.gz Some other details are shown in Listing 1. Notice the
# cd rsyslog-5.8.4 action starting with an asterisk (*.emerg). Actions starting
# ./configure && make && make install with an asterisk will print messages in all sessions, for all
users. Another detail is about file actions starting with mi-
Copy rsyslog example configuration file from source nus (-) sign. Minus sign omits the syncing of the file after
to /etc: every logging. Finally, we can see some lines starting with
$ModLoad. Module support is rsyslog specific, and other
# cp rsyslog.conf /etc software doesn’t support it. The three modules loaded in
Listing 1 are basic and necessary to rsyslog in order to run
Now, start rsyslog with the following command: with the same functionality of traditional syslog.
20 07/2015
Using Network with rsyslog UDP protocol is not reliable and is not guaranteed that
The @ is used to configure rsyslog to send messages to a syslog message will be received by rsyslog server.
another syslog over the network, as in traditional syslog. Even so, it’s better to have a syslog server than nothing.
The following example shows authpriv facility config- On the other hand, rsyslog supports TCP communica-
ured to send to file and to copy messages to host name tion. To configure rsyslog to receive messages by TCP, in-
logserver over the network: sert lines of Listing 3 to the bottom of /etc/rsyslogd.conf.
TCP is a more reliable protocol than UDP. However, the
authpriv.* /var/log/secure use of TCP instead UDP does not guarantee that all the
authpriv.* @logserver messages will be received. Messages can be discarded if
problems arise or processing overcharges happen in both
To configure rsyslog to receive messages, insert lines of server or client side.
Listing 2 at the bottom of /etc/rsyslogd.conf. To send messages with TCP from rsyslog client, use
In fact, it’s possible to receive messages only by double @ (@@), as shown in the following example:
UDP/514. With UDP/514, it’s possible to configure almost
all appliances and servers to send messages to your sys- authpriv.* @@logserver
log. UDP/514 is recommend for all hosts which don’t sup-
port other possibilities, as shown: This kind of configuration is rsyslog specific.
• Network appliances like routers and switches, and Security and capacity considerations
even mailhubs, proxies and network IPS It is now time to test. Use the logger tool on the client side
• Windows servers with some additional software like and verify that messages are logged at server side. An-
EventReport or KiwiSyslog other very good test is to configure authpriv facility and
• Legacy/Traditional Unix, used even in recent versions test with login and/or logout on the client side.
of IBM AIX, HP HP-UX and Sun Solaris. In this case, It’s a good idea to verify packages of syslog protocol
I recommend the replacement of traditional syslog communication with a sniffer. Dump packages to a file with
with rsyslog, if it’s possible. tcpdump -w file -s 0 and after that examine file with xxd.
After that, restart rsyslog and check that ports UDP/514 is open with netstat:
# netstat -anp -4 | grep 514
udp 0 0 0.0.0.0:514 0.0.0.0:* 2707/rsyslogd
Checkthat now rsyslog opened UDP port 514 and is listening in TCP/514:
# netstat -anp -4 | grep 514
udp 0 0 0.0.0.0:514 0.0.0.0:* 2779/rsyslogd
tcp 0 0 0.0.0.0:514 0.0.0.0:* LISTEN 2770/rsyslogd
www.bsdmag.org 21
SECURITY
You will see that, both by UDP and TCP communication, Making rsyslog more secure
messages will be transferred in plain text. Even though Rsyslog supports communication using TLS/SSL com-
logs aren’t the most confidential information we have in- munication. Even though it’s possible to use stunnel to
side networks, this information could be used to enumer- secure a TCP communication, using this method could
ate users from your environment, and there are some se- result in a loss of messages. Syslog with TLS ensures
curity concerns about this. We will see later a very good that communications are reliable and confidential and it
solution for this problem. is a protocol defined by the Request for Comments 5425.
Another concern about logs is about capacity. If the vol- RFC 5425 is a proposed standard, and some details could
ume of information from the clients is big, your log server change. Rsyslog implements TLS support following RFC
can be flooded very fast. One of the most common prob- 5425, even without a final specification.
lems is the size of storage and perhaps it’s important to To use rsyslog with TLS it’s necessary to install GnuTLS
evaluate the network capacity and the processing capac- (GNU Transport Layer Security Library). GnuTLS is an
ity in the log server. The processing capacity could be implementation of TLS and SSL protocols like OpenS-
a problem if you have filters, regular expressions, data- SL. GnuTLS was created to provide a free alternative to
bases backends, log correlation and so on. As you can OpenSSL, because OpenSSL license is not totally free.
see, rsyslog could do many other tasks beyond only stor- Rsyslog project intended to implement OpenSSL support,
ing log messages from network. Unfortunately, here I do but nowadays the only alternative is GnuTLS.
not have the possibility to explain in details all the features The first step necessary to use rsyslog + gnutls is to in-
listed above. stall GnuTLS. Install from source or by package manager
When you create a log server, your first goal is to have and remember that it’s devel and headers are necessary
a copy of all important log information from your network. to recompile rsyslog.
Automatically, you perceive that it is most valuable to cre- After gnutls installation, return to source directory of
ate a backup from the log server rather than from clients, your rsyslog and type (both log server and client):
because in fact, the log server is normally more secure
than clients. Now, you need to compute backup size, com- # ./configure –enable-gnutls && make && make install
pression of log files, purge of files, and so on. If you have
to comply to any regulations, such as SOX, PCI DSS, Now your binary is ready to be used with gnutls. In the
HIPAA, etc., search if your regulation specifies the rules next steps we will use files and examples distributed with
about the minimal age of the log. rsyslog to start a basic rsyslog + TLS communication.
I imagine that now logs seem a little more important Create a directory to store certificates and key in (both
than when you started to read this article. I think that it’s log server and client):
not necessary to stress why maintaining a good level of
security in your log host is essential. # mkdir -p /etc/rsyslog/certs
22 07/2015
And copy certificates and key from contrib/gnutls direc-
tory in rsyslog source directory to /etc/rsyslog/certs in
log server:
# cp contrib/gnutls/ca.pem /etc/rsyslog/certs
# cp contrib/gnutls/cert.pem /etc/rsyslog/certs
# cp contrib/gnutls/key.pem /etc/rsyslog/certs
www.bsdmag.org
SECURITY
• Create a private key of CA of log server • Log separation by source (or another field), also sup-
• Create a request certificate of log server using pri- ported by rsyslog
vate key • Log correlation with additional software like ossec
• Sign the request, generating log server certificate or sec
• Reading of any plain file with rsyslog imfile
And for each client that will communicate: • Database storage and frontend like phplogcon
or phpsyslog-ng
• Create a private key of CA of client • Log server relay to remote networks
• Create a request certificate of client using private key • Filters and regular expressions based on any mes-
• Sign the request, generating client certificate sage field
• EventLog to syslog with additional software
When you follow the above steps, It’s recommended to • History to Syslog in bash (bourn again shell)
change some configurations from our example. • Centralized network monitoring from logs in log serv-
If you intend to accept messages only from clients with er (security monitoring and infrastructure monitoring)
certificate, you need to change $InputTCPServerStreamDr
iverAuthMode anon to $InputTCPServerStreamDriverAuthM I hope that this article has contributed to a better un-
ode x509/name. derstanding of logs, syslog and rsyslog. Syslog soft-
At client side, it’s necessary to include $Default Netstream ware and protocol can be used not only by security pro-
DriverCertFile and $DefaultNetstreamDriverKeyFile fessionals, but also by infrastructure people and even in
pointing to specific files and to ensure that the log high level applications. Create your own log server if you
server has a certificate, it’s necessary to change don’t have one yet, and implement security. When nec-
$ActionSendStreamDriverAuthMode anon to $ActionSendSt essary, use one log server instead of logs spread among
reamDriverAuthMode x509/name. multiple servers, in this way your environment will be
Finally, we have secure communication between log more secure.
server and clients. The use of certificates on the client
side is additional work, but the effort is valuable in order to ABOUT THE AUTHOR
achieve the best level of security.
Leonardo Neves Bernardo got started with Unix in 1996 when
Improving your log server considered this operating system more interesting than any other.
In this article, we explored some ideas, configurations and For more than fifteen years he worked with several IT area and now
features to create a modern log server. With some other fea- he is more focused with IT security area. Leonardo is LPIC-3, LPIC-302
tures, rsyslog can be improved and become a modern log and LPIC-303 certified and hold a Bachelor’s degree in Computer
server. Some ideas supported by rsyslog or some additional Science from Universidade Federal de Santa Catarina, Florianópolis,
software that I recommend to research and implement are: Santa Catarina Brazil as well as RHCT and ITILv3 Foundation
certifications. Visit his linkedin profile at: www.linkedin.com/profile/
• High Availability of log servers, supported by rsyslog view?id=24995684.
itself
24 07/2015
SECURITY
Raspberry Pi Hacking
JEREMIAH BROTT
RAM Usage
By simply removing unneeded services and disabling
daemons, you can greatly increase performance.
26 07/2015
Once this has been installed, you can begin disabling House Keeping
unneeded services by issuing the following command: After time, the Pi will get full of old update archives, etc.,
sudo sysv-rc-conf. or maybe even unused software still left lingering around.
To keep things tidy around the Pi, issue the following com-
Ie: samba, nfs etc.. mands every once in awhile:
Most services are safe to disable for normal operation of sudo apt-get autoremove
the Pi. If you know you will not be accessing any Win- sudo apt-get autoclean
dows file shares, samba is safe to disable, same goes
for NFS with Linux/Unix shares. If you do not know what Removing Gnome
it is, it’s best to leave it alone. Once you are done you If you never plan on using gnome or maybe you are using
will be required to run the following command to com- your Pi as a Raspbmc media center, you can save some
plete the configuration: dpkg-reconfigure innserv. more resources by removing: gnome and gvfs. If you are
sure you will never use the two, you can remove them and
Inittab Modifications anything associated with the two by issuing the following
By default, the Pi will spawn 6 terminals available for use commands:
once the Pi boots up. The average user does not need
more than one or two at most. We can save some resourc- apt-get remove gnome
es by limiting the amount of terminals spawned down from apt-get remove gvfs
6 to 2. To do so, edit the /etc/inittab file by issuing the apt-get autoremove
following command: vi /etc/inittab. Once the file has
been opened, look for lines matching the following (line Disk Tuning
51): Table 1. Once the above changes have been made, Since the Raspberry Pi uses the SDcard for every-
you can now save and exit the editor. thing, the read and write performance will drop. Have no
fear,though, as there are a few things we can do to mini-
Disabling console access mize the hidden I/O, thus increasing performance of the
Depending how you use your Pi, you can save more re- SDcard. The good thing about these improvements is that
sources by disabling console access if you are sure you most of them are not based on modifying the kernel in
will not need it. This is useful in cases where you are us- any way.
ing your Pi as a Raspbmc media center or something. To
disable the console, you will need to edit the file: /boot/ Tweaking Syslog
cmdline.txt. The first step we can take to improve the performance on
Remove the following line and save the file: the SDcard is to minimize the logging and remove unnec-
essary logs. Edit the syslog file by issuing the following
console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 command: vi /etc/rsyslog.conf.
To disable a service from logging, you can put ‘#’ in front
Enabling DASH of the line.
Using dash as the system shell will improve the system’s Once you have disabled the unnecessary log files, you
overall performance. Configure dash by issuing the fol- can then restart syslog by issuing the command: sudo /
lowing command: dpkg-reconfigure dash. etc/init.d/rsyslog restart.
When prompted to use dash as the default system shell,
select: <Yes>.
www.bsdmag.org 27
SECURITY
28 07/2015
/boot/config.txt – Safe /boot/config.txt – Not So
Bet put or output pin) can be controlled (programmed) through
Safe Bet software.
arm _ freq=900 arm _ freq=1000
gpu _ freq=250 Core _ freq=500
The Raspberry Pi allows peripherals and expansion
sdram _ freq=500 sdram _ freq=500 boards (such as the upcoming Rpi Gertboard) to access
over _ voltage=6 the CPU by exposing the inputs and outputs.
The production Raspberry Pi board has a 26-pin
**If you are paranoid, use a fan 2.54 mm (100 mil) expansion header, marked as P1, ar-
with this config**
ranged in a 2x13 strip. They provide 8 GPIO pins plus ac-
cess to I²C, SPI, UART, as well as +3.3 V, +5 V and GND
supply lines. Pin one is the pin in the first column and on
Hacking stuff with the Pi the bottom row.
While there is already an extensive list of documentation For a complete list of all available pins, see http://elinux.
and guides for getting up and running with your Pi, there org/RPi_BCM2835_GPIOs.
have not been many for how to extend the use of your Pi
or how to use your Pi for hacking other things or projects Raspberry Pi GPIO
you may have in mind. In this document, we will be mainly The Raspberry Pi has a General Purpose Input/Output
focusing on the GPIO pins of the Raspberry Pi. (GPIO) connector and this carries a set of signals and
The GPIO pins that can be found available on the PCB buses. There are 8 general purpose digital I/O pins –
of the Pi will allow you to interface with external applica- these can be programmed as either digital outputs or in-
tions via headers on the side of the board. These GPIO puts. One of these pins can be designated for PWM out-
pins are very useful for controlling things like LEDS, Mo- put too. Additionally there is a 2-wire I2C interface and
tors or reading from switches. a 4-wire SPI interface (with a 2nd select line, making it
See Figure 2 of the Pi, the 26 GPIO pins have been 5 pins in total) and the serial UART with a further 2 pins.
highlighted on the bottom right corner. The I2C and SPI interfaces can also be used as general
purpose I/O pins when not being used in their bus modes,
and the UART pins can also be used if you reboot with the
serial console disabled, giving a grand total of 8 + 2 + 5 +
2 = 17 I/O pins (Figure 3).
www.bsdmag.org 29
SECURITY
[ Legend ]
+5 Volt
3.3 Volt
Ground, 0V
DNC – Do not connect
UART
GPIO
SPI
30 07/2015
SECURITY
Warning • Pins 0 through 7 (GPIO 17, 18, 21, 22, 23, 24, 25, 4
Be very careful with the 5V pin. respectively): These are safe to use at any time and
If you short it to any other P1 pin you may permanently can be set to input or output with or without the inter-
damage your Pi. nal pull up or pull down resistors enabled.
• PWM: You can change the function of pin 1 (GPIO
Pro Tip: Strip a short piece of insulation from another 18) to be PWM output, however, if you are current-
wire and push it over the 5V pin so you don’t accidentally ly playing music or using the audio system via the
touch it with a probe. 3.5mm jack socket, then you’ll find one channel of
The maximum you can draw from the power pin is be- audio PWM coming through the pin! If you are not
tween: 150-250mA and again this all depends on what using the audio at all (or the audio is going via the
you have currently running, this could be much less. See HDMI cable), then this pin is free to be used in
the link below for more information: http://nathan.chant- PWM mode.
rell.net/20120610/raspberry-pi-and-i2c-devices-of-differ- • Pins 8 and 9 (GPIO 0 and 1): These are the I2C
ent-voltage#f3fuse. pins. You may use them for digital IO if you are not
using any I2C drivers which use these pins, howev-
Protecting your pins and your Pi er, note that they have on-board 1k8 resistors pulling
Before you go connecting stuff up and playing around, the signals to the 3v3 supply. This feature does make
make sure you know what you are doing! them handy for switch inputs where the switch simply
Almost all of the GPIO pins located on the header go di- shorts the pin to ground without having to enable the
rectly into the Broadcom chip. internal pull up resistors
A simple short circuit or mistake in wiring can result in • Pins 10, 11, 12, 13 and 14 (GPIO 8, 7, 10, 9 and 11 re-
the quick death of your Pi. spectively): These are used for the SPI interface. Like
the I2C interface, if you are not using it, then you can
GPIO – Interaction freely use them for your own purposes. Unlike I2C,
Having your way with the Pi’s pins… these pins do not have any external pull up (or pull
down) resistors.
WiringPi • Pins 15 and 16 (GPIO 14 and 15): These are used by
WiringPi is a Wiring library written in C and should be us- the UART for Tx and Rx respectively. If you want to
able from C++ and many other languages with suitable use these pins as general purpose I/O pins then you
wrappers. need to make sure that you reboot your Pi with the
If you have ever used an Arduino before, you will know serial console disabled. See the file /boot/cmdline.
they are composed of two things. One is the hardware txt and edit it appropriately.
32 07/2015
Programming Libraries Listing 4. C
Controlling the GPIO pins using libraries from various pro-
gramming languages. // blink.c
//
Python Library // Example program for bcm2835 library
RPi.GPIO Python library – http://pypi.python.org/pypi/RPi. // Blinks a pin on and off every 0.5 secs
GPIO. See Listing 2 for example. //
// After installing bcm2835, you can build this
Listing 2. Python // with something like:
// gcc -o blink blink.c -l bcm2835
importRPi.GPIO as GPIO // sudo ./blink
# Set up the GPIO channels - one input and one //
output // Or you can test it before installing with:
GPIO.setup(11, GPIO.IN) // gcc -o blink -I ../../src ../../src/bcm2835.c
GPIO.setup(12, GPIO.OUT) blink.c
# Input from pin 11 // sudo ./blink
input_value = GPIO.input(11) //
# Output to pin 12 // Author: Mike McCauley ([email protected])
GPIO.output(12, True) // Copyright (C) 2011 Mike McCauley
# The same script as above but using BCM GPIO // $Id: RF22.h,v 1.21 2012/05/30 01:51:25 mikem
00..nn numbers Exp $
GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.IN) #include <bcm2835.h>
GPIO.setup(18, GPIO.OUT)
input_value = GPIO.input(17) // Blinks on RPi pin GPIO 11
GPIO.output(18, True) #define PIN RPI_GPIO_P1_11
www.bsdmag.org 33
SECURITY
C require ‘wiringpi’
Using the bcm2835 Library http://www.open.com.au/ io = WiringPi::GPIO.new
mikem/bcm2835. See Listing 4 for example. io.mode(MY_PIN,OUTPUT)
io.write(MY_PIN,HIGH)
Perl io.read(MY_PIN)
Using the bcm2835 library and Device::BCM2835 module
from CPAN. http://www.open.com.au/mikem/bcm2835.
34 07/2015
Shell Script
See Listing 8 for example.
#!/bin/sh
Figure 5. Teensy Kit & Logic Converter
# GPIO numbers should be from this list
# 0, 1, 4, 7, 8, 9, 10, 11, 14, 15, 17, 18, 21, To connect up the Pi, connect the following GPIOs to
22, 23, 24, 25 the corresponding pins on the logic level converter.
# Note that the GPIO numbers that you program Raspberry Pi to Logic level Logic level converter to
here refer to the pins converter Teensy
# of the BCM2835 and *not* the numbers on the GPIO 14 (TXD) connects to TXI HV connects to VCC
pin header. GPIO 15 (RXD) connects to GND connects to GND
# So, if you want to activate GPIO7 on the head- RX0 TX0 connects to D2
er you should be 3v3 Power P1 connects too LV RXI connects to D3
# using GPIO4 in this script. Likewise if you PIN 6 – Ground connects to Ensure both GND on the Logic
Ground Level Converter have been
want to activate GPIO0
connected to GND.
# on the header you should be using GPIO17 here.
# Set up GPIO 4 and set to output You should be able to purchase a logic level converter
echo “4” > /sys/class/gpio/export inexpensively, usually under $3.
echo “out” > /sys/class/gpio/gpio4/direction
Interfacing with LCD Displays
# Set up GPIO 7 and set to input Hooking the Pi up to a 2x16 HD44780 compatible LCD via
echo “7” > /sys/class/gpio/export GPIO (Figure 6).
echo “in” > /sys/class/gpio/gpio7/direction
# Write output
echo “1” > /sys/class/gpio/gpio4/value
www.bsdmag.org 35
SECURITY
into ground. Using a potentiometer, you could add an ad- • LEDA provides 5 volts to the backlight LED of the
justable knob to control the brightness of the LCD screen LCD. HD44780 compatible devices should operate
in real time (Figure 8). between 2.2 and 5.5 volts. LEDA can be directly con-
nected to the 5v source.
1 Ground • The RW pin allows you to set the LCD in read
2 VCC (Usually +5V) or write mode, for this example we want to send data
3 Contrast adjustment (VO)
4 Register Select (RS). RS=0:
to the LCD, but not allow the LCD to send data back
Command, RS=1: Data to the Pi. The reason for this is that the Pi will not
5 Read/Write (R/W). take more than 5V of input on the GPIO header. Do-
R/W=0: Write, R/W=1: Read ing so may result in damage to your Pi. Tying the RW
6 Enable pin into ground will ensure that the LCD will NOT at-
7 Bit 0 (Not required in 4-bit
tempt to pull the lines over 5volts.
operation)
8 Bit 1 (Not required in 4-bit
operation) Once you have everything connected up properly, pow-
9 Bit 2 (Not required in 4-bit er on and boot up your Pi. If everything was done cor-
operation) rectly thus far, the LCD screen should now power on and
10 Bit 3 (Not required in 4-bit show either one or two rows of boxes. These boxes will
operation)
11 Bit 4
remain until the LCD has been initialized for the first time
12 Bit 5 (Figure 9).
13 Bit 6
14 Bit 7
15 LED Backlight Anode (+)
16 LED Backlight Cathode (-)
36 07/2015
Learn How To Master Big Data
38 07/2015
time.sleep(E_PULSE) MCP23017 I2C I/O Expander
GPIO.output(LCD_E, False) Not enough GPIO pins for you, well not a problem if you
time.sleep(E_DELAY) have a 16bit MCP23017 I2C I/O Expander kicking around.
if __name__ == ‘__main__’: This will also work with the 8bit model, MCP23008. They
main() both also come in a DIP form, so using them to build your
own expansion board for the Pi should be fairly simple. If
not, they are simple enough to use on any breadboard as
If you get an error like “RPi.GPIO.SetupException: No well. The data sheet for the 16bit version of the MCP23017
access to /dev/mem.” Make sure you are running Python I2C I/O Expander can be found here: http://ww1.micro-
as root: sudo python testlcd.py. chip.com/downloads/en/DeviceDoc/21952b.pdf.
If everything went well, you should first see “Raspberry The 16bit version of the MCP23017 chip has 28 pins
Pi Model B” appear, shortly after “magikh0e, DARPAnet” that will give you a total of 16 pins that can be used. These
should appear (Figure 10). pins can be used as either inputs or outputs. Up to 8 of
these pins can be used on 1 I2C bus, thus giving you a
lot more I/O than the Pi has built in. The best thing about
this chip is that you can reduce the risk of damaging your
Pi since each pin has a maximum of 25mA for input or
output. The expander can also be placed away from the
Pi itself, and connecting up using only 4 wires. If space is
a concern, go with the 8bit MCP23008 model.
MCP23017Pi GPIO
PIN 9 – VDD PIN 2 – Vcc 5v+
PIN 10 – Vss Ground
PIN 12 – SCL PIN 5 – I2C0_SCL
PIN 13 – SDA PIN 3 – I2C0_SDA
PINS 15,16,17 Ground
PIN 18 PIN 2 – Vcc 5v+
www.bsdmag.org 39
SECURITY
40 07/2015
REVIEWS
WebHTTrack
MERVYN HENG
I
t is a Windows software that spawned WebHTTrack, Give your new project a name, category name and base
its Linux/Unix/BSD release. The tool dumps and mir- path before clicking on Next.
rors the complete contents of the source website you
specify to a local directory by replicating the exact direc-
tory structure, files and links.
This is beneficial for a security practitioner who wants to
perform offline security testing against a website without
impacting the server hosting it.
Install WebHTTrack on Ubuntu by entering the following
command in your Terminal.
Launch WebHTTrack by clicking on Applications>Inter Enter details of the URL(s) that you want to mirror locally.
net>WebHTTrack Website Copier. The web interface is
now accessible via your default browser. Select your lan-
guage and click Next.
Figure 3. URLs
Figure 1. Web interface
42 07/2015
Click Start to initiate the mirroring.
Figure 5. Progress Mervyn Heng, CISSP, is into Ubuntu, Comic Universe characters,
Pop culture and Art outside of Information Security. If you have any
Once the mirroring is completed, you can directly ac- comments or queries, please contact him at [email protected].
cess the website locally by using the path link at the bot-
tom of the page.
www.bsdmag.org 43
REVIEWS
Banana Pi Pro
BOB MONROE
W
hat happens when you take the popular Rasp- a big deal because the Banana Pi Pro can boot up a large
berry Pi (RPi) microcomputer and hand it over assortment of operating systems, including Android, Fedo-
to a Chinese company? You get an even more ra, Ubuntu, Debian, Arch, openSUSE and even Raspbian.
powerful and feature packed microcomputer with a similar Lemaker created their own OS version called Bananian.
name, the Banana Pi Pro. I guess “Blueberry” must have Many microcomputers have adopted the 40 pin GPIO
been taken already. The Banana Pi Pro is slightly larger connectors and the Banana Pi Pro is no different. I found
than the RPi but it sure has more items added on. This my Sain Smart 3.5” TFT screen fit on the new board and
board is a super-sized microcomputer if you look at the worked perfectly after I updated the frame buffer interface
specs alone. and configured the GPIO to match the Banana Pi. My 7”
The processor is an Allwinner A20 ARM Cortex 7 that HDMI display also worked well too, after I swapped out
uses a quad core system on a chip design (SoC) which is one cheap HDMI cable for a better cable. The Banana,
nearly identical to the RPi. The same goes for the operating like real fruit can come in bunches; they are stackable.
speed of 1GHz and 1 gig of onboard DDR3 SDRAM. You’ll You can even stack the RPi on top of the Banana Pi. The
find the identical 40 pin GPIO header and microSD slot un- GPIOs are slightly different but that can be corrected on
derneath as the RPi, along with full HDMI and microUSB either Pi for wire configuration (remapping pins).
power connection. That is where the similarities stop. Lemaker is working hard to build up a library of software
Lemaker, backers of the Banana Pi Pro, threw in some to support the Banana Pi Pro. You can still run Python,
great additions that make up for the $10 higher price tag. Scratch, Java and other programming languages right out
The Banana has an infrared receiver built onto the board. of the box. All the big chips are on the bottom of the board
The Ethernet port is a 10/100/1000 gigabit interface while the topside looks almost naked except for the perim-
where the RPi is 10/100 megabit. There is an SATA con- eter connections. There are two microUSB ports. One for
nection for your portable hard drives, which makes up for OTG and one for power. You don’t want to confuse the two
only having two USB ports compared to RPi’s four USB but since I did, nothing seemed to happen except it didn’t
ports. I found the SATA connection to be quite fast on a 2 power up. The display interface is opposite compared to
terabyte Samsung drive I had. the RPi when looking for the camera connection. The con-
The Banana has three reset/reboot buttons located nections are switched just to keep things interesting.
across the board so you can selectively reset certain parts If you are looking for an alternative to the Raspberry Pi
of the system without restarting the whole board. Some- that has a lot of additional accessories, like built in WiFi,
body decided to add a microphone to this board knowing IR, SATA and Gigabit Ethernet, then the Banana Pi Pro is
that I’m a great singer in the shower. My singing makes your choice. The cost difference more than makes up for
my dog howl in pain but the microphone makes me sound the extra features and slightly larger size.
even better during playback with the 3.5mm AV out jack.
The Banana even comes with WiFi enabled so there is no
need to plug in a separate USB WiFi. The range is pretty ABOUT THE AUTHOR
good or as good as my iPad is, I should say. The WiFi chip
also comes with a really cool antenna so I can broadcast Bob Monroe spent each year learning entirely new skills while
my vocals across the neighborhood. maintaining his aviation skill set. He spent his spare time learning
I’m keeping all the shoes my neighbors throw at me as computer security, counterhacking, computer system hardening,
I sing. intrusion detection and vulnerability assessments, IT ethics,
The SATA connection can accommodate up to 4 tera- cryptology, and that the biggest security risk is the human being.
bytes of my karaoke songs on a drive so all my hard work on He is working as a volunteer for the Institute for Security and
yodeling will pay off someday. For some odd reason, the mi- Open Methodologies (ISECOM.org), and Hacker High School
croSD card won’t take a chip larger than 64 gig but that isn’t (hackerhighschool.org) as a researcher and writer.
44 07/2015
*BSD
INTERVIEW
CORNER
Luca Ferrari: Can you please introduce yourself Luca Ferrari: What are the main innovations of
and explain when and how you got in touch HardenedBSD project with regard to the last
with HardenedBSD project? year?
Shawn Webb: Around two-and-a-half years ago, I had Shawn Webb: Our ASLR implementation is the strongest
blogged about some of my personal goals and one of ever implemented in any of the BSDs.
them was implementing ASLR (Address Space Layout We are the only OS in existence that has true stack ran-
Randomization) for FreeBSD. An awesome dude from domization and can achieve 42 bits of entropy introduced
Hungary named Oliver Pinter came across my blog post into the stack.
and suggested we work together. He had the beginnings All of our enhancements are also per-jail. So if an ap-
of a working patch. I added execution base randomization plication misbehaves with our enhancements, that appli-
for position-independent executables (PIEs) and per-jail cation can reside in a jail with the enhancements turned
support. off just for that jail. Those enhancements (ASLR, SEGV-
We started the upstreaming process for our ASLR patch GUARD, PaX PAGEEXEC/MPROTECT, etc.) remain on
nearly two years ago. In order to make our lives easier, for the rest of the system.
we started the HardenedBSD project to serve as a stag- Additionally, we have the secadm project, allowing you
ing area for our development prior to upstreaming. So I to do that same toggling on a per-binary basis. If jailing
got started with HardenedBSD by cofounding it with Oli- the application doesn’t look attractive, then you can use
ver Pinter. secadm to simply disable the enhancement for just that
46 07/2015
application. Rulesets loaded by secadm are also per-jail. ture similar to grsecurity’s TPE (Trusted Path Execution),
We’ve been working with the OPNSense team to help an addition that would be very much welcomed by Oliver
them switch from FreeBSD to HardenedBSD so they can and me.
enjoy the same level of protection I enjoy. We’re really ex-
cited to see this relationship develop further and for the Luca Ferrari: Who do they see themselves
switch to be made. competing with?
Shawn Webb: We don’t like to see us as competitors to
Luca Ferrari: What are the main advantages of anything or anyone. We simply like to write great code
HardenedBSD project? and make FreeBSD better. With companies like Netflix us-
Shawn Webb: You get the normal awesomeness that ing FreeBSD to deliver around 36% of peak North Ameri-
FreeBSD delivers along with expert exploit mitigation and
security technologies. We’ve done a great job with our
current enhancements, but there’s still a lot we’d like to
do. This next year will be a great one for us and our users.
We have a lot more planned for the next year.
www.bsdmag.org 47
*BSD
INTERVIEW
CORNER
can Internet traffic, these security enhancements are cru- Luca Ferrari: Why did you choose FreeBSD?
cial. We need to raise the bar for attackers. Shawn Webb: I was introduced to FreeBSD as a teenag-
We’ll work with anyone and everyone who uses Free- er by some cool hackers. I instantly fell in love. I’ve been
BSD to help them bring in HardenedBSD’s work--making an advocate of FreeBSD ever since. Choosing FreeBSD
us not competitors but collaborators. as a base for HardenedBSD was a natural choice.
Luca Ferrari: Please tell us more about Luca Ferrari: Please tell us more what the basic
OPNSense. needs of HardenedBSD project are and how the
Shawn Webb: OPNSense is an up-and-coming fork of community can help develop the project?
pfSense. I own a little ASUS wireless router at home and Shawn Webb: What we at HardenedBSD need most is
know of its many vulnerabilities. I figured that I really dis- funding. It takes a lot to run a project like HardenedBSD.
like major vulnerabilities that can allow random people on I’m paying for it all myself out of my own pocket. We really
the Internet to be able to man-in-the-middle (MitM) me, need help in order to become a not-for-profit organization.
switching to a dedicated firewall/routing appliance would Additional donated hosted servers would be great, too.
be better. We could make use of another package building server
I used pfSense heavily in the past and grew to love the and another nightly build server.
project. However, I wanted a custom version of it for my
own use, but instead of using FreeBSD as the base, I Luca Ferrari: Summing up, please tell our
wanted to use HardenedBSD. I like to eat my own dog- Readers why the HardenedBSD project is so
food. After a bit of digging, I figured out that it’s near im- unique and what the users can achieve when
possible to do your own builds of pfSense. The documen- they decide to use it?
tation for the build process doesn’t exist and the pfSense Shawn Webb: HardenedBSD provides expert exploit
project doesn’t want such documentation to exist. mitigation and security technologies to FreeBSD. These
So I kept looking. I had heard of OPNSense before and technologies have proven to make life difficult for would-
that it was a fork of pfSense. Their build documentation is be attackers. Our goal is to piss off the bad guys.
front-and-center. Though pfSense was my first choice, I
naturally went with OPNSense. After a bit of digging and
some handholding from the OPNSense team, I was able
to produce a working build relatively quickly.
I found that I work really well with the OPNSense team
and they work well with me. Their interest became piqued
as soon as they learned who I was and what I was doing. ABOUT AUTHOR
We began talking about switching OPNSense from Free-
BSD to HardenedBSD. We have teamed up to help and Luca Ferrari lives in Italy with his wife and son.
support each other in our ventures. He received a PhD in Computer Science by
University of Modena and Reggio Emilia, has
Luca Ferrari: How is the VDSO (Virtual Dynamic been co-founder, member of the board of
Shared Object) integration going? directors and president of Italian PostgreSQL
Shawn Webb: Really well! It was completed over the Users’ Group (ITPUG). Luca loves Open Source
weekend of 04 July 2015. Finishing the Virtual Dynamic software and Unix culture, uses GNU Emacs,
Shared Object (VDSO) randomization was the final piece Perl, zsh and FreeBSD along with a lot of other
to finishing our ASLR implementation. cool tools.
48 07/2015
Among clouds
Performance and
Reliability is critical
Download syslog-ng Premium Edition
product evaluation here
www.balabit.com
The High-Speed Reliable LoggingTM (HSRL) and Reliable Log Transfer ProtocolTM (RLTP) names are registered trademarks of BalaBit IT Security.
Enroll to BUILD YOUR OWN PENTEST LAB online course and learn how to create your own
pentest lab.
This course covers various virtualization software and penetration testing tools like Kali Linux,
Nessus, Metasploit, Metasploitable, Nmap, and others.
Through practical hands-on labs, you will be able to not only identify systems but also identify
their vulnerabilities.
[email protected]
Course Plan:
Pre-Course Material Exercises
«« Why Do I Need a Pen Test Lab «« Run Nmap Scans against Ubuntu
«« Definitions «« Run Zenmap Scans Against Metasploitable2
«« Creating Directory Structure For the Course «« Run Dnmap Scans Against Host
«« Download Virtual Images Module 3 Vulnerability Scans
«« Acquire Nessus Licenses
«« Installation and Licensing of Nessus Vulnerability
Module 1 The Build Scanner
«« Definitions «« Installation of Netsparker Web Vulnerability
«« Some Basic Linux Commands You Need to Know Scanner
Software «« Basic Nessus Scanning
«« Basic Netsparker Scanning
«« Installation of VMPlayer and Virtual Box. «« Intermediate Nmap Scans
You Decide, We Will Cover Both.
«« Setup of Our Penetration Testing System – Exercises
Kali Linux Distribution «« Run a Nessus Scan Against Metasploitable2
«« Setup a Linux Client as a Virtual Machine «« Run a Netsparker Scans Against Bee-Box
«« Setup Our First Vulnerable Machine (BWAMP)
Metasploitable2 «« Run a Nessus Scan Against Ubuntu
«« Setup Our Second Vulnerable Machine Bee-box Module 4 Advanced Scanning and Reporting
(BWAMP)
«« Nessus Advanced Scans
Exercises «« Netsparker Advanced Scans
«« Overview of Virtual Machine Settings «« Nmap Advanced Scans
«« Run the Basic Linux commands «« Metasploit Reporting
«« Upgrade Kali Linux Distribution «« Review Other Resources Available to You…
Module 2 Port Scanning «« Where Do I Get Virtual Machines
If you have any questions or just want to get to know us better feel free to contact
me at [email protected] or just answer this email
Get 10% discount on our magazines and online courses. Insert the code and use it at check-out
10eForSe07
Code is valid till the end of July