<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>OpenBSD and FreeBSD resources &#187; Security</title>
	<atom:link href="http://purebsd.com/category/openbsd/security/feed" rel="self" type="application/rss+xml" />
	<link>http://purebsd.com</link>
	<description></description>
	<lastBuildDate>Tue, 01 Jun 2010 06:01:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>Logcheck explained</title>
		<link>http://purebsd.com/logcheck-explained.html</link>
		<comments>http://purebsd.com/logcheck-explained.html#comments</comments>
		<pubDate>Tue, 01 Jun 2010 05:33:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[OpenBSD]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Logs]]></category>

		<guid isPermaLink="false">http://purebsd.com/?p=57</guid>
		<description><![CDATA[Intro Logcheck is a program that helps you in sorting out the relevant messages from the various (system) log files on Unix systems. It sifts through them on a regular basis (via crontab) and sends its findings to the system administrator by mail. That mail contains all the possibly important events, break-in attemts and other [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Intro</strong></p>
<p>Logcheck is a program that helps you in sorting out the relevant messages from the various (system) log files on Unix systems. It sifts through them on a regular basis (via crontab) and sends its findings to the system administrator by mail. That mail contains all the possibly important events, break-in attemts and other strange messages.</p>
<p>It was created by Psionic Software (now merged with Cisco) and is confirmed to run on many of the most popular Unix systems, including OpenBSD.</p>
<p><strong>Download</strong></p>
<p>Since www.psionic.com isn&#8217;t providing the package anymore (because of the merger with Cisco), you can <a href="http://web.archive.org/web/20060313055310/http://www.purebsd.com/files/logcheck-1.1.1.tar.gz">download Logcheck</a> from PureBSD.</p>
<p>You can also install the port (or package) called &laquo;logsentry&raquo;. LogSentry and Logcheck are the same thing, but since Psionics merger with Cisco it lives on with a different name.</p>
<p>The port is located in <code>/usr/ports/security/logsentry</code>. The binary package has a name equal or similar to &laquo;logsentry-1.1.1p1.tgz&raquo; and can be found on any FTP site carrying OpenBSD.</p>
<p><strong>Installation</strong></p>
<p>By source:<br />
<code> cd /tmp<br />
tar xvfz /location/of/logcheck-1.1.1.tar.gz<br />
cd logcheck-1.1.1<br />
make generic<br />
</code><br />
By port:<br />
<code> cd /usr/ports/security/logsentry<br />
make<br />
make install<br />
</code><br />
By binary package:<br />
<code> pkg_add logsentry-1.1.1p1.tgz<br />
</code><br />
<strong>Configuration</strong></p>
<p>Make sure that /usr/local/etc/logcheck.sh is setup the way you prefer.</p>
<p>If you do not want to have root receive mail from Logcheck, but a local user or remote user, edit the SYSADMIN variable:</p>
<p><code> SYSADMIN=alexdehaas@puur.rookgordijn.nl<br />
</code><br />
All &laquo;$LOGTAIL&raquo; lines should be <strong>commented out</strong>, except the ones for the OpenBSD log files:</p>
<p><code> # Generic and Linux Slackware 3.x<br />
#$LOGTAIL /var/log/messages &gt; $TMPDIR/check.$$</p>
<p># OpenBSD 3.4<br />
$LOGTAIL /var/cron/log &gt; $TMPDIR/check.$$<br />
$LOGTAIL /var/log/authlog &gt;&gt; $TMPDIR/check.$$<br />
$LOGTAIL /var/log/daemon &gt;&gt; $TMPDIR/check.$$<br />
$LOGTAIL /var/log/maillog &gt;&gt; $TMPDIR/check.$$<br />
$LOGTAIL /var/log/messages &gt;&gt; $TMPDIR/check.$$<br />
$LOGTAIL /var/log/secure &gt;&gt; $TMPDIR/check.$$<br />
$LOGTAIL /var/log/wlanlog &gt;&gt; $TMPDIR/check.$$<br />
</code><br />
<strong>Running Logcheck</strong></p>
<p>Edit root&#8217;s crontab:<br />
<code><br />
crontab -e<br />
</code><br />
And add the following two lines:</p>
<p><code> # Security: Check every 30 minutes logfiles<br />
*/30 * * * * /usr/local/etc/logcheck.sh<br />
</code><br />
<strong>Filtering log messages</strong></p>
<p>If you do or do not wish to see certain log messages mailed to you, you can edit the<code>logcheck.[hacking,ignore,violations,violations.ignore]</code> files located in<code>/usr/local/etc</code>. All lines in those files are patterns in the regular expression format used by<code>grep</code>.</p>
<ul>
<li><code>logcheck.hacking</code>:<br />
This file contains lines which consist of patterns indicating an active system attack. You can add your own patterns to it when deemed necessary.</li>
<li><code>logcheck.violations</code>:<br />
This file contains lines with patterns indicating some sort of negative system activity. You can add your own patterns to it when deemed necessary.</li>
<li><code>logcheck.violations.ignore</code>:<br />
Lines of patterns in this file are used to filter out log messages that<code>logcheck.violations</code> picks up as being negative system events. In other words: the more specific pattern lines in <code>logcheck.violations.ignore</code> override the more generic pattern lines in <code>logcheck.violations</code>.</p>
<p>You can add your own exceptions to it. Examples:</p>
<p><code> sendmail.*: .*: Authentication-Warning: .*: .* owned process doing -bs<br />
sm-mta.*: ruleset=check_relay, .* reject=.* .*<br />
</code></li>
<li><code>logcheck.ignore</code>:<br />
This file contains lines with keywords indicating that a message should not be reported. Normally, all log messages are reported as &laquo;unusual system activity&raquo;, so you won&#8217;t miss anything not accounted for in the other logcheck files. So this is a catch-all file.</p>
<p>You can add your own exceptions to it. Examples:</p>
<p><code> dhcpd: DHCPDISCOVER from .* via xl0<br />
dhcpd: DHCPREQUEST for 10.0.* from .* via xl0<br />
dhcpd: DHCPOFFER on 10.0.* to .* via xl0<br />
dhcpd: DHCPACK on 10.0.* to .* via xl0<br />
wlanmon: WLAN bridge connection is just fine\.<br />
syslogd: restart<br />
spamd.*: .*\..*\..*\..*: connected \(.*\)<br />
spamd.*: .*\..*\..*\..*: disconnected after .* seconds\.<br />
spamd.*: .*\..*\..*\..*: \&lt;.*\&gt; -\&gt; \&lt;.*\&gt;<br />
spamd.*: .*\..*\..*\..*: From: .* To: .*<br />
ftp-proxy.*: accepted connection from 10.0.0.*:.* to .*<br />
cvs.*: connect from .*.intranet.atomicvoid.net<br />
</code><br />
Now log messages matching any of the above lines are being ignored by Logcheck.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://purebsd.com/logcheck-explained.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TCP Wrappers / Hosts Access</title>
		<link>http://purebsd.com/tcp-wrappers-hosts-access.html</link>
		<comments>http://purebsd.com/tcp-wrappers-hosts-access.html#comments</comments>
		<pubDate>Tue, 01 Jun 2010 05:31:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[OpenBSD]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Network]]></category>
		<category><![CDATA[TCP]]></category>

		<guid isPermaLink="false">http://purebsd.com/?p=54</guid>
		<description><![CDATA[This is a short and basic introduction to the TCP wrappers. Useful as a start to create your own access control files tailored to your own specific needs. Introduction Probably most people know Wietse Venema&#8217;s TCP Wrapper software as a result of their usage ofinetd, the internet &#171;super-server&#187;, in combination with tcpd. An arbitrary line of/etc/inetd.conf, [...]]]></description>
			<content:encoded><![CDATA[<p>This is a short and basic introduction to the TCP wrappers. Useful as a start to create your own access control files tailored to your own specific needs.</p>
<p><strong>Introduction</strong></p>
<p>Probably most people know Wietse Venema&#8217;s TCP Wrapper software as a result of their usage of<code>inetd</code>, the internet &laquo;super-server&raquo;, in combination with <code>tcpd</code>. An arbitrary line of<code>/etc/inetd.conf</code>, the configuration file of <code>inetd</code>:</p>
<p><code>ident stream tcp nowait nobody /usr/libexec/tcpd /usr/libexec/identd -elo</code></p>
<p>The <code>/usr/libexec/tcpd</code> here is the program that takes a look at the incoming connection that <code>inetd</code> has accepted on behalf of the <code>identd</code> program. If it thinks it can allow the connection, it passes it to identd. If not, it unleashes hell (well,.. it just drops the connection) on that TCP connection and <code>identd</code> will never see a packet coming from the remote client.</p>
<p>But not only <code>tcpd</code> uses the wrapping functionality. By default OpenBSD&#8217;s Sendmail and SSH daemon are linked to LIBWRAP and can use its functionality too.</p>
<p><strong>Access control flow/algorithm</strong></p>
<p>To tell tcpd and other programs linked to LIBWRAP which connection to which daemon/service to allow, one should modify or leave alone the following two files:<br />
<code>/etc/hosts.allow</code><br />
<code>/etc/hosts.deny</code></p>
<p>In <code>hosts.allow</code> you put the remote host/local daemon combinations that you approve of having a happy TCP chatter. If a remote host, the client, likes to chat with a local daemon and that client/daemon pair has a positive match in the <code>hosts.alllow</code> file, the client is granted access to the daemon&#8217;s services. The <code>hosts.deny</code> file is ignored.</p>
<p>If there is no positive match, the <code>hosts.deny</code> is checked for a match. If the tcp wrapper can find a positive match in <code>hosts.deny</code>, the client is not granted access to the daemon and the TCP connection gets dropped. But if the client/daemon pair is not matched, the connection to the daemon is granted.</p>
<p>If one or both of the hosts access files is missing, the above explained flow treats them as if they exist, but are empty.</p>
<p>The control flow is a Yes-Unless kind of strategy. You can come in, unless you&#8217;re mentioned in<code>hosts.deny</code>. To reverse that strategy that you can configure <code>hosts.deny</code> to deny all access. Then all clients trying to communicatie with a daemon should be listed in <code>hosts.allow</code>. Then we have a No-Unless situation created.</p>
<p><strong>Configuration</strong></p>
<p>Here I&#8217;ll explain how to create that el neato No-Unless situation with some real life X-rated examples.</p>
<p>First we edit <code>hosts.deny</code> to disallow life, the universe and everything:</p>
<p><code>ALL: ALL</code></p>
<p>Then we edit <code>hosts.allow</code> to let the complete internet whisper in the ears of our SSH daemon, Sendmail and our ident daemon:</p>
<p><code>identd: ALL</code><br />
<code>sendmail: ALL</code><br />
<code>sshd: ALL</code></p>
<p>Don&#8217;t use above example if you don&#8217;t like allowing anyone to access the Sendmail daemon, ssh daemon and/or ident daemon.<br />
The combination of the above example of the <code>hosts.deny</code> and <code>hosts.allow</code> allows the complete internet access to your sendmail, ssh daemon and ident daemon, but completely forbids anyone to access any other daemon/service you&#8217;re running.</p>
<p>If you&#8217;d like to have hosts on your intranet access to your POP3 daemon, but not anyone else you can do something like this in <code>hosts.allow</code>:</p>
<p><code>popa3d: 127.0.0.1 192.168.0.</code></p>
<p>With this rule access is granted to our POP3 daemon popa3d from localhost and the &laquo;192.168.0.&raquo; IP range. You can read &laquo;192.168.0.&raquo; like 192.168.0.*, 192.168.0.1 &#8211; 192.168.0.254, or 192.168.0.0/24. It comes down to 254 IP addresses that start with &laquo;192.168.0&#8243;.</p>
<p><strong>More information</strong></p>
<p>More information can be obtained by reading the following man pages:</p>
<p>- hosts_access(5)<br />
- hosts_options(5)<br />
- tcpd(8)</p>
<p>They provide far more advanced information then you can find here and recommended reading if you&#8217;d like to tailor the hosts access files to your own specific (and complex?) needs.</p>
]]></content:encoded>
			<wfw:commentRss>http://purebsd.com/tcp-wrappers-hosts-access.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SSH &#8211; The Secure SHell</title>
		<link>http://purebsd.com/ssh-the-secure-shell.html</link>
		<comments>http://purebsd.com/ssh-the-secure-shell.html#comments</comments>
		<pubDate>Tue, 01 Jun 2010 05:29:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[OpenBSD]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[SSH]]></category>

		<guid isPermaLink="false">http://purebsd.com/?p=52</guid>
		<description><![CDATA[The SSH protocol was developed to solve the issue of insecure remote logins with programs like telnet, rsh and rlogin. OpenSSH, developed by the OpenBSD team, and all other SSH implementations make use of encryption to transmit data over the internet and intranet. Sniffing passwords and sensitive data becomes much harder for parties interested in [...]]]></description>
			<content:encoded><![CDATA[<p>The SSH protocol was developed to solve the issue of insecure remote logins with programs like telnet, rsh and rlogin. OpenSSH, developed by the OpenBSD team, and all other SSH implementations make use of encryption to transmit data over the internet and intranet.<br />
Sniffing passwords and sensitive data becomes much harder for parties interested in your transmissions.</p>
<p><strong>SSH client</strong></p>
<p>The SSH client, <code>/usr/bin/ssh</code> on OpenBSD systems, is used to login on a remote host or directly execute a program remotely.<br />
Login to remote host:</p>
<p><code>ssh -l username remote-host.example.org</code><br />
<code>ssh username@remote-host.example.org</code></p>
<p>If your username is the same on the remote end as it is where you execute the SSH client, providing a username is not necessary.</p>
<p>At the time of your first login attempt you&#8217;re asked by your own SSH client if you&#8217;d like to accept the public key of the remote host. Enter &laquo;yes&raquo; if you verified the authenticity of that key. That public key of the remote host is then saved to <code>~/.ssh/known_hosts</code>.<br />
That key is checked with the offered public key each time you&#8217;re connection again to this remote host. When the offered key differs from the one previously stored, your SSH client will alert you about it and terminates the connection process.<br />
This way, accidentally logging in to a host pretending to be the host you&#8217;d like to connect with, can be prevented.<br />
If you see such a warning from your SSH client, verify with your sysadmin if that new key is a valid/authentical public key of the host. There are valid reasons for hosts having a new public key.</p>
<p><strong>scp: secure copy</strong></p>
<p><code>scp</code> is used to copy files securely to a remote host. Its syntax is not that different from <code>cp</code> or<code>rcp</code>. I think it&#8217;s best to just provide some examples of its usage.</p>
<p>Copying files from the current host to remote host:</p>
<p><code>scp onefile.tgz username@remote-host.example.org:adirectory</code><br />
<code>scp *.tgz username@remote-host.example.org:/tmp/adirectory</code><br />
<code>scp -r /tmp/backup username@remote-host.example.org:/tmp/adirectory</code></p>
<p>Copying files from remote host to this host:</p>
<p><code>scp 'username@remote-host.example.org:myfiles/onefile.tgz' .</code><br />
<code>scp 'username@remote-host.example.org:myfiles/*.tgz' .</code><br />
<code>scp -r 'username@remote-host.example.org:myfiles' /tmp/backup</code></p>
<p><strong>sftp: secure ftp</strong></p>
<p><code>sftp</code> is best compared and used as a rather lite edition of a standard text-mode ftp client. As far as I can see it only differs from FTP in that it&#8217;s using encryption to transmit data and if I&#8217;m not mistaken, all communication between client and server goes through port 22.</p>
<p><strong>SSH daemon</strong></p>
<p>The SSH daemon is the program that accepts and handles the incoming SSH connections. It is run by default on OpenBSD systems and configured pretty secure. The only thing I changed was the option that allows remote logins to root, since I&#8217;m rather paranoid (:<br />
To turn off the allowance of remote root logins, edit <code>/etc/sshd_config</code> and change the<code>PermitRootLogin</code> to <code>no</code>:</p>
<p><code>PermitRootLogin no</code></p>
<p><strong>sftp-server</strong></p>
<p>The sftp-server is the daemon or server side of the Secure FTP protocol. To be able to use sftp to your host, edit the SSH daemon configuration file <code>/etc/sshd_config</code>. Search for the following line and remove the hash-sign in front of it:</p>
<p><code>Subsystem sftp /usr/libexec/sftp-server</code></p>
<p>Then restart your SSH daemon.</p>
]]></content:encoded>
			<wfw:commentRss>http://purebsd.com/ssh-the-secure-shell.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Security tips</title>
		<link>http://purebsd.com/security-tips.html</link>
		<comments>http://purebsd.com/security-tips.html#comments</comments>
		<pubDate>Tue, 01 Jun 2010 05:29:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[OpenBSD]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[tip]]></category>

		<guid isPermaLink="false">http://purebsd.com/?p=50</guid>
		<description><![CDATA[Here I try to explain what further measures I took to further secure my system. Note: it is Considered Wise(tm) to backup any files before you edit them to something likeorigfile-dist where origfile is the name of the file you&#8217;re about to modify. I tortured my system with the following: Login to the machine as root. [...]]]></description>
			<content:encoded><![CDATA[<p>Here I try to explain what further measures I took to further secure my system.</p>
<p>Note: it is Considered Wise(tm) to backup any files before you edit them to something like<code>origfile-dist</code> where <code>origfile</code> is the name of the file you&#8217;re about to modify.</p>
<p>I tortured my system with the following:</p>
<ol type="1">
<li>Login to the machine as root.<br />
Add your own user account.<br />
Put that account in de group wheel, so you will be able to su to root.</li>
<li>If you&#8217;re just a little paranoid, you should edit /etc/sshd_config:<br />
&laquo;PermitRootLogin yes&raquo; -&gt; &laquo;PermitRootLogin no&raquo;<br />
This disables root logins over the network and that&#8217;s a Good Thing(tm).</li>
<li>Different versions of OpenBSD have different services enabled/disabled by default. Check /etc/inetd.conf and /etc/rc.conf and disable what you don&#8217;t like and enable what pleases you. Use a portscanner like <code><a href="http://web.archive.org/web/20060313055505/http://www.insecure.org/nmap">nmap</a></code> to double check you haven&#8217;t forgotten anything to turn on or off.</li>
<li>OpenBSD&#8217;s 2.7 <code>/etc/inetd.conf</code> file contains some lines I like to comment out:
<pre>    ..
    finger
    ..
    comsat
    ntalk
    ..
    daytime
    time
    ..
    rstatd/1-3
    rusersd/1-3
    ..</pre>
<p>So I commented them out (-:</li>
<li>If <code>portmap</code> makes you puke, edit <code>/etc/rc.conf</code> and change <code>portmap=YES</code> into something better. For instance: <code>portmap=NO</code>.</li>
<li>/etc/inetd.conf contains a line for the ident daemon:<br />
<em>ident stream tcp nowait nobody /usr/libexec/identd identd -elo</em><br />
But I&#8217;d like to run it through the tcp_wrapper, so I changed it to:<br />
<em>ident stream tcp nowait nobody /usr/libexec/tcpd identd -elo</em></li>
<li>/etc/hosts.allow and /etc/hosts.deny define which hosts may or may not use certain system facilities. If you&#8217;re paranoid you place only one line in /etc/hosts.deny:
<p><em>ALL: ALL</em></p>
<p>After that you define the hosts that do may connect to your system in /etc/hosts.allow, e.g.:</p>
<p><em>in.proftpd: 192.168.0. trusted-host.microsoft.com .no-evil-here.net<br />
identd: ALL<br />
</em></li>
<li><code>cron</code> is a neat, but powerful scheduler for Unices. But you might not want to have anyone being able to use it. For limited access create a file in <code>/var/cron</code> called <code>allow</code> if only a limited set of people may have a crontab. Create a <code>deny</code> file in that same directory if you want everyone to be able to use cron except a few nasty bastards you don&#8217;t like/trust enough.
<p><code>/var/cron/allow:</p>
<p>root<br />
alex<br />
forge<br />
</code></li>
<li>Remote syslog. It is possible for whisper in <code>syslogd</code>&#8216;s ear that it should send it&#8217;s log entries not only to the various files in <code>/var/log</code>, but also to a remote host listening to the UDP syslog port (udp/514).<br />
Fire up /etc/syslog.conf in <code>vi</code> and place anywhere you like the following line:</p>
<pre>*.*			@192.168.5.14</pre>
<p>Now syslogd will send ALL entries feeded to it also to <code>udp/192.168.5.14:514</code>. Be careful to only use tabs when editing <code>/etc/syslog.conf</code>. Spaces are poison for<code>syslogd</code>.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://purebsd.com/security-tips.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

