<?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>linuxsecurityblog.com</title>
	<atom:link href="http://linuxsecurityblog.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://linuxsecurityblog.com</link>
	<description>Linux Security</description>
	<lastBuildDate>Thu, 10 May 2012 09:26:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Have an ecommerce store? You&#8217;re going to need PCI Compliant Hosting</title>
		<link>http://linuxsecurityblog.com/2012/05/have-an-ecommerce-store-youre-going-to-need-pci-compliant-hosting/</link>
		<comments>http://linuxsecurityblog.com/2012/05/have-an-ecommerce-store-youre-going-to-need-pci-compliant-hosting/#comments</comments>
		<pubDate>Thu, 10 May 2012 09:26:46 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://linuxsecurityblog.com/?p=97</guid>
		<description><![CDATA[Have an ecommerce store? You&#8217;re going to need PCI Compliant Hosting The credit card companies have joined forces to create a set of standards that companies must adhere to if they are going to accept credit cards online. If you&#8217;re selling products or services online, you&#8217;re going to need to be hosting at place that [...]]]></description>
			<content:encoded><![CDATA[<p>Have an ecommerce store? You&#8217;re going to need <a href="https://www.pcicomplianthosting.com/pci-certified-hosting.php">PCI Compliant Hosting</a> The credit card companies have joined forces to create a set of standards that companies must adhere to if they are going to accept credit cards online.</p>
<p>If you&#8217;re selling products or services online, you&#8217;re going to need to be hosting at place that is in PCI compliance.  Failure to so we may result in extra fees from your merchant provider, and/or fines if there were to be a data breach.</p>
<p>Companies like PCICompliantHosting.com will give you a free PCI consultation and give you information on what plan you&#8217;re going to need.  There are a few different options depending on how much business you do, and if you store the credit card numbers or not.</p>
<p>PCICompliantHosting.com is recommend due to their uptime and support as well as their strong stance on security.</p>
]]></content:encoded>
			<wfw:commentRss>http://linuxsecurityblog.com/2012/05/have-an-ecommerce-store-youre-going-to-need-pci-compliant-hosting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PBX running on a Internet routable IP, and not up to date? It could be vulnerable.</title>
		<link>http://linuxsecurityblog.com/2012/02/freepbx-vulnerable/</link>
		<comments>http://linuxsecurityblog.com/2012/02/freepbx-vulnerable/#comments</comments>
		<pubDate>Wed, 15 Feb 2012 03:35:13 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://linuxsecurityblog.com/?p=85</guid>
		<description><![CDATA[If you have an asterisk PBX phone server running on an Internet routable IP, using the freePBX web GUI, and don&#8217;t have one of the latest releases it may be vulnerable. Its very common to have freePBX on a public IP, usually if you have multiple locations using the same freePBX server. Almost no exists [...]]]></description>
			<content:encoded><![CDATA[<p>If you have an asterisk PBX phone server running on an Internet routable IP, using the freePBX web GUI, and don&#8217;t have one of the latest releases it may be vulnerable.</p>
<p>Its very common to have freePBX on a public IP, usually if you have multiple locations using the same freePBX server.</p>
<p>Almost no exists information about this vulnerability, and as of right now its not listed on CVE details:</p>
<p><a href="http://www.cvedetails.com/vendor/6470/Freepbx.html">http://www.cvedetails.com/vendor/6470/Freepbx.html</a></p>
<p>To test, visit this URL in your browser:</p>
<p><a href="http://yourip/admin/modules/framework/bin/gen_amp_conf.php">http://yourip/admin/modules/framework/bin/gen_amp_conf.php</a></p>
<p>Switch yourip with your  IP, and admin with your admin directory.</p>
<p>A 404 means you are protected, if you get a nothing, view source, or download a copy of that page with wget or curl to ensure its blank.</p>
<p>If there is a bunch of code, or entries, then you have a version that is vulnerable.  If you look for ARI_ADMIN_USERNAME and ARI_ADMIN_PASSWORD that should match the initial login you had for the management interface.</p>
<p>This will allow anyone to log in, then they can do anything they want, ex view your sip extensions, view the password in plain text, and then connect to your phone server and run up your phone bill.</p>
<p>Typically a hacker will enable long distance or out of the country calling and or 900/976 numbers, even if you had them blocked in your outbound routes, allowing them to possibly make your responsible for thousands of dollars in phone calls.</p>
<p>How to block this you wonder?  Read below.</p>
<p>#1 Upgrade freePBX to the latest version, and the easiest way to do that is by following the instructions here:</p>
<p><a href="http://www.freepbx.org/forum/freepbx-distro/distro-discussion-help/release-versions">http://www.freepbx.org/forum/freepbx-distro/distro-discussion-help/release-versions</a></p>
<p>Then harden your server</p>
<p>#2 limit access to your phone server to only what IPs absolutely need to access it, if you have phones on dynamic IPs, such as typical DHCP off of an ISP cable or DSL modem, this may not be practical and you may want to allow a block of IPs, or limit it by country.</p>
<p>Most hackers are out of the country, so this will keep a lot of them from finding your server in the first place, now it is possible for them to use a proxy, but a lot of times they won&#8217;t take that extra step.</p>
<p>You can restrict IPs with IP tables for Linux, it helps if you use a Firewall manager such as the APF firewall available here:</p>
<p><a href="http://www.rfxn.com/projects/advanced-policy-firewall/">http://www.rfxn.com/projects/advanced-policy-firewall/</a></p>
<p>#3 You can also restrict access to the admin interface to a a single or few IPs by editing httpd.conf</p>
<p>Look for the code below you will want to add an  allow line(s) for the IP(s) you want to access the web interface from:</p>
<p>&lt;Directory &#8220;/var/www/html&#8221;&gt;</p>
<p>&#8230;</p>
<p>Options Indexes FollowSymLinks</p>
<p>&#8230;</p>
<p>AllowOverride None</p>
<p>#<br />
# Controls who can get stuff from this server.<br />
#<br />
Order deny,allow<br />
allow from 12.34.56.78<br />
deny from all</p>
<p>&lt;/Directory&gt;</p>
<p>#4 Shut off apache, the web interface isn&#8217;t needed to make or receive phone calls, so you can leave it off and only turn it on when you need to work in it:</p>
<p>service httpd off</p>
<p>#5 Switch the httpd port, a port scanner will get around this, but this makes them go through yet one more step.  You would do that with this line in httpd.conf</p>
<p>Listen 801</p>
<p>Then restart apache.</p>
<p>#6 Test everything to verify you can access the server/web interface and other IPs can&#8217;t</p>
<p>#7 Keep an eye on your box, look at the asterisk log to see what extensions, and what IPs are registering:</p>
<p>cat /var/log/asterisk/full |grep Reg</p>
<p>View your call logs, make sure there aren&#8217;t any unusually high number of calls, and if you have international or 900/976 numbers enabled  by your provider look at the logs extra carefully for those.</p>
<p>Hope this helps you keep your FreePBX system safe and secure!</p>
]]></content:encoded>
			<wfw:commentRss>http://linuxsecurityblog.com/2012/02/freepbx-vulnerable/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>rkhunter&#8230;uh, I just want to know if I have a rootkit</title>
		<link>http://linuxsecurityblog.com/2009/12/rkhunter-uh-i-just-want-to-know-if-i-have-a-rootkit/</link>
		<comments>http://linuxsecurityblog.com/2009/12/rkhunter-uh-i-just-want-to-know-if-i-have-a-rootkit/#comments</comments>
		<pubDate>Fri, 04 Dec 2009 06:14:56 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://linuxsecurityblog.com/?p=67</guid>
		<description><![CDATA[Think there is a too much output with rkhunter? Including false positives on the binaries? If so this script should help. (For the binaries, its good to check at least the md5 sum with something like AIDE). ?View Code SHELL1 2 3 4 5 6 7 8 9 10 11 12 #!/bin/bash echo System checks [...]]]></description>
			<content:encoded><![CDATA[<p>Think there is a too much output with rkhunter?  Including false positives on the binaries?  If so this script should help.</p>
<p>(For the binaries, its good to check at least the md5 sum with something like AIDE).</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p67code2'); return false;">View Code</a> SHELL</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p672"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code" id="p67code2"><pre class="shell" style="font-family:monospace;">#!/bin/bash
echo System checks summary &gt;/home/user/rootkith.log
echo ===================== &gt;&gt;/home/user/rootkith.log
echo File properties checks... &gt;&gt;/home/user/rootkith.log
cat /var/log/rkhunter.log |grep Files\ checked &gt;&gt;/home/user/rootkith.log
cat /var/log/rkhunter.log |grep Suspect\ files &gt;&gt;/home/user/rootkith.log
echo Rootkit checks... &gt;&gt;/home/user/rootkith.log
cat /var/log/rkhunter.log |grep Rootkits\ checked &gt;&gt;/home/user/rootkith.log
cat /var/log/rkhunter.log |grep Possible\ rootkits &gt;&gt;/home/user/rootkith.log
echo Applications checks... &gt;&gt;/home/user/rootkith.log
cat /var/log/rkhunter.log |grep Applications\ checked |grep -v Info &gt;&gt;/home/user/rootkith.log
cat /var/log/rkhunter.log |grep Suspect\ applications &gt;&gt;/home/user/rootkith.log</pre></td></tr></table></div>

<p>Then you setup a cronjob to cat rootkith.log and mail you the output of it daily.</p>
]]></content:encoded>
			<wfw:commentRss>http://linuxsecurityblog.com/2009/12/rkhunter-uh-i-just-want-to-know-if-i-have-a-rootkit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>netcat (nc) howto</title>
		<link>http://linuxsecurityblog.com/2009/11/netcat-nc-howto/</link>
		<comments>http://linuxsecurityblog.com/2009/11/netcat-nc-howto/#comments</comments>
		<pubDate>Mon, 30 Nov 2009 01:26:10 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://linuxsecurityblog.com/?p=75</guid>
		<description><![CDATA[Here&#8217;s a command that can be helpful. nc or netcat, what nc does is always you to write across the network. For an example we will take #2 from my last post on how to handle a hacked hard drive: #2. List the current open files, lsof, current processes, ps aux, current open ports netstat [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a command that can be helpful.</p>
<p>nc or netcat, what nc does is always you to write across the network.</p>
<p>For an example we will take #2 from my last post on how to handle a hacked hard drive:</p>
<blockquote><p>#2. List the current open files, lsof, current processes, ps aux, current open ports netstat -anpe</p></blockquote>
<p>Since you don&#8217;t want to write anything to the hacked drive, and you really want to get this output as fast as possible,   so an easy way to do that is to use netcat.  Ahead of the server getting hacked you will want to pick a port you will use for netcat, and open that for egress traffic on any server you might need to send out on, and ingress on one server you choose to be the netcat host to receive the data.  In this example we will use port 9999</p>
<p>First we need to start up netcat to listen for date, on the host run:</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p75code5'); return false;">View Code</a> SHELL</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p755"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p75code5"><pre class="shell" style="font-family:monospace;">nc -l -n 9999 2&amp;gt;&amp;amp;1 | tee /dev/shm/netcat.tee</pre></td></tr></table></div>

<p>Then on the hacked server you want to send from run:</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p75code6'); return false;">View Code</a> SHELL</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p756"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p75code6"><pre class="shell" style="font-family:monospace;">(lsof ; ps aux; netstat -anpe ) | nc ip_of_netcat_host 9999</pre></td></tr></table></div>

<p>Then you can less /dev/shm/netcat.tee and inspect the output from the hacked server.</p>
]]></content:encoded>
			<wfw:commentRss>http://linuxsecurityblog.com/2009/11/netcat-nc-howto/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>You&#8217;ve been hacked, reinstall the OS ASAP&#8230;..DO WHAT???</title>
		<link>http://linuxsecurityblog.com/2009/11/youve-been-hacked-reinstall-the-os-asap-do-what/</link>
		<comments>http://linuxsecurityblog.com/2009/11/youve-been-hacked-reinstall-the-os-asap-do-what/#comments</comments>
		<pubDate>Tue, 24 Nov 2009 22:06:29 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://linuxsecurityblog.com/?p=65</guid>
		<description><![CDATA[One common misconception is when you get hacked you should reinstall the OS. While its true you shouldn&#8217;t continue to run the OS, you definitely don&#8217;t want to immediately reinstall, and certainly not on that same drive. Here is a quite write up I did for someone who said they got hacked on a forum, [...]]]></description>
			<content:encoded><![CDATA[<p>One common misconception is when you get hacked you should reinstall the OS.</p>
<p>While its true you shouldn&#8217;t continue to run the OS, you definitely don&#8217;t want to immediately reinstall, and certainly not on that same drive.</p>
<p>Here is a quite write up I did for someone who said they got hacked on a forum, this isn&#8217;t the best case for every scenario, but is a lot better then what several people told him &#8220;reinstall the os&#8221;</p>
<p>#1. Do not install, reinstall or delete anything from that drive</p>
<p>#2. List the current open files, lsof, current processes, ps aux, current open ports netstat -anpe</p>
<p>#3. Pull the power cord out from the box (if possible or have the data center do it)</p>
<p>#4. Notify all your users that there has been a compromise, notify your provider if necessary.</p>
<p>#5. Make a forensic image of the drive (or have the data center do it) using the unix dd command, set the original drive in a safe place and ensure you maintain a chain of custody on it.</p>
<p>#6. Go through the logs you have from Chkrootkit / Rootkit Hunter / Aide / Samhain / Snort / Integrit / Osiris or tripwire, if the logs are on the drive itself look at them on the image your made.</p>
<p>#7. Review the image of the compromised drive, was the OS/kernel current? Were all the packages up to date? What was in the world writeable directories like /tmp, /var/tmp, /dev/shm, what services were running on the drive, what was the version of php, perl, etc.</p>
<p>#8. Look at the logs files and logrotated files such as wtmp, secure, messages, firewall logs setuid files, user shell histories, yum logs.</p>
<p>#9. Document any hints, hunches, or gut feeling you have on the the box was hacked.</p>
<p>#10. Only after your investigation and developing a plan to keep the box more secure should you install the OS on the new drive (the compromised drive should still be in a safe place) and only the user home data should be restore, and chowned to the user&#8217;s username, prior to the server being live on the internet again.</p>
<p>#11. Contact other parties, such as law enforcement if appropriate.</p>
]]></content:encoded>
			<wfw:commentRss>http://linuxsecurityblog.com/2009/11/youve-been-hacked-reinstall-the-os-asap-do-what/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Backup Server Woes</title>
		<link>http://linuxsecurityblog.com/2009/11/backup-server-woes/</link>
		<comments>http://linuxsecurityblog.com/2009/11/backup-server-woes/#comments</comments>
		<pubDate>Sun, 22 Nov 2009 05:58:56 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://linuxsecurityblog.com/?p=63</guid>
		<description><![CDATA[Here is a post on backups, which are a big part of security even though they don&#8217;t make the servers or network more &#8220;secure&#8221;. Well, I bought 12 1.5TB drives (2 sets of 6) for my master backup server, however I&#8217;ve had a hell of a time getting it to work. I tried both sets [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a post on backups, which are a big part of security even though they don&#8217;t make the servers or network more &#8220;secure&#8221;.</p>
<p>Well, I bought 12 1.5TB drives (2 sets of 6) for my master backup server, however I&#8217;ve had a hell of a time getting it to work.</p>
<p>I tried both sets of the drives, 1-3 drives at time, accepting/reject the current configuration but with no luck.</p>
<p>The raid card does not pick up the drives, it does under the drive utilities section, but not under initialize drives or create array.</p>
<p>I even tried initializing the drives on another raid card and the bringing them back over, no luck.</p>
<p>Tried a new raid card, no luck.</p>
<p>I believe the problem is the raid card does not support 1.5TB drives and the limit is 1TB, which are the size of the old drives that were in there.</p>
<p>I hope I&#8217;m right because a new raid card is $580.</p>
<p>While I have this server unracked, I put an extra 2GB of ram in.  rsync uses quite a bit of ram as it stores the file list in memory.</p>
<p>The raid card should be here Wednesday, and I&#8217;ll let you know if that worked.</p>
<p>TTYL,<br />
DW</p>
]]></content:encoded>
			<wfw:commentRss>http://linuxsecurityblog.com/2009/11/backup-server-woes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Secure Encrypted FormMail</title>
		<link>http://linuxsecurityblog.com/2009/11/secure-encrypted-formmail/</link>
		<comments>http://linuxsecurityblog.com/2009/11/secure-encrypted-formmail/#comments</comments>
		<pubDate>Wed, 11 Nov 2009 16:11:47 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://linuxsecurityblog.com/?p=50</guid>
		<description><![CDATA[Secure Encrypted FormMail, PHP and GPG based. We are all familiar with the original FormMail script created back in 1995, but are you familiar with a secure formmail script? And by secure I mean one that encrypts the data. I sure wasn&#8217;t so one night while I was up late, waiting for my scheduled maintenance [...]]]></description>
			<content:encoded><![CDATA[<p>Secure Encrypted FormMail, PHP and GPG based.</p>
<p>We are all familiar with the original FormMail script created back in 1995, but are you familiar with a secure formmail script?</p>
<p>And by secure I mean one that encrypts the data.</p>
<p>I sure wasn&#8217;t so one night while I was up late, waiting for my scheduled maintenance window to come around, I typed one up.</p>
<p>On common misconception that I see a lot of people do is put an https URL for their formmail action tag, and then think the form is secure.</p>
<p>Well, that doesn&#8217;t help a whole lot, it would secure the data back to the server, but then emailing it to you would not necessarily be secure, especially if your mail server is different than your web server, plus there will be a period of time where the form results are in plain text on the server.</p>
<p>What you need is not only a formmail that will use https, but that will also encrypt the data with GPG.</p>
<p>That said I bring you Secure Formmail:</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p50code9'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p509"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
</pre></td><td class="code" id="p50code9"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>                                         
<span style="color: #666666; font-style: italic;">//Doug Walker's Secure Formmail Copyright 2009 FreeGPG.org</span>
<span style="color: #666666; font-style: italic;">//This script is provided with absolutely no guarantee or warrrenty</span>
<span style="color: #666666; font-style: italic;">//This script is not assumed to be bug free or error free          </span>
<span style="color: #666666; font-style: italic;">//Secure Formmail may not be 100% secure, and may not be secure enough or appropriate for your specific use</span>
<span style="color: #666666; font-style: italic;">//We are not responsible for misencrypted or unencryptable messages or damages caused by use of this script</span>
<span style="color: #666666; font-style: italic;">//You agree to limit any loss from the use of this script to $5, which you agree is a fair amount since the script is free</span>
<span style="color: #666666; font-style: italic;">//This script was developed using GnuPG v1.4.5                                                                            </span>
<span style="color: #666666; font-style: italic;">//This script is meant to be used in conjunction with SSL (https://)                                                      </span>
&nbsp;
<span style="color: #666666; font-style: italic;">//***** YOU MUST SET $referrers $recipients AND ENTER YOUR PUBLIC KEY*****</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Set valid referring URLs, seperate multiple approved referrers with a , no spaces</span>
<span style="color: #000088;">$referrers</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;domain.com,www.domain.com&quot;</span><span style="color: #339933;">;</span>                              
&nbsp;
<span style="color: #666666; font-style: italic;">//Set valid recipient domains</span>
<span style="color: #000088;">$recipients</span><span style="color: #339933;">=</span><span style="color: #000088;">$referrers</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;emaildomain.com,us.emaildomain.com&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//include your publickey, by default it is in publickey.txt in the same directory as this script</span>
<span style="color: #666666; font-style: italic;">//include the Begin and End lines and no extra spaces                                           </span>
<span style="color: #666666; font-style: italic;">//You can get a public key from freegpg.org but are not required to use that public key         </span>
<span style="color: #666666; font-style: italic;">//***Paste the your key starting with the BEGIN line right below &lt;&lt;&lt;EOI                         </span>
<span style="color: #666666; font-style: italic;">//***and with your END line right above EOI;                                                    </span>
<span style="color: #000088;">$publickey</span><span style="color: #339933;">=</span><span style="color: #0000cc; font-style: italic;">&lt;&lt;&lt;EOI                                                                               
-----BEGIN PGP PUBLIC KEY BLOCK-----                                                            
Version: GnuPG v1.4.5 (GNU/Linux)                                                               
&nbsp;
qwerwqerwer
YOUR PUBLIC KEY HERE
qwerqwerwq                                                      
-----END PGP PUBLIC KEY BLOCK-----                              
EOI</span><span style="color: #339933;">;</span>                                                            
&nbsp;
<span style="color: #666666; font-style: italic;">// Escape the key and message for added security</span>
<span style="color: #000088;">$publickey</span><span style="color: #339933;">=</span><a href="http://www.php.net/escapeshellarg"><span style="color: #990000;">escapeshellarg</span></a><span style="color: #009900;">&#40;</span><a href="http://www.php.net/trim"><span style="color: #990000;">trim</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$publickey</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>    
&nbsp;
<span style="color: #666666; font-style: italic;">//Declare variables</span>
<span style="color: #000088;">$secure</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//Set secure mode 0 = off 1 = on</span>
<a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'GPG'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'/usr/bin/gpg'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  <span style="color: #666666; font-style: italic;">// The gpg binary</span>
<a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'HOME'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'/tmp'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>         <span style="color: #666666; font-style: italic;">// .gnupg will be created here</span>
<a href="http://www.php.net/putenv"><span style="color: #990000;">putenv</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'HOME='</span> <span style="color: #339933;">.</span> HOME<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//Set the home environment            </span>
<span style="color: #000088;">$to_max_len</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">200</span><span style="color: #339933;">;</span>                                              
<span style="color: #000088;">$ref</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/getenv"><span style="color: #990000;">getenv</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;HTTP_REFERER&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>                                
<span style="color: #000088;">$timestamp</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/date"><span style="color: #990000;">date</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;m/d/y  H:i:s&quot;</span><span style="color: #339933;">,</span> <a href="http://www.php.net/time"><span style="color: #990000;">time</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>                    
<span style="color: #000088;">$ip</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$REMOTE_ADDR</span><span style="color: #339933;">;</span>                                           
<span style="color: #000088;">$msg</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>                                                      
<span style="color: #666666; font-style: italic;">//set referrer                                                </span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'HTTP_HOST'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">!=</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span>                                 
  <span style="color: #000088;">$referrer</span><span style="color: #339933;">=</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'HTTP_HOST'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>                            
<span style="color: #b1b100;">else</span>                                                          
  <span style="color: #000088;">$referrer</span><span style="color: #339933;">=</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'HTTPS_HOST'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>                           
<span style="color: #666666; font-style: italic;">//end set referrer                                            </span>
<span style="color: #000088;">$recipient</span><span style="color: #339933;">=</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'recipient'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>                               
&nbsp;
<span style="color: #666666; font-style: italic;">//Begin the message with the referring URL, date/time stamp, and remote IP</span>
<span style="color: #000088;">$msg</span><span style="color: #339933;">.=</span><span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$ref</span><span style="color: #000099; font-weight: bold;">\n</span><span style="color: #006699; font-weight: bold;">$timestamp</span><span style="color: #000099; font-weight: bold;">\n</span><span style="color: #006699; font-weight: bold;">$ip</span><span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>                                        
<span style="color: #666666; font-style: italic;">//$msg.=&quot;$ref&lt;br&gt;$timestamp&lt;br&gt;$ip&lt;br&gt;&lt;br&gt;&quot;;                              </span>
&nbsp;
<span style="color: #666666; font-style: italic;">//validate referring URL</span>
<span style="color: #666666; font-style: italic;">//initialize switch     </span>
<span style="color: #000088;">$sw</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>                  
<span style="color: #000088;">$ref_array</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/explode"><span style="color: #990000;">explode</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;,&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$referrers</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$ref_array</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$ref_ele</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>     
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ref_ele</span><span style="color: #339933;">==</span><span style="color: #000088;">$referrer</span><span style="color: #009900;">&#41;</span>             
    <span style="color: #000088;">$sw</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>                            
<span style="color: #009900;">&#125;</span>                                     
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$sw</span><span style="color: #009900;">&#41;</span>                              
  <a href="http://www.php.net/die"><span style="color: #990000;">die</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Error: Invalid referring domain&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">//check reciepient is set</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$recipient</span><span style="color: #339933;">==</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span>       
  <a href="http://www.php.net/die"><span style="color: #990000;">die</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Error: No recipient set&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//check recipient length</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/strlen"><span style="color: #990000;">strlen</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$recipient</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">200</span><span style="color: #009900;">&#41;</span>
  <a href="http://www.php.net/die"><span style="color: #990000;">die</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Error: Recipient length too long&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//validate recipient</span>
<span style="color: #666666; font-style: italic;">//get domain portion of recipient</span>
<span style="color: #000088;">$recip_email_arr</span><span style="color: #339933;">=</span><a href="http://www.php.net/explode"><span style="color: #990000;">explode</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'@'</span><span style="color: #339933;">,</span><span style="color: #000088;">$recipient</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$recip_dom</span><span style="color: #339933;">=</span><span style="color: #000088;">$recip_email_arr</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>          
&nbsp;
<span style="color: #666666; font-style: italic;">//set from email</span>
<span style="color: #000088;">$from_email</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;webmaster@&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$recip_dom</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//initialize switch</span>
<span style="color: #000088;">$sw</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>             
<span style="color: #000088;">$rec_array</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/explode"><span style="color: #990000;">explode</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;,&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$recipients</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$rec_array</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$rec_ele</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>      
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$rec_ele</span><span style="color: #339933;">==</span><span style="color: #000088;">$recip_dom</span><span style="color: #009900;">&#41;</span>             
    <span style="color: #000088;">$sw</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>                             
<span style="color: #009900;">&#125;</span>                                      
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$sw</span><span style="color: #009900;">&#41;</span>                               
  <a href="http://www.php.net/die"><span style="color: #990000;">die</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Error: Invalid recipient domain&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">//The Guts</span>
<span style="color: #666666; font-style: italic;">//required field error switch</span>
<span style="color: #000088;">$err_sw</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>                   
<span style="color: #000088;">$err_msg</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;The following field(s) were left blank, please hit back and fill in:&lt;br&gt;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$field</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$formvar</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  <span style="color: #666666; font-style: italic;">//switch to add to the message or not</span>
  <span style="color: #000088;">$sw</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>                               
&nbsp;
  <span style="color: #666666; font-style: italic;">//Check if required field</span>
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$required</span><span style="color: #339933;">!=</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>       
    <span style="color: #666666; font-style: italic;">//build required field array</span>
    <span style="color: #000088;">$req_arr</span><span style="color: #339933;">=</span><a href="http://www.php.net/explode"><span style="color: #990000;">explode</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;,&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$required</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$req_arr</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$req_ele</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> 
      <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$req_ele</span><span style="color: #339933;">==</span><span style="color: #000088;">$field</span><span style="color: #009900;">&#41;</span>          
        <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$formvar</span><span style="color: #339933;">==</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>           
          <span style="color: #000088;">$err_sw</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>                
          <span style="color: #000088;">$err_msg</span><span style="color: #339933;">.=</span><span style="color: #0000ff;">&quot;* <span style="color: #006699; font-weight: bold;">$field</span>&lt;br&gt;&quot;</span><span style="color: #339933;">;</span> 
        <span style="color: #009900;">&#125;</span>                           
    <span style="color: #009900;">&#125;</span>                               
  <span style="color: #009900;">&#125;</span>                                 
&nbsp;
&nbsp;
  <span style="color: #666666; font-style: italic;">//Check for recipient</span>
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$field</span><span style="color: #339933;">==</span><span style="color: #0000ff;">&quot;recipient&quot;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #000088;">$sw</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>               
&nbsp;
  <span style="color: #666666; font-style: italic;">//Check for subject</span>
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$field</span><span style="color: #339933;">==</span><span style="color: #0000ff;">&quot;subject&quot;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #000088;">$sw</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>             
&nbsp;
  <span style="color: #666666; font-style: italic;">//Check for requied post var</span>
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$field</span><span style="color: #339933;">==</span><span style="color: #0000ff;">&quot;required&quot;</span><span style="color: #009900;">&#41;</span>      
    <span style="color: #000088;">$sw</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>                    
&nbsp;
&nbsp;
  <span style="color: #666666; font-style: italic;">//Check for redirect URL</span>
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$field</span><span style="color: #339933;">==</span><span style="color: #0000ff;">&quot;redirect&quot;</span><span style="color: #009900;">&#41;</span>  
    <span style="color: #000088;">$sw</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>                
&nbsp;
  <span style="color: #666666; font-style: italic;">//for testing only</span>
  <span style="color: #666666; font-style: italic;">#echo &quot;$field: $formvar&lt;br&gt;&quot;;
</span>
  <span style="color: #666666; font-style: italic;">//Build the message</span>
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sw</span><span style="color: #009900;">&#41;</span>
    <span style="color: #000088;">$msg</span><span style="color: #339933;">.=</span><span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$field</span>: <span style="color: #006699; font-weight: bold;">$formvar</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//display error message if required fields were left blank</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$err_sw</span><span style="color: #009900;">&#41;</span>
  <a href="http://www.php.net/die"><span style="color: #990000;">die</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$err_msg</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Encrypt the message</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$secure</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// Import the key into the keyring</span>
  <span style="color: #000088;">$result</span><span style="color: #339933;">=</span><a href="http://www.php.net/shell_exec"><span style="color: #990000;">shell_exec</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/bin/echo <span style="color: #006699; font-weight: bold;">$publickey</span> | &quot;</span> <span style="color: #339933;">.</span> GPG <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot; --dearmor | &quot;</span> <span style="color: #339933;">.</span> GPG <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot; --import - 2&gt;&amp;1&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #666666; font-style: italic;">// Find the key ID so that we can remove it later</span>
  <a href="http://www.php.net/preg_match"><span style="color: #990000;">preg_match</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/key ([A-Z0-9]+):/'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$result</span><span style="color: #339933;">,</span> <span style="color: #000088;">$matches</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/empty"><span style="color: #990000;">empty</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   <a href="http://www.php.net/die"><span style="color: #990000;">die</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Problem importing key!'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #000088;">$key_id</span><span style="color: #339933;">=</span><span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// Escape the key and message for added security</span>
  <span style="color: #000088;">$message</span><span style="color: #339933;">=</span><a href="http://www.php.net/escapeshellarg"><span style="color: #990000;">escapeshellarg</span></a><span style="color: #009900;">&#40;</span><a href="http://www.php.net/trim"><span style="color: #990000;">trim</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$msg</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// Fire up GPG and encrypt the message</span>
  <span style="color: #000088;">$result</span><span style="color: #339933;">=</span><a href="http://www.php.net/shell_exec"><span style="color: #990000;">shell_exec</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/bin/echo <span style="color: #006699; font-weight: bold;">$message</span> | &quot;</span> <span style="color: #339933;">.</span> GPG <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot; --batch --recipient '<span style="color: #006699; font-weight: bold;">$key_id</span>' --trust-model always --armor --encrypt 2&gt;&amp;1&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000088;">$msg</span><span style="color: #339933;">=</span><span style="color: #000088;">$result</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// Remove the key from the keyring</span>
  <span style="color: #000088;">$result</span><span style="color: #339933;">=</span><a href="http://www.php.net/shell_exec"><span style="color: #990000;">shell_exec</span></a><span style="color: #009900;">&#40;</span>GPG <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot; --batch --yes --delete-key <span style="color: #006699; font-weight: bold;">$key_id</span>' 2&gt;&amp;1&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><a href="http://www.php.net/empty"><span style="color: #990000;">empty</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <a href="http://www.php.net/die"><span style="color: #990000;">die</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Error: 29391'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Send the email</span>
<a href="http://www.php.net/mail"><span style="color: #990000;">mail</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$recipient</span><span style="color: #339933;">,</span><span style="color: #000088;">$subject</span><span style="color: #339933;">,</span><span style="color: #000088;">$msg</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;From: <span style="color: #006699; font-weight: bold;">$from_email</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Redirect the user if redirect set</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$redirect</span><span style="color: #339933;">!=</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span>
  <a href="http://www.php.net/header"><span style="color: #990000;">header</span></a><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;Location: <span style="color: #006699; font-weight: bold;">$redirect</span>&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">else</span>
  <a href="http://www.php.net/header"><span style="color: #990000;">header</span></a><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;Location: http://<span style="color: #006699; font-weight: bold;">$referrer</span>&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>The nice thing about this script is, its easy to use.  Simply paste in your public key, and if you don&#8217;t have one, get one at freegpg.org, and then set the referrers URL, and if necessary change the path to gpg.  This script has been tested and works well with the shared web hosting servers of <a href="http://penguinwebhosting.com">Penguin Web Hosting</a></p>
<p>After the form is submitted, it sends you an email with the GPG encrypted message, and then you can decrypt it with your gpg compatible email client, or paste it in, along with your private key, at FreeGPG.org.</p>
<p>Secure FormMail can accept the 4 common hidden fields:</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p50code10'); return false;">View Code</a> HTML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p5010"><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code" id="p50code10"><pre class="html" style="font-family:monospace;">&lt;input type=hidden name=recipient value=&quot;&quot;&gt;
&lt;input type=hidden name=required value=&quot;&quot;&gt;
&lt;input type=hidden name=redirect value=&quot;&quot;&gt;
&lt;input type=hidden name=subject value=&quot;&quot;&gt;</pre></td></tr></table></div>

<p>Hope you find this useful!</p>
<p>TTYL,<br />
Doug Walker</p>
]]></content:encoded>
			<wfw:commentRss>http://linuxsecurityblog.com/2009/11/secure-encrypted-formmail/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Got GPG keys?</title>
		<link>http://linuxsecurityblog.com/2009/11/got-gpg-keys/</link>
		<comments>http://linuxsecurityblog.com/2009/11/got-gpg-keys/#comments</comments>
		<pubDate>Mon, 09 Nov 2009 04:23:07 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://linuxsecurityblog.com/?p=40</guid>
		<description><![CDATA[Got GPG keys? If not, you can get them at https://www.freegpg.org This is an online interface for: creating your own public and private key (the private key is not stored online) encrypting and decrypting messages looking up the public key of other freegpg members The online interface is a lot easier than the plugins for [...]]]></description>
			<content:encoded><![CDATA[<p>Got GPG keys?</p>
<p>If not, you can get them at <a href="https://www.freegpg.org">https://www.freegpg.org</a></p>
<p>This is an online interface for:</p>
<ul>
<li>creating your own public and private key (the private key is not stored online)</li>
<li>encrypting and decrypting messages</li>
<li>looking up the public key of other freegpg members</li>
</ul>
<p>The online interface is a lot easier than the plugins for the mail clients, especially for windows, plus the look up feature is nice, because I never remember where I put everyones public key, or I reformat and the don&#8217;t have them any more, or the  person has to generate new keys, and I encrypt a message with their old public key.</p>
<p>Here is my public key (dougw[at]linuxsecurityblog.com):</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p40code12'); return false;">View Code</a> SHELL</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p4012"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
</pre></td><td class="code" id="p40code12"><pre class="shell" style="font-family:monospace;">-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.5 (GNU/Linux)
&nbsp;
mQGiBErzpG8RBACOKTmbCjMlerI91DWWRFEMntIAG7SJ4DSAdVF7eocuVbFF/c3F
LESCkrP+sjmLy5+B3A1rn3XoSjRgLQ3OxBA/cc93Yu3YbTBAfYEY7u1pvRGEqS+F
cOrfYoK3QI3Gd536tgE8xtiV9ry5ROIYx/O67URdrXB1WKhh7X4qdbJLVwCg8pvn
Jc8/4RplgZIGNAJESEN5NcsD/A4wM940yAKoFqCEHdC3goqakONuEDkQE9w2UWcj
8Zex4xMkyWOX0ZpkuWYytVWipSH9r9gQvJSa4dQppf4z98P2lOFOAKYhy7QNI/M2
KJuG1DAHLKfaDOkwi2fU4J4DAtq52oIaE+K13FSFi8vILl0GXl84TQ+DpbMpGIWS
+j93A/4+gSJyn35p8Dq3i1BRH3k9U2Eb+qqKx0uxG4XkCug8yasMe+IIDA9UIKcq
7OCtSDLp5fe2G1DTinBstrJ1ri9Vwn93qxcN7HWEUdqszw2pzHe+GmCAdv5D583R
m06IPve4JIGKymuNaIHi4cGqCYNig1VfcMP/M7wxjlYIGUPIWrQnR1BHIENyeXB0
IDxkb3Vnd0BsaW51eHNlY3VyaXR5YmxvZy5jb20+iGAEExECACAFAkrzpG8CGyMG
CwkIBwMCBBUCCAMEFgIDAQIeAQIXgAAKCRB98qmyKko4wyZiAJ9nDeGs2tPr/JWC
igFkKXCLcAC2/gCg36p2XjfbRAR1mz5PjrSlaMcIgi+5AQ0ESvOkbxAEALPVXri9
0EbZZMkxJh41WctRTqvy2cKQwTr8aVqhbmNQhBN2BD00OP/QbokNc9rpW4Z4SThV
LRXPAk7dwSxDQfZnMuGbg9V6vgXL5sdZwKh8t4iUdoR5jSe0SPWnaTuAXsV50NL5
nrmrMWonXT51qjWn/dZlsQxXWYyo/+ewZOoHAAMFA/9TeC+mk6ShcEoYXNh5SVp0
cFP/bl5MaUrPBbWbtg7SrJF9KZX/ZhoO3eh2wbtAj//FNmWSVmi8UYsh50MeXqVF
kI0T1JIIbLUxZ3WtPfbKMRHMpPj915EsiooJ4vvjnZ8kPCsWe2QWiavtYfOTKj/b
5esn8vlIXsaGAXHSxdYbb4hJBBgRAgAJBQJK86RvAhsMAAoJEH3yqbIqSjjDltAA
oOdRJ0OG81rV6MX60GrD6JZfzyMFAKCCWmt4sRwlVA1qrXoh9gadGRpezw==
=Un5z
-----END PGP PUBLIC KEY BLOCK-----</pre></td></tr></table></div>

<p>And for those if you wondering, yes, I&#8217;m the founder of freegpg.org</p>
<p>TTYL,<br />
Doug Walker</p>
]]></content:encoded>
			<wfw:commentRss>http://linuxsecurityblog.com/2009/11/got-gpg-keys/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>A file that starts with a -</title>
		<link>http://linuxsecurityblog.com/2009/11/a-file-that-starts-with-a/</link>
		<comments>http://linuxsecurityblog.com/2009/11/a-file-that-starts-with-a/#comments</comments>
		<pubDate>Fri, 06 Nov 2009 03:55:47 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://linuxsecurityblog.com/?p=38</guid>
		<description><![CDATA[Howdy All, I installed a new code formatting plugin, so I will try to give some code examples as often as possible in my posts. I was working on a hacked site yesterday, and there was a file -tmp that couldn&#8217;t be removed with a regular plain rm. Linux allows you to create a file [...]]]></description>
			<content:encoded><![CDATA[<p>Howdy All,</p>
<p>I installed a new code formatting plugin, so I will try to give some code examples as often as possible in my posts.</p>
<p>I was working on a hacked site yesterday, and there was a file -tmp that couldn&#8217;t be removed with a regular plain rm.</p>
<p>Linux allows you to create a file that starts with a &#8211; but when you try to remove it that&#8217;s a little more tricky.</p>
<p>Creating a file that starts with a -</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p38code16'); return false;">View Code</a> SHELL</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p3816"><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code" id="p38code16"><pre class="shell" style="font-family:monospace;">$ &gt;-test
$ ls |grep test
-test</pre></td></tr></table></div>

<p>Now if you try to remove that file:</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p38code17'); return false;">View Code</a> SHELL</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p3817"><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code" id="p38code17"><pre class="shell" style="font-family:monospace;">$ rm -test
rm: invalid option -- t
Try `rm ./-test' to remove the file `-test'.
Try `rm --help' for more information.</pre></td></tr></table></div>

<p>Now to actually remove a file that starts with a -, there are actually two ways:</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p38code18'); return false;">View Code</a> SHELL</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p3818"><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code" id="p38code18"><pre class="shell" style="font-family:monospace;">$ rm ./-test
$ ls |grep test
$ &gt;-test
$ rm -- -test
$ ls |grep test</pre></td></tr></table></div>

<p>TTYL,<br />
Doug Walker</p>
]]></content:encoded>
			<wfw:commentRss>http://linuxsecurityblog.com/2009/11/a-file-that-starts-with-a/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hacked by a botnet?</title>
		<link>http://linuxsecurityblog.com/2009/11/hacked-by-a-botnet/</link>
		<comments>http://linuxsecurityblog.com/2009/11/hacked-by-a-botnet/#comments</comments>
		<pubDate>Tue, 03 Nov 2009 14:26:54 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://linuxsecurityblog.com/?p=15</guid>
		<description><![CDATA[Well yesterday was a busy day. Among some Joomla upgrades, a form that sends an encrypted email, and a couple sites infected with malware, on of the malware sites, while I was working, and as soon as I would remove malware it would reappear.  I ended up locking down the site, while I removed everything.  [...]]]></description>
			<content:encoded><![CDATA[<p>Well yesterday was a busy day.</p>
<p>Among some Joomla upgrades, a form that sends an encrypted email, and a couple sites infected with malware, on of the malware sites, while I was working, and as soon as I would remove malware it would reappear.  I ended up locking down the site, while I removed everything.  Looking at the FTP log, I would see many different IPs trying to connect to it.  After resetting his password I noticed failed logins for his account from almost 400 different IP&#8217;s from all over the world.  I suspect this was a botnet set to continually infect his pages once they noticed they code was removed.</p>
<p>After getting him all cleaned up, aide has detected no file changes in about the last 24 hours.</p>
<p>And this morning, I have some more malware to remove from another site.</p>
<p>TTYL,<br />
Doug Walker</p>
]]></content:encoded>
			<wfw:commentRss>http://linuxsecurityblog.com/2009/11/hacked-by-a-botnet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

