Monday November 08, 2004 If you don't already know what SMF is jump over to Stephen Hahn's blog to find out more.
I run Solaris 10 on my laptop and quite often I want to start it up an not be connected to any network. Waiting on the time out for the svc:/network/physical service can be an anoying slow down to boot when you don't have a network cable connected and you have no wireless access point you are going to connect to. So I disabled the startup of the svc:/network/physical service. This means that my system comes up but with only the loopback network started. I can still loging to GNOME and get work done.
As a security geek one of the things I love most about SMF is the great security integration it has with the Solaris RBAC system. I can very easily setup a user who has the ability to start/stop/restart services but can't change the definition of them. Stephen talks about this in his blog here. I have my local user account on my laptop configured with the "Service Operator" profile:
# usermod -P "Service Operator" darrenm
When I want to start the network I can just run `svcadm enable -t network/physical`, note the use of -t so that it is not enabled on next reboot.
But what if I didn't have a terminal window open ? Can't I just push a button to do this ? A very small zenity based shell script can do this for you:
#!/bin/ksh
PATH=/usr/bin:/usr/sbin
MYNAME='Network Control'
choosen=$(zenity --list --title="$MYNAME" --column="State" Up Down)
if [ "$choosen" = "Up" ]; then
svcadm enable -t svc:/network/physical:default
elif [ "$choosen" = "Down" ]; then
svcadm disable svc:/network/physical:default
fi
I then add this as a launcher on the gnome-panel. When combined with the GNOME "Network Monitor" this gives you a simple graphical view and control of your network interfaces.
One think you might notice here is that by default network/physical doesn't have a stop method defined in SMF. A later posting will show how easy it is to convert the existing start method so that it can also function as a stop method.
( Nov 08 2004, 04:12:04 PM GMT ) Permalink