Linux Archive

Devil Linux serial console

Posted May 8, 2012 By Landis V

I’m a fan of Devil Linux.  It’s the first distribution I encountered that, by default, has no ports listening when you boot it up.  As you might expect, this does hint at a less tailored fit in a desktop environment (in most cases), but is a great base for a network appliance.

As an appliance, many times it’s handier to be able to just jack in a serial cable from a laptop or an aux port than to cart around a display, keyboard and mouse.  Unfortunately, the live CD by itself doesn’t provide that console access.  However, if you have saved a working configuration to storage media, it seems to be fairly trivial to do this – caveat emptor, I haven’t run full tests natively, only after running install-on-usb and installing to local disk media using syslinux with console option.

After running install-on-usb as noted above, I had serial access to the system once the boot was completed and the login prompt displayed on the real console.  I proceeded to lose this access by replacing the etc-mods.tar.bz2 with my live configuration, and figured then that the changes must be contained within the saved mods.  Here’s what I added back to regain console access (adjust your serial port name as necessary for your platform):

  • To the end of /etc/inittab, add:
    S0:2345:respawn:/sbin/agetty -L 9600 ttyS0 vt102
  • To /etc/securetty, add:
    ttyS0

Don’t forget to save-config – reboot (reinit?), and you should have a working serial console.  Lots more room to play and improve these, but this is sufficient for my needs at this time and may help someone else down the road.

Be the first to comment

LXC Linux Containers To Be Better With Pangolin

Posted May 1, 2012 By Landis V

http://phoronix.com/forums/showthread.php?64453-LXC-Linux-Containers-To-Be-Better-With-Pangolin

Need to get back into this again as well, now that the network and systems are approaching a state of decent preparation for it.  Couple of good links off of this article.

Be the first to comment

http://beta.fatwallet.com/forums/hot-deals/1182506/m16851981/#m16851981

More tips on Tomato/DD-WRT with the N300.

Be the first to comment

I don’t think you should be using sudo and maybe you shouldn’t be using Linux at all.

The money quote.  Love this.  Article was well written with clear and helpful examples.  Thanks, Tony.

via Understanding and using sudo in Unix or Linux (with examples).

Nobody has told me much about Linux, but I have learned vast amounts from the community.  There is a downside to that, however.  In an interactive conversation, certain things may come up that generate further discussion by their nature, whereas simple consumption from the web (or any other medium) may leave a vague hunch without actually provoking the “deeper dive”, if you will.

Such is the case, for me, with sudo and setuid.  I’ve always had the impression that setuid was a “bad thing to do”™, because (in an overly broad and general sense) if your setuid application was compromised by a security flaw, your system was effectively compromised.  sudo was “a good thing”™, because you could perform administrative functions easily without having to log out, log in as root, take care of the task at hand, and then return to your normal user shell.

Fast forward to today.  I’ve been doing some testing with check_mk, and ran into an issue where the default host check utilizes the Nagios check_icmp plugin.  When check_mk attempts to run same, it fails with an error indicating that the executable must be run as root or have setuid root set.  I presume the reason Nagios (or “nagios”, if you want to call the process by its username) is able to perform the checks is because the process is initiated as root and drops privileges, but maintains the permissions required to interface with the network stack.  In this case, (I think… haven’t proved it yet) it’s irrelevant.  What I really want to know is – which is the better option to use, given that I can change the command used for the default check to use sudo if needed.

Jump... to conclusions!

Jump... to conclusions!

After reading Tony’s article and taking into consideration that the sudo application itself is a setuid binary, I’m going to make a quick jump to  conclusions that probably doesn’t much matter in any case, since the executable will be effectively running as root.  I’m going to go with an edit to /etc/sudoers that will permit just the webserver account to run the plugin as root.  I have two reasons for this approach, one or both of which may be wrong.

First, I suspect there have been a lot more eyes on the code for the sudo binary than on the Nagios plugin binary, and if there’s going to be a flaw in one, it’s probably the latter (n.b. – I would not expect to see a flaw in the Nagios code, either… monitoring systems are, by their very purpose, allowed to converse with very critical infrastructure and best practices in development and security should be priorities).

Second, using sudo I can allow limited access to run the plugin as root, restricting that ability to just the webserver user account.  With setuid, any user who has the ability to execute the program (given a mask of 755, effectively everyone) can A.) run the program, and B.) do so as root.

In a perfect world – or maybe just a parallel dimension to this one – I could (and perhaps should) set the user and group ownership of the file more specifically, chmod o-x the plugins, and then chmod u+s the particular check_icmp plugin I needed.  This would likely be a more achievable solution in cases where it is difficult or impossible to control how the binary is called.

EDIT:  So, there’s an interesting new problem with this approach.  While the return code from the executed plugin is provided as the return code from sudo, the data returned by the plugin is sadly missing.  This makes sense, and it should have occurred to me.  There are a few ways I could get it back:  Fun with pipes, PID’s, and file descriptors using GDB (example here); parsing and passing the results as a passive host check to the Nagios external command file (might make sense since check_mk submits results as passive checks anyway).  Probably others.  At this juncture, I will probably at least test with the setuid bit set, and perhaps just leave it that way.

2 Comments so far. Join the Conversation

http://baheyeldin.com/linux/setting-up-autofs-automount-for-a-linux-network.html

Also in my list of plans to get set up.  Looks like an interesting blog to read more of as well.

Be the first to comment

Cluster build environment

Posted March 5, 2012 By Landis V

This is quite an interesting build sheet linked from the screenshots at http://netkiller.sourceforge.net.  Most of my design doesn’t get into this kind of depth – and in fact, stays almost exclusively at the layer 2/layer 3 level, below what’s generally reflected here.  There’s just a zen-like aura surrounding this diagram, and as I reviewed it, a feeling of peace came over me.  So, I thought I’d mark it in case I do need to design at this scope at some point in the future.

Be the first to comment

http://www.pcadvisor.co.uk/news/software/3328300/fedora-mint-opensuse-ubuntu-which-linux-desktop-is-for-you/

I think this is an article I read some time back and had been hunting for.  The author’s review provided a perspective I find useful as I consider a switch from Ubuntu.  I’ll be trying out Mint and am also hoping to test the latest alpha/beta of Ubuntu (while also running a test of Windows 8, hopefully).  If I get my firewall relocated this weekend so I have space to plug another chassis into my KVM, I hope to be able to start on one or two of these.

Be the first to comment