<?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>Linux System Administration and Security &#187; Security</title>
	<atom:link href="http://www.jasonbrown.us/category/security/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jasonbrown.us</link>
	<description></description>
	<lastBuildDate>Wed, 18 Aug 2010 16:42:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Disable Weak Ciphers in Dovecot</title>
		<link>http://www.jasonbrown.us/2010/02/disable-weak-ciphers-in-dovecot/</link>
		<comments>http://www.jasonbrown.us/2010/02/disable-weak-ciphers-in-dovecot/#comments</comments>
		<pubDate>Mon, 15 Feb 2010 13:50:43 +0000</pubDate>
		<dc:creator>jason</dc:creator>
				<category><![CDATA[Dovecot]]></category>
		<category><![CDATA[EMail]]></category>
		<category><![CDATA[SSL]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.jasonbrown.us/?p=12</guid>
		<description><![CDATA[In running my periodic Nessus scans, it picked up a few medium severity vulnerabilities against Dovecot. One was &#8220;SSL Anonymous Cipher Suites Supported&#8221; and the other, &#8220;SSL Weak Cipher Suites Supported.&#8221; Look in the Dovecot config file located in /etc/dovecot.conf under &#8220;SSL ciphers to use&#8221; and you will see: ssl_cipher_list = ALL:!LOW:!MEDIUM To disable these ]]></description>
			<content:encoded><![CDATA[<p>In running my periodic Nessus scans, it picked up a few medium severity vulnerabilities against Dovecot.  One was &#8220;SSL Anonymous Cipher Suites Supported&#8221; and the other, &#8220;SSL Weak Cipher Suites Supported.&#8221;</p>
<p>Look in the Dovecot config file located in /etc/dovecot.conf under &#8220;SSL ciphers to use&#8221; and you will see:<br />
<code>ssl_cipher_list = ALL:!LOW:!MEDIUM</code></p>
<p>To disable these weak ciphers change this to:<br />
<code>ssl_cipher_list = ALL:!LOW:!MEDIUM:!MD5:!SSL2:!EXP-ADH-DES-CBC-SHA:!EXP-EDH-RSA-DES-CBC-SHA:!EXP-DES-CBC-SHA:!EXP-EDH-RSA-DES-CBC-SHA:!EXP-ADH-DES-CBC-SHA:!EXP-DES-CBC-SHA:!ADH-AES256-SHA:!ADH-AES128-SHA:!ADH-DES-CBC3-SHA:!EXP-ADH-DES-CBC-SHA:!EXP-ADH-DES-CBC-SHA:!ADH-DES-CBC3-SHA</code></p>
<p>Run the Nessus scan again and those two vulnerabilities go away <img src='http://www.jasonbrown.us/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.jasonbrown.us/2010/02/disable-weak-ciphers-in-dovecot/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Editing SELinux Policies</title>
		<link>http://www.jasonbrown.us/2010/02/editing-selinux-policies/</link>
		<comments>http://www.jasonbrown.us/2010/02/editing-selinux-policies/#comments</comments>
		<pubDate>Mon, 15 Feb 2010 13:46:55 +0000</pubDate>
		<dc:creator>jason</dc:creator>
				<category><![CDATA[SELinux]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.jasonbrown.us/?p=8</guid>
		<description><![CDATA[There are times where SELinux just does not want to play nice. For instance, after installing ClamAV I began running into problems where if I did not turn off SELinux while ClamAV was running, then SMTP traffic would fail. To fix this issue we must first look at the messages file under /var/log. Within this ]]></description>
			<content:encoded><![CDATA[<p>There are times where SELinux just does not want to play nice.  For instance, after installing ClamAV I began running into problems where if I did not turn off SELinux while ClamAV was running, then SMTP traffic would fail.  To fix this issue we must first look at the messages file under /var/log.  Within this file we will see error messages like:<br />
<code>setroubleshoot: SELinux is preventing cleanup (postfix_cleanup_t) "search" to ./clamav (clamd_var_lib_t).</code></p>
<p>Which tells you to run the command:<br />
<code>sealert -l a1bc9b39-80a2-4f2e-963f-12daf766a8d4</code></p>
<p>Usually the report is very good and diagnosing and telling you which booleans to activate, however in this instance we have to create our own module.</p>
<p>First: Download and install selinux-policy-devel<br />
Second: Parse through the raw audit messages.  We are looking for two things; message type and comm name.<br />
Third: Run the ausearch command and pipe it to audit2allow<br />
For instance: <code>ausearch -m AVC --comm cleanup | audit2allow -M ClamAV</code></p>
<p>Once the files have been generated then run: <code>semodule -i ClamAV.pp</code> and see if the problem has been resolved.  If not, tail the messages log again to see if there is any additional SEAlerts that you should be aware of.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jasonbrown.us/2010/02/editing-selinux-policies/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RHEL/CentOS 5 server security</title>
		<link>http://www.jasonbrown.us/2010/01/rhelcentos-5-server-security/</link>
		<comments>http://www.jasonbrown.us/2010/01/rhelcentos-5-server-security/#comments</comments>
		<pubDate>Sun, 17 Jan 2010 13:52:09 +0000</pubDate>
		<dc:creator>jason</dc:creator>
				<category><![CDATA[NSA]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.jasonbrown.us/?p=14</guid>
		<description><![CDATA[As a part of the sys admin&#8217;s job, it is important to take a few extra minutes to go through and properly secure a newly installed Linux server. These steps include enabling SELinux on the machine, configuring the firewall, and setting user permissions. There are however additional steps one should take in order to secure ]]></description>
			<content:encoded><![CDATA[<p>As a part of the sys admin&#8217;s job, it is important to take a few extra minutes to go through and properly secure a newly installed Linux server.  These steps include enabling SELinux on the machine, configuring the firewall, and setting user permissions.  There are however additional steps one should take in order to secure their server.  One would be to tune and secure kernel parameters, set limits on kernel dumps, prevent IPv6 from loading if you company is not using it, and turning off unnecessary services.</p>
<p><em><strong><code>Networking</code></strong></em><br />
First, lets take a look at configuring kernel parameters to prevent network based attacks.  These include disallowing intruders to alter routing tables and source routed packets, preventing an intruder from configuring the server to become a router, and turning on reverse path filtering.  To change these settings edit the /etc/sysctl.conf file and enter:<br />
<code>net.ipv4.conf.all.accept_source_route = 0<br />
net.ipv4.conf.all.accept_redirects = 0<br />
net.ipv4.conf.all.secure_redirects = 0<br />
net.ipv4.conf.all.log_martians = 1<br />
net.ipv4.conf.default.accept_source_route = 0<br />
net.ipv4.conf.default.accept_redirects = 0<br />
net.ipv4.conf.default.secure_redirects = 0<br />
net.ipv4.icmp_echo_ignore_broadcasts = 1<br />
net.ipv4.icmp_ignore_bogus_error_messages = 1<br />
net.ipv4.tcp_syncookies = 1<br />
net.ipv4.conf.all.rp_filter = 1<br />
net.ipv4.conf.default.rp_filter = 1</code></p>
<p>If you are currently running IPv6 at your company, here are a few kernel parameters to prevent network based attacks:<br />
<code>net.ipv6.conf.default.router_solicitations = 0<br />
net.ipv6.conf.default.accept_ra_rtr_pref = 0<br />
net.ipv6.conf.default.accept_ra_pinfo = 0<br />
net.ipv6.conf.default.accept_ra_defrtr = 0<br />
net.ipv6.conf.default.autoconf = 0<br />
net.ipv6.conf.default.dad_transmits = 0<br />
net.ipv6.conf.default.max_addresses = 1</code></p>
<p>To make these settings effective without rebooting the server type <code>sysctl -p</code></p>
<p>We can go a step further by disabling unused network functions such as IPv6 and prevent self assigned addressing.  </p>
<p>To detect whether or not IPv6 is running on a server type: <code>ifconfig | grep inet6</code> which will return:<br />
<code>inet6 addr: fe80::240:5ff:fe32:ef19/64 Scope:Link<br />
          inet6 addr: ::1/128 Scope:Host<br />
          inet6 addr: fe80::200:ff:fe00:0/64 Scope:Link</code><br />
To prevent IPv6 from loading, run the following command:<br />
<code>echo "install ipv6 /bin/true" > /etc/modprobe.d/ipv6</code><br />
Then add the following lines to <code>/etc/sysconfig/network</code>:<br />
<code>NETWORKING_IPV6=no<br />
IPV6INIT=no</code><br />
This will deactivate the IPv6 protocol from running on the server.</p>
<p>To prevent self assigned addressing on network cards, open the <code>/etc/sysconfig/network</code> file and add:<br />
<code>NOZEROCONF=yes</code></p>
<p><em><strong><code>Server security</code></strong></em><br />
Turning off the ability to create core dumps is important as intruders can use this to gather information about running services and configurations in order to exploit them.  To do so, edit the <code>/etc/security/limits.conf</code> file and insert:<br />
*       hard core 0<br />
We should also prevent setuid programs from creating these as well:<br />
<code>sysctl -w fs.suid_dumpable=0</code></p>
<p>There are also built in kernel features which can help protect against buffer overflow attacks.  These features are turned on by default, however these kernel parameters should be enabled in case they have been turned off:<br />
<code>sysctl -w kernel.exec-shield=1<br />
sysctl -w kernel.randomize_va_space=1</code><br />
These settings ensure randomization of the stack and memory regions, which are refereed to as the ExecShield.</p>
<p>There are many services which are running on a default installation which include cups, sendmail, isdn, bluetooth, and many others.  If these services are not being used on the server then they should be turned off and configured not to start up on a reboot.  To do so we can run the following bash script:<br />
<code>for i in acpid autofs avahi-daemon luetooth cups firstboot gpm hidd ip6tables sendmail exim xfs xinetd yum-updatesd rhnsd pcscd readahead_early readahead_later apmd hplip isdn ip6tables mcstrans<br />
do<br />
service $i stop<br />
chkconfig $i off<br />
done</code></p>
<p>Your services will vary depending on the installation.  We should also ensure that X does not run on reboot, placing the server in run level three.  To do so, edit the <code>/etc/inittab</code> file and change <code>id:5:initdefault:</code> to <code>id:3:initdefault:</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jasonbrown.us/2010/01/rhelcentos-5-server-security/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Install mod_security for RHEL/CentOS</title>
		<link>http://www.jasonbrown.us/2009/12/install-mod_security-for-rhelcentos/</link>
		<comments>http://www.jasonbrown.us/2009/12/install-mod_security-for-rhelcentos/#comments</comments>
		<pubDate>Sun, 27 Dec 2009 13:54:14 +0000</pubDate>
		<dc:creator>jason</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://www.jasonbrown.us/?p=16</guid>
		<description><![CDATA[You will need to install the Extra Packages for Enterprise Linux (EPEL) rpm which can be found at: 'rpm -ivh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm' for i386 or: 'rpm -ivh http://download.fedora.redhat.com/pub/epel/5/x86_64/repoview/epel-release.html' for 64bit. Once the EPEL rpm has been installed, you will then be able to install mod_security by typing 'yum install mod_security' and restart the Apache service. Make ]]></description>
			<content:encoded><![CDATA[<p>You will need to install the Extra Packages for Enterprise Linux (EPEL) rpm which can be found at:<br />
<code><strong><em>'rpm -ivh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm'</strong></em></code> for i386<br />
or: <code><em><strong>'rpm -ivh http://download.fedora.redhat.com/pub/epel/5/x86_64/repoview/epel-release.html'</em></strong></code> for 64bit.</p>
<p>Once the EPEL rpm has been installed, you will then be able to install mod_security by typing <code><em><strong>'yum install mod_security'</strong></em></code> and restart the Apache service.</p>
<p>Make sure that the mod_security engine is turned on by going to<br />
/etc/httpd/modsecurity.d/modsecurity_crs_10_config.conf and look for <strong><em><code>'SecRuleEngine On'</code></em></strong></p>
<p>One of the coolest features is masking the server signature of Apache.  This can be done by editing the httpd.conf and making sure that <strong><em><code>'ServerTokens'</strong></em></code> is set to <strong><em><code>'Full'</strong></em></code>.  Then change <strong><em><code>'SecServerSignature'</strong></em></code> in <strong><code><em>'modsecurity_crs_10_config.conf'</strong></em></code> to whatever you want.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jasonbrown.us/2009/12/install-mod_security-for-rhelcentos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Postfix and SSL</title>
		<link>http://www.jasonbrown.us/2009/11/postfix-and-ssl/</link>
		<comments>http://www.jasonbrown.us/2009/11/postfix-and-ssl/#comments</comments>
		<pubDate>Sun, 15 Nov 2009 13:55:45 +0000</pubDate>
		<dc:creator>jason</dc:creator>
				<category><![CDATA[Postfix]]></category>
		<category><![CDATA[SSL]]></category>

		<guid isPermaLink="false">http://www.jasonbrown.us/?p=19</guid>
		<description><![CDATA[First we need to create our certificates. To create a certificate authority download the openssl-perl package through Yum: &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; yum install openssl-perl &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; Then issue the following command to create the CA certificate. &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; ./CA.pl -newca &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; After this process is done we need to create the certificate request and key. Once the certificate request ]]></description>
			<content:encoded><![CDATA[<p>First we need to create our certificates. To create a certificate authority download the openssl-perl package through Yum:<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
<em><strong><code>yum install openssl-perl</code></strong></em><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>Then issue the following command to create the CA certificate.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
<strong><em><code>./CA.pl -newca</code></strong></em><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>After this process is done we need to create the certificate request and key. Once the certificate request has been generated you then need to have the pem file signed by the CA.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
<strong><em><code>openssl req -new -days 365 -newkey rsa:2048 -keyout newkey.key -out newreq.pem<br />
openssl ca -out post_signed_cert.pem -infiles newreq.pem</code></strong></em><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>Create a directory on the Postfix server under the /etc/pki directory called postfix, place these files there, and change the permissions on the files.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
<strong><em><code>chmod 0400 *</code></strong></em><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>Add the following lines at the bottom of the main.cf file for Postfix<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
<strong><em><code>#SASL<br />
smtpd_sasl_auth_enable = yes<br />
broken_sasl_auth_clients = yes<br />
smtpd_sasl_type = dovecot<br />
smtpd_sasl_path = private/auth<br />
smtpd_sasl_security_options = noanonymous<br />
smtpd_recipient_restrictions =<br />
permit_mynetworks,<br />
permit_sasl_authenticated,<br />
reject_unauth_destination</p>
<p>#TLS<br />
smtpd_tls_key_file = /etc/pki/postfix/private/postkey.key<br />
smtpd_tls_cert_file = /etc/pki/postfix/certs/post_signed_cert.pem<br />
smtpd_tls_loglevel = 1<br />
smtpd_tls_session_cache_timeout = 3600s<br />
smtpd_tls_session_cache_database = btree:/var/spool/postfix/smtpd_tls_cache<br />
tls_random_source = dev:/dev/urandom<br />
smtpd_tls_auth_only = yes<br />
smtpd_tls_security_level = may</p>
<p>#HELO Restrictions<br />
smtpd_delay_reject = yes<br />
smtpd_helo_required = yes<br />
smtpd_helo_restrictions =<br />
permit_mynetworks,<br />
reject_non_fqdn_helo_hostname,<br />
reject_invalid_helo_hostname,<br />
permit</code></em></strong><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>Next uncomment the submission line in the master.cf file.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
<strong><em><code>smtp inet n - n - - smtpd<br />
submission inet n - n - - smtpd</strong></em></code><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>We now need to tie it into Dovecot. Go to the auth default section of the configuration file and add/edit the following lines.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
<strong><em><code>auth default {<br />
mechanisms = plain login<br />
passdb pam {<br />
}<br />
userdb passwd {<br />
}<br />
user = root<br />
socket listen {<br />
client {<br />
path = /var/spool/postfix/private/auth<br />
mode = 0660<br />
user = postfix<br />
group = postfix<br />
}<br />
}<br />
}</strong></code></em><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>Restart the Postfix and Dovecot services.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
<strong><em><code>service postfix restart<br />
service dovecot restart</strong></em></code><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>In order to test to make sure SSL/TLS is working we will need to telnet to the port and run a few commands.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
<strong><em><code>$ telnet localhost 25<br />
Connected to localhost.localdomain (127.0.0.1).<br />
Escape character is '^]'.<br />
220 smtp.example.com ESMTP Postfix<br />
ehlo smtp.example.com<br />
250-smtp.example.com<br />
250-PIPELINING<br />
250-SIZE 10240000<br />
250-VRFY<br />
250-ETRN<br />
250-STARTTLS<br />
250-ENHANCEDSTATUSCODES<br />
250-8BITMIME<br />
250 DSN</strong></em></code><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>What you are looking for is STARTTLS, this will tell you that SSL/TLS is activated. To make sure that the certificates are working correctly type: STARTTLS which should say 220 2.0.0 Ready to start TLS. If it says anything else then there is something wrong and you will need to go back and fix it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jasonbrown.us/2009/11/postfix-and-ssl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Postfix and ClamAV with RHEL/CentOS</title>
		<link>http://www.jasonbrown.us/2009/11/postfix-and-clamav-with-rhelcentos/</link>
		<comments>http://www.jasonbrown.us/2009/11/postfix-and-clamav-with-rhelcentos/#comments</comments>
		<pubDate>Mon, 02 Nov 2009 13:58:12 +0000</pubDate>
		<dc:creator>jason</dc:creator>
				<category><![CDATA[Postfix]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.jasonbrown.us/?p=23</guid>
		<description><![CDATA[Postfix Install To create a functional SMTP server, first you need to install Postfix by running &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; yum install postfix &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; Check to make sure that your hostname also has your fully qualified domain name. &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; echo $HOSTNAME &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; If it does not have your domain, then you must add it to the configuration file. ]]></description>
			<content:encoded><![CDATA[<p><strong>Postfix Install</strong><br />
To create a functional SMTP server, first you need to install Postfix by running<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
<strong><em><code>yum install postfix</strong></em></code><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>Check to make sure that your hostname also has your fully qualified domain name.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
<em><strong><code>echo $HOSTNAME</strong></em></code><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
If it does not have your domain, then you must add it to the configuration file.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
<strong><em><code>myhostname = smtp.example.com</strong></em></code><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>You must also make your SMTP server listen on an interface besides the localhost. Uncomment:<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
<em><code><strong>inter_interfaces = localhost</strong></code</em><br />
-----------------------------------------------------------</p>
<p>To:<br />
-----------------------------------------------------------<br />
<strong><code><em>inet_interfaces = all</strong></em></code><br />
-----------------------------------------------------------</p>
<p>Now edit the configuration to allow trusted networks to relay emails. In most situations uncommenting:<br />
-----------------------------------------------------------<br />
<strong><em><code>mynetworks_style = subnet</strong></em></code><br />
-----------------------------------------------------------<br />
should be sufficient, however if you are allowing a larger network or deal with multiple networks then manually add the networks that will be trusted.<br />
-----------------------------------------------------------<br />
<strong><em><code>mynetworks = 127.0.0.0/8, 192.168.1.0/24</code></em></strong><br />
-----------------------------------------------------------</p>
<p><strong>ClamAV</strong><br />
Download and install clamav, clamav-db, clamd, clamav-milter from http://packages.sw.be/clamav/</p>
<p>Edit the init scripts to allow Postfix to read the clamav-milter socket. Add the following lines in the start, stop, and restart case statements.<br />
-----------------------------------------------------------<br />
<strong><em><code>chmod 0775 /var/clamav/clmilter.socket<br />
chown clamav.postfix /var/clamav/clmilter.socket</code></em></strong><br />
-----------------------------------------------------------</p>
<p>If these settings are not set, Postfix will not be able to correctly communicate with the ClamAV milter and will receive a<br />
warning: connect to Milter service unix:/var/clama/clmilter.socket: Permission denied<br />
in the mail log</p>
<p>Now add:<br />
-----------------------------------------------------------<br />
<strong><em><code>smtpd_milters = unix:/var/clamav/clmilter.socket<br />
non_smtpd_milters = unix:/var/clamav/clmilter.socket</strong></em></code><br />
-----------------------------------------------------------<br />
to the bottom of main.cf and restart the Postfix service.</p>
<p>Now add freshclam to the cron to get automatic updates and everything should be all set.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jasonbrown.us/2009/11/postfix-and-clamav-with-rhelcentos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>USB encryption with Luks</title>
		<link>http://www.jasonbrown.us/2009/10/usb-encryption-with-luks/</link>
		<comments>http://www.jasonbrown.us/2009/10/usb-encryption-with-luks/#comments</comments>
		<pubDate>Fri, 30 Oct 2009 13:59:59 +0000</pubDate>
		<dc:creator>jason</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[encryption]]></category>

		<guid isPermaLink="false">http://www.jasonbrown.us/?p=25</guid>
		<description><![CDATA[Here is an easy way of encrypting USB thumb drives with Luks. Examples below assume your thumb drive is/dev/sdb First, check the device for bad blocks: ~]# badblocks -c 10240 -s -w -t random -v /dev/sdb Next create the partition on the drive itself. ~]# fdisk /dev/sdb Device contains neither a valid DOS partition table, ]]></description>
			<content:encoded><![CDATA[<p>Here is an easy way of encrypting USB thumb drives with Luks. Examples below assume your thumb drive is/dev/sdb</p>
<p>First, check the device for bad blocks:</p>
<p><strong><em><code>~]# badblocks -c 10240 -s -w -t random -v /dev/sdb</code></em></strong></p>
<p>Next create the partition on the drive itself.</p>
<p><strong><em><code>~]# fdisk /dev/sdb</p>
<p>Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel<br />
Building a new DOS disklabel with disk identifier 0x99faf680.<br />
Changes will remain in memory only, until you decide to write them.<br />
After that, of course, the previous content won't be recoverable.</p>
<p>Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)</p>
<p>Command (m for help): p</p>
<p>Disk /dev/sdb: 4066 MB, 4066377728 bytes<br />
126 heads, 62 sectors/track, 1016 cylinders<br />
Units = cylinders of 7812 * 512 = 3999744 bytes<br />
Disk identifier: 0x99faf680</p>
<p>Device Boot Start End Blocks Id System</p>
<p>Command (m for help): n<br />
Command action<br />
e extended<br />
p primary partition (1-4)<br />
p<br />
Partition number (1-4): 1<br />
First cylinder (1-1016, default 1):<br />
Using default value 1<br />
Last cylinder, +cylinders or +size{K,M,G} (1-1016, default 1016):<br />
Using default value 1016</p>
<p>Command (m for help): p</p>
<p>Disk /dev/sdb: 4066 MB, 4066377728 bytes</p>
<p>126 heads, 62 sectors/track, 1016 cylinders<br />
Units = cylinders of 7812 * 512 = 3999744 bytes<br />
Disk identifier: 0x99faf680</p>
<p>Device Boot Start End Blocks Id System<br />
/dev/sdb1 1 1016 3968465 83 Linux</p>
<p>Command (m for help): w<br />
The partition table has been altered!</p>
<p>Calling ioctl() to re-read partition table.<br />
Syncing disks.</code></em></strong></p>
<p>Now create the password and encrypt the device. This will encrypt the device with AES256.<br />
<strong><em><code>~]# cryptsetup luksFormat -v -y -s 256 -c aes /dev/sdb1<br />
WARNING!<br />
========<br />
This will overwrite data on /dev/sdb1 irrevocably.</p>
<p>Are you sure? (Type uppercase yes): YES<br />
Enter LUKS passphrase:<br />
Verify passphrase:<br />
Command successful.</code></em></strong></p>
<p>To open the encrypted drive type:</p>
<p><strong><em><code>cryptsetup luksOpen /dev/sdb1 usbdrive</code></em></strong></p>
<p>It will then prompt for the password.</p>
<p><font color="red">***WARNING*** Do not lose your password, there is no way to recover it!</font></p>
<p>Now format the drive. This example shows how to format the drive with ext4 however ext3 will also work if you are running an older distro.</p>
<p><strong><em><code>~] # mkfs.ext4 /dev/mapper/usbdrive<br />
mke2fs 1.41.4 (27-Jan-2009)<br />
Filesystem label=<br />
OS type: Linux<br />
Block size=4096 (log=2)<br />
Fragment size=4096 (log=2)<br />
248000 inodes, 991859 blocks<br />
49592 blocks (5.00%) reserved for the super user<br />
First data block=0<br />
Maximum filesystem blocks=1019215872</p>
<p>31 block groups<br />
32768 blocks per group, 32768 fragments per group<br />
8000 inodes per group<br />
Superblock backups stored on blocks:<br />
32768, 98304, 163840, 229376, 294912, 819200, 884736</p>
<p>Writing inode tables: done<br />
Creating journal (16384 blocks): done<br />
Writing superblocks and filesystem accounting information: done</p>
<p>This filesystem will be automatically checked every 31 mounts or<br />
180 days, whichever comes first. Use tune2fs -c or -i to override.</code></em></strong></p>
<p>Mount the drive:</p>
<p><strong><em><code>~]# mount /dev/mapper/usbdrive /media/thumbdrive/</code></em></strong></p>
<p>Now your drive is encrypted <img src='http://www.jasonbrown.us/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>Gnome should automatically ask the next time you insert your usb drive for the password. However if you are using the cli, here are the steps to mount/unmount the drive.</p>
<p>Mount the device</p>
<p><strong><em><code>~]# cryptsetup luksOpen /dev/sdb1 usbdrive<br />
~]# mount /dev/mapper/usbdrive /media/usbdrive</code></em></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jasonbrown.us/2009/10/usb-encryption-with-luks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GPG Keys</title>
		<link>http://www.jasonbrown.us/2009/10/gpg-keys/</link>
		<comments>http://www.jasonbrown.us/2009/10/gpg-keys/#comments</comments>
		<pubDate>Tue, 20 Oct 2009 14:02:05 +0000</pubDate>
		<dc:creator>jason</dc:creator>
				<category><![CDATA[GPG]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.jasonbrown.us/?p=27</guid>
		<description><![CDATA[GnuPG is used to encrypt and sign email messages and files. First you need to create the GPG key: Generating Keys &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; $ gpg --gen-key &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; Select option 5 for RSA and then type the encryption level. &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; Please select what kind of key you want: (1) DSA and Elgamal (default) (2) DSA (sign only) ]]></description>
			<content:encoded><![CDATA[<p>GnuPG is used to encrypt and sign email messages and files. First you need to create the GPG key:</p>
<p>Generating Keys<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
<strong><em><code>$ gpg --gen-key</code></em></strong><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>Select option 5 for RSA and then type the encryption level.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
<strong><em><code>Please select what kind of key you want:<br />
(1) DSA and Elgamal (default)<br />
(2) DSA (sign only)<br />
(5) RSA (sign only)<br />
Your selection? 5<br />
RSA keys may be between 1024 and 4096 bits long.<br />
What keysize do you want? (2048) 4096<br />
Requested keysize is 4096 bits<br />
Please specify how long the key should be valid.<br />
0 = key does not expire<br />
= key expires in n days<br />
w = key expires in n weeks<br />
m = key expires in n months<br />
y = key expires in n years<br />
Key is valid for? (0)<br />
Key does not expire at all<br />
Is this correct? (y/N) y</code></em></strong><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>Now enter your personal information<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
<strong><em><code>Real name: Jason Brown<br />
Email address: jasonbrown@example.com<br />
Comment: Example<br />
You selected this USER-ID:<br />
"Jason Brown (Example) "</p>
<p>Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? o<br />
You need a Passphrase to protect your secret key.</p>
<p>We need to generate a lot of random bytes. It is a good idea to perform<br />
some other action (type on the keyboard, move the mouse, utilize the<br />
disks) during the prime generation; this gives the random number<br />
generator a better chance to gain enough entropy.<br />
............................+++++<br />
...........+++++<br />
gpg: key 7C11053D marked as ultimately trusted<br />
public and secret key created and signed.</p>
<p>gpg: checking the trustdb<br />
gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model<br />
gpg: depth: 0 valid: 4 signed: 0 trust: 0-, 0q, 0n, 0m, 0f, 4u<br />
pub 4096R/7C11053D 2009-10-12<br />
Key fingerprint = EE6B C53F A665 593C 3607 FEE1 F984 2AF9 7C11 053D<br />
uid Jason Brown (Example)</code></em></strong><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>As stated in the option menu, this key is only generated to sign email or files and cannot be used to encrypt. You now have to edit the key that was just generated to use it for encryption.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
<strong><em><code>$ gpg --edit-key jasonbrown@exmaple.com</p>
<p>pub 4096R/7C11053D created: 2009-10-12 expires: never usage: SC<br />
trust: ultimate validity: ultimate<br />
[ultimate] (1). Jason Brown (Example)</p>
<p>Command> addkey<br />
You need a passphrase to unlock the secret key for<br />
user: "Jason Brown (Example) "<br />
4096-bit RSA key, ID 7C11053D, created 2009-10-12</code></strong></em><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>Enter in your passphrase and then select option 6 for &#8216;RSA (encrypt only)&#8217;. It will then ask for a key size and key expiration, use the same settings as in the first section. Once complete you will have a new key for encryption.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
<strong><em><code>pub 4096R/7C11053D created: 2009-10-12 expires: never usage: SC<br />
trust: ultimate validity: ultimate<br />
sub 4096R/55D59203 created: 2009-10-12 expires: never usage: E<br />
[ultimate] (1). Jason Brown (Example)</code></em></strong><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>Now type save to exit:<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
<code><em><strong>Command> save</code></em></strong><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>Your new key is now ready to be uploaded to the key repository servers.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
<strong><em><code>$ gpg --keyserver pgp.mit.edu --send-key jasonbrown@example.com</code></em></strong><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>GPG Key Backup<br />
Once your keys have been generated, you will need to export both the public and private keys and store them for safe keeping. To export your public key:<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
<strong><em><code>$ gpg --export -a jasonbrown@example.com > example-pub.key</code></em></strong><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>And the private key:<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
<strong><em><code>$ gpg --export-secret-key -a jasonbrown@example.com > example-priv.key</code></em></strong><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>You can then create a tar backup of these two keys and encrypt them with a passphrase.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
<strong><em><code>$ tar -cvf gpgkeys.tar example-priv.key example-pub.key<br />
$ gpg -c --cipher-algo aes256 gpgkeys.tar</code></em></strong><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>Then enter in a strong password. This will allow you to retrieve your keys if you do not have your public/private key pair installed on a machine. Once this is done you will need to securely delete your keys leaving just the tarball. This is important as someone can compromise your keys.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
<strong><em><code>$ for i in gpgkeys.tar example-priv.key example-pub.key<br />
>do<br />
>shred -n 100 -z -u -v $i<br />
>done</code></em></strong><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>Retrieving Public Keys<br />
To search for a persons key type:</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
<strong><em><code>$ gpg --search-keys jasonbrown@example.com</code></em></strong><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
As this is an example and a fake email address, this will not return any results. Had this been a real address you will see a list of email addresses with numbers along the side. To request the public key of that person, type the number and hit &#8216;enter&#8217; and it will retreive the public.</p>
<p>Encrypting Files to Other Users<br />
To encrypt a file to a different user you must first have that users public key. To check type:<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
<strong><em><code>$ gpg --list-keys</p>
<p>pub 4096R/7C11053D 2009-10-12<br />
uid Jason Brown (Example)<br />
sub 4096R/55D59203 2009-10-12</code></em></strong><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>I will encrypt a file to myself. The &#8216;-e&#8217; option is to tell it to encrypt and the &#8216;-r&#8217; is the recipient or public key of the person you want to give the file to.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
<strong><em><code>$ gpg -e -r jasonbrown@example.com ssn.txt</strong></em></code><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>To decrypt the file, the receipient must have their public key installed on the machine. Then type:<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
<strong><em><code>$ gpg --output ssn.txt --decrypt ssn.txt.gpg</code></em></strong><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
Where &#8216;&#8211;output&#8217; is the name of the decrypted file and &#8216;&#8211;decrypt&#8217; is the file being decrypted.</p>
<p>You may also want to digitally sign the file you are encrypting, to do so type:<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
<strong><em><code>$ gpg --detach-sig ssn.txt.gpg</code></em></strong><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>And to verify the signature file:<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
<strong><em><code>$ gpg --verify ssn.txt.gpg</p>
<p>gpg: Signature made Mon 12 Oct 2009 02:21:26 PM EDT using DSA key ID 7C11053D<br />
gpg: Good signature from "Jason Brown (Example) "</code></em></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jasonbrown.us/2009/10/gpg-keys/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
