Systems

Speaking of ugly code

The following violates many coding principals that I normally hold true to, but it was actually cool to code using the string variables as a stack.


#!/usr/bin/perl

# print hostlets
#
# 192.168.$i.0
$titan = "";
for ($i = 0; $i < 11; $i++) {
        $j = 0;
        $l = 0;
        $m = 0;
        $n = 0;
        $monster = "";
        $groupzilla = "";
        while ($j < 256) {
                $monster .= " hostlet_" . $i . "_" . $l;

                print "hostlet_" . $i . "_" . $l . " ";
                for ($k = 0; $k < 10 && $j < 256; $k++) {
                        print "(192.168.$i.$j,,) ";
                        $j++;
                }
                print "\n";
                $l++;

                if (($l % 5 == 0) || $j >= 255) {
                        $groupzilla .= " monster_" . $i . "_" . $m;
                        print "monster_" . $i . "_" . $m . $monster . "\n";
                        $monster = "";
                        $m++;
                }
        }

        $titan .= " groupzilla_" . $i;
        print "groupzilla_" . $i . $groupzilla . "\n";
}

print "titan" . $titan . "\n";

Allowing root ssh logins to Solaris machines

I’ve been away from Solaris for 5 months, but I need some VMs for NFSv4 testing, which means beating my head against modernization such as RBAC, pfexec, and NWAM.

I prefer to treat my lab Unix machines as inter-changable boxes and do all of my configuration up front. I want to be able to do an SSH root login, especially if the system goes out of the way to make that hard.

There are currently 3 things you have to do to violate this security truism on either OpenSolaris or Solaris 11:

1) Modify PermitRootLogin to yes in /etc/ssh/sshd_config.

2) Comment out the “CONSOLE=/dev/console” line in /etc/default/login.

3) Remove “;type=role” from the root entry in /etc/user_attr.

Really nasty Solaris 11 install

I just installed two VMs with the Solaris 11 express (snv_151a) and when I turned off nwam, one worked and the second did not:

svcadm disable svc:/network/physical:nwam
svcadm enable svc:/network/physical:default

The network would come up, both ifconfig and netstat -rn showed reasonable values, but the machine would only ping iff nwam were turned on.

It turned out to be ipfiltering:


root@snarf:~# ping 172.16.1.2
ping: sendto Network is unreachable
root@snarf:~# ipfstat -io
block out log all
pass out quick on lo0 all
pass out quick proto udp from any to any port = bootps
block in log all
pass in quick on lo0 all
pass in quick proto udp from any to any port = bootpc
root@snarf:~# svcadm disable svc:/network/ipfilter
root@snarf:~# ping 172.16.1.2
172.16.1.2 is alive
root@snarf:~# ipfstat -io
empty list for ipfilter(out)
empty list for ipfilter(in)

It was not enabled on the first machine, but was on the second. I have no clue what I did differently in the first install.

Configuring Fedora Core 14 network interfaces in a dual-hosted VM

I’ve got several VMs running with eth0 being bridged and eth1 being host only. I see the routes:

[thomas@mage ~]$ ip route
192.168.1.0/24 dev eth0  proto kernel  scope link  src 192.168.1.21 
172.16.1.0/24 dev eth1  proto kernel  scope link  src 172.16.1.3 
default via 172.16.1.1 dev eth1

The problem being that is flipped from what I want for the default route. I suspect the issue is that eth0 is set up to be configured via DHCP.

I read a bit and it was suggested that not only does /etc/sysconfig/network-scripts/ifcfg-eth0 have to have:

DEFROUTE=yes

But /etc/sysconfig/network-scripts/ifcfg-eth1 should have:

DEFROUTE=no

I made that change and cleared that hurdle:

[thomas@mage ~]$ ip route
192.168.1.0/24 dev eth0  proto kernel  scope link  src 192.168.1.21 
172.16.1.0/24 dev eth1  proto kernel  scope link  src 172.16.1.3 
default via 192.168.1.1 dev eth0 

FWIW, here are my config files:

[thomas@mage ~]$ more /etc/sysconfig/network-scripts/ifcfg-eth?
::::::::::::::
/etc/sysconfig/network-scripts/ifcfg-eth0
::::::::::::::
DEVICE="eth0"
NM_CONTROLLED="no"
ONBOOT=yes
HWADDR=00:50:56:2E:52:F0
TYPE=Ethernet
BOOTPROTO=dhcp
DEFROUTE=yes
PEERROUTES=yes
IPV6INIT=no
UUID=5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03
::::::::::::::
/etc/sysconfig/network-scripts/ifcfg-eth1
::::::::::::::
DEVICE=eth1
HWADDR=00:0C:29:97:74:DB
TYPE=Ethernet
BOOTPROTO=none
IPADDR=172.16.1.3
PREFIX=24
GATEWAY=172.16.1.1
DNS1=172.16.1.2
DOMAIN=internal.loghyr.com
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
UUID=539d9802-fe1a-4b44-8d80-8a03f35aa844
ONBOOT=yes
DEFROUTE=no

How to edit DHCP server for Fusion

Crap, I am mixing versions of Fusion down below and it is partly because I do not have a clean install of Fusion on my laptop! I do on the iMac and that is what is telling me I have different systems!

Re: Scripts to manage Fusion network settings is a good place to see the differences.

See Controlling DHCP for VMWare Fusion VMs!

Note: I had to edit

/Library/Application Support/VMware Fusion/networking

and also reboot the MacBook to get this to work.

VMware Fusion Virtual Network Configuration, 27 August 2010 has a different approach.

To actually change the domain-name, you will want to edit vmnet-dhcpd.conf:

KinMage:VMware Fusion thomas$ grep domain-name vmnet-dhcpd.conf
# We set domain-name-servers to make some DHCP clients happy
    option domain-name-servers %hostaddr%;
    option domain-name "loghyr.com";
KinMage:VMware Fusion thomas$ sudo ./vmnet-cli -c
...
KinMage:VMware Fusion thomas$ sudo ./vmnet-cli --start
...

Building SlugOS 5.3-beta on Fedora Core 14

  102  yum install help2man
  104  yum install texi2html
  116  yum install glibc-static
  117  vi /kanigix/slugos/5.3/slugos-nslu2be.tmp/work/x86_64-linux/unifdef-native-2.6.18+git-r0/unifdef.c

The last was to change getline() to getline2() to avoid a conflict.

Very nasty one here for this message:

[tdh@wont 5.3]$ more /kanigix/slugos/5.3/slugos-nslu2be.tmp/work/armv5teb-linux-gnueabi/linux-libc-headers-2.6.23-r3/temp/log.do_configure.13663
NOTE: make -e MAKEFLAGS= allnoconfig ARCH=arm
Makefile:416: *** mixed implicit and normal rules.  Stop.
FATAL: oe_runmake failed

(Note: You could probably build easier against make-3.81 instead of make-3.82 !)

Edit these two files to apply this diff:

[tdh@wont 5.3]$ find . -name Makefile | grep glibc | grep  manual./slugos-nslu2be.tmp/work/armv5teb-linux-gnueabi/glibc-initial-2.6.1-r15/glibc-2.6.1/manual/Makefile
./slugos-nslu2be.tmp/work/armv5teb-linux-gnueabi/glibc-2.6.1-r15/glibc-2.6.1/manual/Makefile

And also apply this patch to

/kanigix/slugos/5.3/slugos-nslu2be.tmp/work/armv5teb-linux-gnueabi/linux-libc-headers-2.6.23-r3/linux-2.6.23/Makefile
[tdh@wont linux-2.6.23]$ diff -u Makefile Makefile.STOCK 
--- Makefile	2010-12-29 18:23:58.176755981 -0600
+++ Makefile.STOCK	2010-12-29 18:21:43.405298124 -0600
@@ -413,11 +413,7 @@
 include $(srctree)/arch/$(ARCH)/Makefile
 export KBUILD_DEFCONFIG
 
-config: scripts_basic outputmakefile FORCE
-	$(Q)mkdir -p include/linux include/config
-	$(Q)$(MAKE) $(build)=scripts/kconfig $@
-
-%config: scripts_basic outputmakefile FORCE
+config %config: scripts_basic outputmakefile FORCE
 	$(Q)mkdir -p include/linux include/config
 	$(Q)$(MAKE) $(build)=scripts/kconfig $@
 
@@ -1467,10 +1463,7 @@
 	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
 
 # Modules
-/: prepare scripts FORCE
-	$(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
-	$(build)=$(build-dir)
-%/: prepare scripts FORCE
+/ %/: prepare scripts FORCE
 	$(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
 	$(build)=$(build-dir)
 %.ko: prepare scripts FORCE

And do the getline2() trick here:

/kanigix/slugos/5.3/slugos-nslu2be.tmp/work/armv5teb-linux-gnueabi/linux-libc-headers-2.6.23-r3/linux-2.6.23/scripts/unifdef.c 

And more:


[tdh@wont busybox-1.13.2]$ pwd
/kanigix/slugos/5.3/slugos-nslu2be.tmp/work/armv5teb-linux-gnueabi/busybox-1.13.2-r16/busybox-1.13.2
[tdh@wont busybox-1.13.2]$ diff Makefile Makefile.STOCK 
421,425c421
< config: scripts_basic outputmakefile FORCE
< 	$(Q)mkdir -p include
< 	$(Q)$(MAKE) $(build)=scripts/kconfig $@
< 	$(Q)$(MAKE) -C $(srctree) KBUILD_SRC= .kernelrelease
< %config: scripts_basic outputmakefile FORCE
---
> config %config: scripts_basic outputmakefile FORCE
1273,1276c1269
< /: prepare scripts FORCE
< 	$(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
< 	$(build)=$(build-dir)
< %/: prepare scripts FORCE
---
> / %/: prepare scripts FORCE

Keep on fixing these as you found they broke. Consider again trying make-3.81!

Annoying lag in “command not found”

[tdh@wont ~]$ jjj
Command not found.

Followed by an annoying lag. FC13 does not do this, but FC14 does.

It turns out there is a package called PackageKit-command-not-found and it is controlling this behavior.

[root@wont PackageKit]# pwd
/etc/PackageKit
[root@wont PackageKit]# diff CommandNotFound.conf CommandNotFound.conf.STOCK
35c35
< SoftwareSourceSearch=false
---
> SoftwareSourceSearch=true

And problem solved! I.e., I want to keep the other features of the package (for now), so this gives the solution with the least impact.