A combination of features added to Solaris 10 and 11 address those problems. This
blog entry describes the current state of related features, and demonstrates
the method that was designed and implemented to automatically deploy and track
changes to configuration files, verify consistency, and fix configuration files
that "broke." Further, these new features are tightly integrated with the Solaris
Service Management Facility introduced in Solaris 10 and the packaging system
introduced in Solaris 11.
Solaris 10 added the Service
Management Facility, which significantly improved on
the old, unreliable pile of scripts in /etc/rc#.d directories. This also allowed
us to move from the old model of system configuration information stored in ASCII
files to a database of configuration information. The latter change reduces the risk
associated with manual or automated modifications of text files. Each modification is
the result of a command
that verifies the correctness of the change before applying it. That verification
process greatly reduces the opportunities for a mistake that can be very difficult
During updates to Solaris 10 and 11 we continued to move configuration files into
SMF service properties. However, there are still configuration files, and we wanted
to provide better integration between the
Solaris 11 packaging facility (IPS), and
those remaining configuration files. This blog entry demonstrates some of that
integration, using features added up through Solaris 11.1.
Many Solaris systems need customized email delivery rules. In the past, providing
those rules required replacing /etc/mail/sendmail.cf with a custom file. However,
this created the need to maintain that file - restoring it after a system udpate,
verifying its integrity periodically, and potentially fixing it if someone or
something broke it.
IPS provides the tools to accomplish those goals, specifically:
The rest of this assumes that you understand Solaris 11 and IPS.
In this example, we want to deliver a custom sendmail.cf file to multiple systems.
We will do that by creating a new IPS package that contains just one configuration file.
We need to create the "precursor" to a sendmail.cf file, (sendmail.mc) that will be
expanded by sendmail when it starts. We also need to create a custom manifest for the
package. Finally, we must create an SMF service profile, which will cause Solaris
to understand that a new sendmail configuration is available and should be integrated
into its database of configuration information.
Here are the steps in more detail.
$ mkdir -p mypkgdir/contents
$ cd mypkgdir
$ cp /etc/mail/cf/cf/sendmail.mc contents/custom_sm.mc
set name=pkg.fmri value=pkg://firstname.lastname@example.org,1.0
set name=com.cwi.info.name value=Solaris11sendmail
set name=pkg.description value="ConWid sendmail.mc file for Solaris 11, accepts only local connections."
set name=com.cwi.info.description value="Sendmail configuration"
set name=pkg.summary value="Sendmail configuration"
set name=variant.opensolaris.zone value=global value=nonglobal
set name=com.cwi.info.version value=8.14.9
set name=info.classification value=org.opensolaris.category.2008:System/Core
set name=org.opensolaris.smf.fmri value=svc:/network/smtp:sendmail
depend fmri=pkg://solaris/service/network/smtp/sendmail type=require
file custom_sm.mc group=mail mode=0444 owner=root \
file custom_sm_mc.xml group=mail mode=0444 owner=root \
$ svcbundle -o contents/custom_sm_mc.xml -s bundle-type=profile \
-s service-name=network/smtp -s instance-name=sendmail -s enabled=true \
$ pkglint -c /tmp/pkgcache -r /mnt/repo1 sendmail-config.p5m
Lint engine setup...
Starting lint run...
$ pkgrepo create /var/tmp/cwirepo
$ pkgrepo -s /var/tmp/cwirepo set publisher/prefix=cwi
$ pkgsend -s /var/tmp/cwirepo publish -d contents sendmail-config.p5m
$ pkgrepo verify -s /var/tmp/cwirepo
Initiating repository verification.
$ pkgrepo info -s /var/tmp/cwirepo
PUBLISHER PACKAGES STATUS UPDATED
cwi 1 online 2015-03-05T16:39:13.906678Z
$ pkgrepo list -s /var/tmp/cwirepo
PUBLISHER NAME O VERSION
cwi site/sendmail-config 8.14.9,1.0:20150305T163913Z
$ pkg list -afv -g /var/tmp/cwirepo
With all of that, you can use the usual IPS packaging commands. I tested this by adding the "cwi" publisher to a running native Solaris Zone and making the repo available as a loopback mount:
# zlogin testzone mkdir /var/tmp/cwirepo
# zonecfg -rz testzone
zonecfg:testzone> add fs
zonecfg:testzone:fs> set dir=/var/tmp/cwirepo
zonecfg:testzone:fs> set special=/var/tmp/cwirepo
zonecfg:testzone:fs> set type=lofs
zone 'testzone': Checking: Mounting fs dir=/var/tmp/cwirepo
zone 'testzone': Applying the changes
# zlogin testzone
root@testzone:~# pkg set-publisher -g /var/tmp/cwirepo cwi
root@testzone:~# pkg info -r sendmail-config
Summary: Sendmail configuration
Description: ConWid sendmail.mc file for Solaris 11, accepts only local
State: Not installed
Build Release: 1.0
Packaging Date: March 5, 2015 08:14:22 PM
Size: 1.59 kB
root@testzone:~# pkg install site/sendmail-config
Packages to install: 1
Services to change: 2
Create boot environment: No
Create backup boot environment: No
DOWNLOAD PKGS FILES XFER (MB) SPEED
Completed 1/1 2/2 0.0/0.0 0B/s
Installing new actions 12/12
Updating package state database Done
Updating package cache 0/0
Updating image state Done
Creating fast lookup database Done
Updating package cache 2/2
root@testzone:~# pkg verify site/sendmail-config
Installation of that package causes several effects. Obviously, the custom sendmail configuration file
custom_sm.mc is placed into the directory /etc/mail/sendmail/cf/cf. The sendmail daemon is restarted,
automatically expanding that file into a sendmail.cf file and using it. I have noticed that on occasion, it is necessary to refresh and restart the sendmail service.
For more information, see these documents: