Wednesday, June 22. 2011Technology in the here and now
I'm writing this while several thousand feet up in the air, on a flight from here to there. I won't be able to publish it until I land, but that seems to be the exception these days rather than the norm.
And yet, while preparing for takeoff, the same old announcements are made. Turn off cell phones and pagers, disable wireless communications on electronic devices. And listening around me, hurried conversations between passengers as they ensure that all of their devices are disabled. As if a stray radio signal will cause the airplane to suddenly drop from the sky, or prevent it from taking off to begin with. Why is it that we, as a society, cannot get over these simple hurdles. Plenty of studies have shown that these devices don't interfere with planes. In fact, some airlines are offering in-flight wireless access. Many airlines have offered in-flight telephone calls. Unless my understanding of flight is severely limited, I'm fairly certain that all of these functions use radio signals to operate. And yet we are still told that stray signals may cause planes to crash, may cause interference with the pilots instrumentation. We need to get over this hurdle. We need to start spending our time looking to the future, advancing our technology, forging new paths. We need to stop clinging to outdated ideas. Learning from our past mistakes is one thing, and there's merit in understanding history. But lets spend our energy wisely and make the simple things we take for granted even better. Thursday, June 16. 2011Helpful Rules for OSSECOSSEC has quickly become a primary weapon in my security toolkit. It's flexible, fast, and very easy to use. I'd like to share a few rules I've found useful as of late. I primarily use OSSEC in a server/client setup. One side effect of this is that when I make changes to the agent's configuration, it takes some time for it to push out to all of the clients. Additionally, clients don't restart automatically when a new agent config is received. However, it's fairly easy to remedy this. First, make sure you have syscheck enabled and that you're monitoring the OSSEC directory for changes. I recommend monitoring all of /var/ossec and ignoring a few specific directories where files change regularly. You'll need to add this to both the ossec.conf as well as the agent.conf. <directories check_all="yes">/var</directories> <ignore type="sregex">^/var/ossec/queue/</ignore> <ignore type="sregex">^/var/ossec/logs/</ignore> <ignore type="sregex">^/var/ossec/stats/</ignore> The first time you set this up, you'll have to manually restart the clients after the new config is pushed to them. All new clients should work fine, however. Next, add the following rules to your local_rules.xml file (or whatever scheme you're using). <rule level="12" id="100005"> <if_matched_group>syscheck</if_matched_group> <description>agent.conf changed, restarting OSSEC</description> <match>/var/ossec/etc/shared/agent.conf</match> </rule> This rule looks for changes to the agent.conf file and triggers a level 12 alert. Now we just need to capture that alert and act on it. To do that, you need to add the following to your ossec.conf file on the server. <command> <name>restart-ossec</name> <executable>restart-ossec.sh</executable> <expect>srcip</expect> <timeout_allowed>no</timeout_allowed> </command> <active-response> <command>restart-ossec</command> <location>local</location> <rules_id>100005</rules_id> </active-response> You need to add this to the top of your active response section, above any other rules. OSSEC matches the first active-response block and ignores any subsequent ones. The restart-ossec.sh script referenced in the command section should exist already in your active-response/bin directory as it's part of the distribution. And that's all there is to it. Whenever the agent.conf file changes on a client, it'll restart the OSSEC agent, reading in the new configuration. Next up, a simple DoS prevention rule for apache web traffic. I've had a few instances where a single IP would hammer away at a site I'm responsible for, eating up resources in the process. Generally speaking, there's no real reason for this. So, one solution is to temporarily block IPs that are abusive. Daniel Cid, the author of OSSEC, helped me out a little on this one. It turned out to be a little less intuitive than I expected. First, you need to group together all of the "normal" error response codes. The actual error responses (400/500 errors) are handled with other, more aggressive rules, so you can ignore most of them. For our purposes, we want to trigger on 200/300/400 error codes. <rule id="131105" level="1"> <if_sid>31101, 31108, 31100</if_sid> <description>Group of all "normal" 200/300/400 error codes.</description> </rule> Next, we want to create a composite rule that will fire after a set frequency and time limit. In short, we want this rule to fire if X matches are made in Y seconds. <rule id="131106" level="10" frequency="500" timeframe="60"> <if_matched_sid>131105</if_matched_sid> <same_source_ip /> <description>Excessive access, Temporary block</description> </rule> That should be all you need provided you have active response already enabled. You can also add a specific active response for this rule that blocks for a shorter, or longer, period of time. That's the beauty of OSSEC, the choice is in your hands. I hope you find these rules helpful. If you have any questions or comments, feel free to post them below. Monday, April 18. 2011Hey KVM, you've got your bridge in my netfilter...It's always interesting to see how new technologies alter the way we do things. Recently, I worked on firewalling for a KVM-based virtualization platform. From the outset it seems pretty straightforward. Set up iptables on the host and guest and move on. But it's not that simple, and my google-fu initially failed me when searching for an answer. The primary issue was that when iptables was enabled on the host, the guests became unavailable. If you enable logging, you can see the traffic being blocked by the host, thus never making it to the guest. So how do we do this? Well, if we start with a generic iptables setup, we have something that looks like this:
Adding logging to identify what's going on is pretty straightforward. Add two logging lines, one for the INPUT chain and one for the FORWARD chain. Make sure these are added as the first rules in the chain, otherwise you'll jump to the RH-Firewall-1-INPUT chain and never make it to the log.
Now, with this in place you can try sending traffic to the domU. If you tail /var/log/messages, you'll see the blocking done by netfilter. It should look something like this:
There are a few things of note here. First, this occurs on the FORWARD chain only. The INPUT chain is bypassed completely. Second, the system recognizes that this is a bridged connection. This makes things a bit easier to fix. My attempt at resolving this was to put in a rule that allowed traffic to pass for the bridged interface. I added the following:
This worked as expected and allowed the traffic through the FORWARD chain, making it to the domU unmolested. However, this method means I have to add a rule for every bridge interface I create. While explicitly adding rules for each interface should make this more secure, it means I may need to change iptables while the system is in production and running, not something I want to do. A bit more googling led me to this post about KVM and iptables. In short it provides two additional methods for handling this situation. The first is a more generalized rule for bridged interfaces:
Essentially, this rule tells netfilter to accept any traffic for bridged interfaces. This removes the need to add a new rule for each bridged interface you create making management a bit simpler. The second method is to completely remove bridged interfaces from netfilter. Set the following sysctl variables:
I'm a little worried about this method as it completely bypasses iptables on dom0. However, it appears that this is actually a more secure manner of handling bridged interfaces. According to this bugzilla report and this post, allowing bridged traffic to pass through netfilter on dom0 can result in a possible security vulnerability. I believe this is somewhat similar to cryptographic hash collision. Attackers can take advantage of netfilter entries with similar IP/port combinations and possibly modify traffic or access systems. By using the sysctl method above, the traffic completely bypasses netfilter on dom0 and these attacks are no longer possible. More testing is required, but I believe the latter method of using sysctl is the way to go. In addition to the security considerations, bypassing netfilter has a positive impact on throughput. It seems like a win-win from all angles. Monday, March 14. 2011MeltdownBack when the Chernobyl nuclear reactor in the Ukraine melted down, I was in grade school. That disaster absolutely fascinated me and I spent a bit of time researching nuclear power, drawing diagrams of reactor designs, and dreaming about being a nuclear scientist. The reasons behind the meltdown at Chernobyl are still a point of contention ranging from operator error to design flaws in the reactor. Chances are it is more a combination of both. There's a really detailed report about what happened here. Additional supporting material can be found on Wikipedia. From what I understand, there are 5 reactors at two plants that are listed as critical. In two instances, the containment structure has suffered an explosion. Whoa! An explosion? Yes, yes, calm down. It's not a nuclear explosion as most people know it. Most people equate a nuclear explosion with images of mushroom clouds, thoughts of nuclear fallout, and radiation sickness. The explosion we're talking about in this instance is a hydrogen explosion resulting from venting the inner containment chamber. Yes, it's entirely possible that radiation was released, but nothing near the high dosages most people equate with a nuclear bomb. And herein lies a major problem with nuclear power. Not many people understand it, and a large majority are afraid of the consequences. Yes, we have had a massive meltdown as is the case with Chernobyl. We've also had a partial meltdown as is the case with Three Mile Island. Currently, the disaster in Japan is closer to Three Mile Island than it is to Chernobyl. That, of course, is subject to change. It's entirely possible that the reactor in Japan will go into a full core meltdown. But if you look at the overall effects of nuclear power, I believe you can argue that it is cleaner and safer than many other types of power generation have been. Coal power massively pollutes the atmosphere and leaves behind some rather nasty byproducts that we just don't have a method of dealing with. Oil and gas also cause pollution in both the atmosphere as well as the area surrounding where the oil and gas are mined. Water, wind, and sun power are, generally speaking, clean, but you have to have massive amounts of each to generate sufficient power. Nuclear power has had such a negative stigma for such a long period of time that research dollars are not being spent on improving the technology. There are severe restrictions on what scientists can research with respect to nuclear power. As a result, we haven't advanced very far as compared to other technologies. If we were to open up research we would be able to develop reactors that are significantly safer. Unfortunately, I think this disaster will make things worse for the nuclear power industry. Despite the fact that this disaster wasn't caused by design flaws, nor was there operator error, the population at large will question the validity of this technology they know nothing about. Personally, I believe we could make the earth a much cleaner, safer place to live if we were to switch to nuclear power and spend time and effort on making it safer and more efficient. And finally, a brief note. I'm not a nuclear physicist or engineer, but I have done some background research. I strongly encourage you to do your own research if you're in doubt about anything I've stated. And if I'm wrong about something, please, let me know! I'll happily make edits to fix incorrect facts. Sunday, February 20. 2011When DRM Goes Bad ...
I've been using a blog editor called Blogo for a while now. It's fairly simplistic, but works quite well. However, I've experienced a few problems in the recent months that I believe are related to updates of server software and probably a few bugs. I reported the problems both through direct contact via email as well as crash reports generated by the system.
And I've waited. And waited. Where I used to receive responses within 24-48 hours from the company that makes Blogo, I have yet to receive a response to any of my reports or emails from that past few months. Their website hasn't been updated since September, 2010. By all accounts, it appears that this company and its software have become abandonware. So where does the DRM part come in ? Well, I did some more digging earlier today and came across a report about the licensing scheme that Blogo uses. Blogo phones home every time you start it up and verifies that the license you have is valid. If it cannot contact the licensing server, apparently it disables itself. This is obviously a huge problem if the Blogo servers go offline as they apparently did two weeks ago. Another problem that will eventually crop up is that Blogo licensing is limited to a number of installations before it's disabled. Previously I was able to contact the company and get this taken care of, but again, if the servers go offline, it won't be possible to reinstall. I understand what the developers of Blogo are trying to do with their licensing scheme. Piracy can be a pretty big issue if you develop a popular piece of software. Some developers try to solve this with what can be viewed as fairly draconian licensing systems. Unfortunately, they can turn on the users and prevent perfectly legitimate users from accessing the software they legally purchased. And, of course, all the pirates that downloaded a cracked version of the software that doesn't check in anymore are still up and running and probably aren't aware of any problems. I'm not sure if there's a better solution out there, but it really sucks when the software you rely on doesn't work because of a licensing issue you have no control over. I very much like Blogo and I'd love to see the bugs I've encountered fixed. I want to see Blogo updated and continue to be a viable blogging platform. But, until the developers start talking again, I suppose I'll have to look elsewhere for a solution. So the search is on again for a decent blog editor. For now I'm using MarsEdit. I'm not a huge fan, but who knows, maybe it will grow on me.
« previous page
(Page 4 of 49, totaling 243 entries)
» next page
|
CalendarMomentary Wisdom"What I cannot create, I do not understand"
LinksCurrently Reading...
TagsSyndicate This Blog |





