...by default is accepting connections only from localhost.
Not very useful if you want to have a functional mail server.
To allow connections from everywhere svccfg is the way to do it:
#svccfg -s sendmail setprop config/local_only=false
Don't forget to : #svcadm refresh sendmail and restart the sendmail server: #svcadm restart sendmail
To check if it is ok, run:
#svcprop sendmail
[...]
config/local_only boolean false
[...]
and telnet your_host 25 from outside.
More info about svcprop and svccfg.
Saturday, October 3, 2009
Linux in the Bucharest subway
Monday, September 21, 2009
Saturday, September 5, 2009
Sunday, May 10, 2009
ProFTPD pakage for opensolaris
In opensolaris there is no proftpd package, so I decide to build it and to make a pkg
First, you must decide how many packages you will need and what will be their names
the distributables names have the form:
<$PKG>-<$VERSION>--<$ARCH>-local[.tgz]
where local means that the package is installable on /opt or /usr/local
According to the solaris filesystem (man filesystem), add-on software could install files only on:
/opt/
/etc/opt/
/var/opt/
/var/svc/manifest
/var/tmp
/usr/local is not an SVR4 approved directory: /usr is availble only for Solaris bundled software; exceptionally, /usr/local could be a softlink to /opt/local
the usernames are limited to 8 characters.
In opensolaris the pkg have the name format XXXyyy, where XXX is the name of the of company and tge yyy is the name of the software.For example, SUNWpostgr-83-libs
So, let's start work on the proftpd pkg file.
Setup the directory structure in your home directory somethinglike this: ~/pkg/build/$PKG/{ControlFiles,Objects}
- $PKG is TSTproftpd
Copy the proftpd files structure in Objects directory
#pwd
#/root/pkg/build/TSTproftpd/Objects
root@freya:~/pkg/build/TSTproftpd/Objects# ls
_EXTRAS FAKE_ROOT
- FAKE_ROOT
-- contain the TSTproftpd directory (here are the files of the proftpd server).This will have a structure bin include lib libexec sbin share usr var.You will notice no etc directory (etc of proftpd will be located in /etc/opt/TSTSproftpd
-- in FAKE_ROOT/etc/opt/TSTproftpd are the conf files, proftpd.conf, proftpd.key/pem etc.
-- in FAKE_ROOT/var/opt/TSTproftpd directory will contain the pid file and the delay file
FAKE_ROOT is the proftpd directory structure after the install of the pkg file.
- _EXTRAS
Here we have the smf method file, sysV init script and the xml manifest file
#~/pkg/build/TSTproftpd/Objects/_EXTRAS# pwd
/root/pkg/build/TSTproftpd/Objects/_EXTRAS
#~/pkg/build/TSTproftpd/Objects/_EXTRAS# ls
etc TSTproftpd var
The structure of the _EXTRAS dir:
#~/pkg/build/TSTproftpd/Objects/_EXTRAS# ls -R
.:
etc TSTproftpd var
./etc:
init.d
./etc/init.d:
proftpd
./TSTproftpd:
lib
./TSTproftpd/lib:
svc
./TSTproftpd/lib/svc:
method
./TSTproftpd/lib/svc/method:
proftpd
./var:
opt svc
./var/opt:
TSTproftpd
./var/opt/TSTproftpd:
proftpd
./var/opt/TSTproftpd/proftpd:
proftpd.delay
./var/svc:
manifest
./var/svc/manifest:
network
./var/svc/manifest/network:
proftpd.xml
The second and the most and difficult step is to create the ControlFiles directory and the files from it.
create ControlFiles/copyright
(optional) create ControlFiles/space
(optional) create ControlFiles/compver
(optional) create ControlFiles/depend
(optional) create ControlFiles/checkinstall script
(optional) create ControlFiles/{preinstall, postinstall, preremove, postremove} procedure scripts
(optional) create ControlFiles/{i., r.} class action scripts
(optional) create ControlFiles/request user interaction script
#:~/pkg/build/TSTproftpd/ControlFiles# pwd
/root/pkg/build/TSTproftpd/ControlFiles
#:~/pkg/build/TSTproftpd/ControlFiles# ls
checkinstall compver copyright depend i.init i.smf pkginfo postinstall preremove prototype space
- pkginfo -
PKG=TSTproftpd
NAME=ProFTPD server and utilities
ARCH=i386
VERSION=1.3.2
CATEGORY=daemon
DESC=Professional grade GPL-licensed FTP server software; see www.proftpd.org
BASEDIR=/opt
CLASSES=none
- checkinstall -
# proftpd - checkinstall script
#
trap `exit 3` 15
# Assign Solaris release class to install release specific files
smf=no
if [ -f /usr/sbin/svccfg -a -f /usr/sbin/svcadm ] ; then smf=yes ; fi
if [ $smf = yes ]; then
CLASSES='none smf'
else
CLASSES='none init'
fi
# Make env variables available to other packaging scripts
cat >$1 <CLASSES='$CLASSES'
!
exit 0
- compver -
1.3.1, 2009.02.01
1.2.2
1.0.1
- copyright -
#Copyright (c) 1999 company_name
#All Rights Reserved.
#THIS PACKAGE CONTAINS UNPUBLISHED PROPRIETARY SOURCE CODE OF
#company_name.
#The copyright notice above does not evidence any
#actual or intended publication of such source code
- depend -
P SUNWpostgr-83-libs PostgreSQL client libraries
!!!! my proftpd server is using pgsql for storing users and quota.
- i.init -
# proftpd - i.init script
#
# Copy the SysV specific files to the base directory.
# These are:
# /etc/init.d/proftpd
# /etc/rc0.d/K10proftpd=/etc/init.d/proftpd
# /etc/rc1.d/K10proftpd=/etc/init.d/proftpd
# /etc/rc2.d/K10proftpd=/etc/init.d/proftpd
# /etc/rc3.d/S70proftpd=/etc/init.d/proftpd
#
while read src dest; do
/usr/bin/cp $src $dest || exit 2
echo $dest
done
exit 0
- i.smf -
# proftpd - i.smf script
#
# Copy the SMF specific files to the base directory.
# The files specific to SMF are:
# TSTproftpd/lib/svc
# TSTproftpd/lib/svc/method
# TSTproftpd/lib/svc/method/proftpd
# /var/svc
# /var/svc/manifest
# /var/svc/manifest/network
# /var/svc/manifest/network/proftpd.xml
#
while read src dest; do
/usr/bin/cp $src $dest || exit 2
echo $dest
done
exit 0
- postinstall -
# proftpd - postinstall script
# 2009/04/23 - add SMF capabilities
#
# Set variable smf depending on the availability of SMF binaries
smf=no
if [ -f /usr/sbin/svccfg -a -f /usr/sbin/svcadm ]; then
smf=yes
fi
# If needed, configure SMF
if [ $smf = yes ]; then
# registering with SMF
/usr/sbin/svccfg import /var/svc/manifest/network/proftpd.xml >/dev/null 2>&1
echo "ProFTPD is using SMF; the FMRI is:"
echo " svc:/network/proftpd"
# disable the service, by default
/usr/sbin/svcadm disable -s network/proftpd
echo "The service is disabled by default!"
else
echo "ProFTPD is using the SysVinit style"
fi
exit 0
- preremove -
# proftpd - preremove script
# 2009/04/23 - add SMF functionality
#
# Set variable smf depending on the availability of SMF binaries
smf=no
if [ -f /usr/sbin/svccfg -a -f /usr/sbin/svcadm ]; then
smf=yes
fi
if [ $smf = yes ]; then
# disable the service
echo "Disabling the service (if running)"
/usr/sbin/svcadm disable -s network/proftpd >/dev/null 2>&1
# remove the service hook from SMF
echo "Unregistering the SMF service"
/usr/sbin/svccfg delete network/proftpd >/dev/null 2>&1
fi
exit 0
- space -
#empty file, nothing here
Finaly the prototype file must be created, this is the difficult part ;)
# cd ~/pkg/build/TSTproftpd
# pkgproto Objects/ > ControlFiles/prototype
This will create a file, containing the pkg structure.Anyway, some modifications must be done.
i pkginfo
i copyright
i compver
i depend
i space
i checkinstall
i i.smf
i i.init
i postinstall
i preremove
edit the paths for the relocatable objects
add the {e, v, x} entries
modify the (user, group) owner for the entries
modify the file permissions for the entries
(optional) add the classes entries, other than 'none'
build the package:
The file should be like this:
i pkginfo
i copyright
i compver
i depend
i space
i checkinstall
i i.smf
i i.init
i postinstall
i preremove
d none /etc/opt/TSTproftpd 0755 root root
f none /etc/opt/TSTproftpd/proftpd.conf 0440 root bin
f none /etc/opt/TSTproftpd/proftpd.key.pem 0444 root bin
f none /etc/opt/TSTproftpd/proftpd.conf.orig 0444 root bin
f none /etc/opt/TSTproftpd/proftpd.cert.pem 0444 root bin
d none TSTproftpd 0755 root root
d none TSTproftpd/share 0555 root bin
d none TSTproftpd/share/locale 0555 root bin
d none TSTproftpd/share/man 0555 root bin
d none TSTproftpd/share/man/man5 0555 root bin
f none TSTproftpd/share/man/man5/xferlog.5 0444 root bin
d none TSTproftpd/share/man/man8 0555 root bin
f none TSTproftpd/share/man/man8/ftpshut.8 0444 root bin
f none TSTproftpd/share/man/man8/proftpd.8 0444 root bin
f none TSTproftpd/share/man/man8/ftpdctl.8 0444 root bin
d none TSTproftpd/share/man/man1 0555 root bin
f none TSTproftpd/share/man/man1/ftpwho.1 0444 root bin
f none TSTproftpd/share/man/man1/ftpcount.1 0444 root bin
f none TSTproftpd/share/man/man1/ftptop.1 0444 root bin
d none TSTproftpd/lib 0555 root bin
d none TSTproftpd/lib/pkgconfig 0555 root bin
f none TSTproftpd/lib/pkgconfig/proftpd.pc 0444 root bin
d none TSTproftpd/lib/proftpd 0555 root bin
d none TSTproftpd/include 0555 root bin
d none TSTproftpd/include/proftpd 0555 root bin
f none TSTproftpd/include/proftpd/response.h 0444 root bin
f none TSTproftpd/include/proftpd/compat.h 0444 root bin
f none TSTproftpd/include/proftpd/regexp.h 0444 root bin
f none TSTproftpd/include/proftpd/timers.h 0444 root bin
f none TSTproftpd/include/proftpd/conf.h 0444 root bin
f none TSTproftpd/include/proftpd/str.h 0444 root bin
f none TSTproftpd/include/proftpd/help.h 0444 root bin
f none TSTproftpd/include/proftpd/modules.h 0444 root bin
f none TSTproftpd/include/proftpd/netio.h 0444 root bin
f none TSTproftpd/include/proftpd/sets.h 0444 root bin
f none TSTproftpd/include/proftpd/config.h 0444 root bin
f none TSTproftpd/include/proftpd/default_paths.h 0444 root bin
f none TSTproftpd/include/proftpd/ctrls.h 0444 root bin
f none TSTproftpd/include/proftpd/trace.h 0444 root bin
f none TSTproftpd/include/proftpd/child.h 0444 root bin
f none TSTproftpd/include/proftpd/xferlog.h 0444 root bin
f none TSTproftpd/include/proftpd/throttle.h 0444 root bin
f none TSTproftpd/include/proftpd/bindings.h 0444 root bin
f none TSTproftpd/include/proftpd/event.h 0444 root bin
f none TSTproftpd/include/proftpd/proftpd.h 0444 root bin
f none TSTproftpd/include/proftpd/display.h 0444 root bin
f none TSTproftpd/include/proftpd/ftp.h 0444 root bin
f none TSTproftpd/include/proftpd/log.h 0444 root bin
f none TSTproftpd/include/proftpd/fsio.h 0444 root bin
f none TSTproftpd/include/proftpd/mkhome.h 0444 root bin
f none TSTproftpd/include/proftpd/mod_ctrls.h 0444 root bin
f none TSTproftpd/include/proftpd/pr-syslog.h 0444 root bin
f none TSTproftpd/include/proftpd/env.h 0444 root bin
f none TSTproftpd/include/proftpd/data.h 0444 root bin
f none TSTproftpd/include/proftpd/var.h 0444 root bin
f none TSTproftpd/include/proftpd/class.h 0444 root bin
f none TSTproftpd/include/proftpd/options.h 0444 root bin
f none TSTproftpd/include/proftpd/version.h 0444 root bin
f none TSTproftpd/include/proftpd/mod_sql.h 0444 root bin
f none TSTproftpd/include/proftpd/glibc-glob.h 0444 root bin
f none TSTproftpd/include/proftpd/netaddr.h 0444 root bin
f none TSTproftpd/include/proftpd/netacl.h 0444 root bin
f none TSTproftpd/include/proftpd/mod_quotatab.h 0444 root bin
f none TSTproftpd/include/proftpd/expr.h 0444 root bin
f none TSTproftpd/include/proftpd/scoreboard.h 0444 root bin
f none TSTproftpd/include/proftpd/inet.h 0444 root bin
f none TSTproftpd/include/proftpd/parser.h 0444 root bin
f none TSTproftpd/include/proftpd/libsupp.h 0444 root bin
f none TSTproftpd/include/proftpd/buildstamp.h 0444 root bin
f none TSTproftpd/include/proftpd/encode.h 0444 root bin
f none TSTproftpd/include/proftpd/dirtree.h 0444 root bin
f none TSTproftpd/include/proftpd/table.h 0444 root bin
f none TSTproftpd/include/proftpd/auth.h 0444 root bin
f none TSTproftpd/include/proftpd/support.h 0444 root bin
f none TSTproftpd/include/proftpd/pool.h 0444 root bin
f none TSTproftpd/include/proftpd/pidfile.h 0444 root bin
d none TSTproftpd/bin 0555 root bin
f none TSTproftpd/bin/ftptop 0555 root bin
f none TSTproftpd/bin/prxs 0555 root bin
f none TSTproftpd/bin/ftpdctl 0555 root bin
f none TSTproftpd/bin/ftpcount 0555 root bin
f none TSTproftpd/bin/ftpwho 0555 root bin
d none TSTproftpd/usr 0755 root sys
d none TSTproftpd/usr/proftpd-1.3.2 0755 root sys
d none TSTproftpd/usr/proftpd-1.3.2/include 0755 root sys
d none TSTproftpd/usr/proftpd-1.3.2/include/proftpd 0755 root sys
f none TSTproftpd/usr/proftpd-1.3.2/include/proftpd/privs.h 0444 root bin
f none TSTproftpd/usr/proftpd-1.3.2/include/proftpd/proctitle.h 0444 root bin
f none TSTproftpd/usr/proftpd-1.3.2/include/proftpd/feat.h 0444 root bin
d none TSTproftpd/sbin 0555 root bin
f none TSTproftpd/sbin/proftpd 0555 root bin
s none TSTproftpd/sbin/in.proftpd=proftpd
f none TSTproftpd/sbin/ftpshut 0555 root bin
d none TSTproftpd/libexec 0555 root bin
f none TSTproftpd/libexec/mod_sql.so 0555 root bin
f none TSTproftpd/libexec/mod_sql_postgres.a 0644 root root
f none TSTproftpd/libexec/mod_quotatab.a 0444 root bin
f none TSTproftpd/libexec/mod_sql_postgres.so 0755 root root
f none TSTproftpd/libexec/mod_quotatab.la 0555 root bin
f none TSTproftpd/libexec/mod_quotatab.so 0555 root bin
f none TSTproftpd/libexec/mod_sql_postgres.la 0644 root root
f none TSTproftpd/libexec/mod_quotatab_file.a 0444 root bin
f none TSTproftpd/libexec/mod_sql.la 0555 root bin
f none TSTproftpd/libexec/mod_sql.a 0444 root bin
f none TSTproftpd/libexec/mod_quotatab_file.so 0555 root bin
f none TSTproftpd/libexec/mod_quotatab_sql.so 0555 root bin
f none TSTproftpd/libexec/mod_quotatab_file.la 0555 root bin
f none TSTproftpd/libexec/mod_quotatab_sql.a 0444 root bin
f none TSTproftpd/libexec/mod_quotatab_sql.la 0555 root bin
d none TSTproftpd/var 0555 root bin
d none TSTproftpd/var/proftpd 0555 root bin
#d none /var/opt 0755 root root
d none /var/opt/TSTproftpd 0755 root root
d none /var/opt/TSTproftpd/proftpd 0755 root root
v none /var/opt/TSTproftpd/proftpd/proftpd.delay 0644 root bin
#
# the smf class files
#
d smf TSTproftpd/lib/svc 0755 root bin
d smf TSTproftpd/lib/svc/method 0755 root bin
f smf TSTproftpd/lib/svc/method/proftpd 0755 root bin
f smf /var/svc/manifest/network/proftpd.xml 0444 root sys
# the init class files
#
f init /etc/init.d/proftpd 0744 root sys
s init /etc/rc0.d/K10proftpd=/etc/init.d/proftpd
s init /etc/rc1.d/K10proftpd=/etc/init.d/proftpd
s init /etc/rc2.d/K10proftpd=/etc/init.d/proftpd
s init /etc/rc3.d/S70proftpd=/etc/init.d/proftpd
The proftpd will be installed in /opt/TSTproftpd directory.The conf file in /etc/opt/TSTproftpd directory, the svc method in /opt/TSTproftpd/lib/svc/method.The xml manifest will be in /var/svc/manifest/network.For more info about filesystem organization in opensolaris system, read man filesystem
Now it's time to build the pkg file.By default, the package in filesystem format will be generated on the 'spool' device: /var/spool/pkg/. For other destinations, see the '-d' option of pkgmk.
# pkgmk -o -f ControlFiles/prototype -r Objects/FAKE_ROOT,Objects/_EXTRAS
!!!! No errors are allowed. !!!!
# cd /var/spool/pkg
Translate the package to the datastream format, suitable for distribution:
# pkgtrans -s `pwd` /tmp/TSTproftpd.pkg
The following packages are available:
1 TSTproftpd ProFTPD server and utilities
(i386) 1.3.2
Select package(s) you wish to process (or 'all' to process
all packages). (default: all) [?,??,q]:all
Transferring package instance
To install the TSTproftpd server, type # pkgadd -d TSTproftpd
By default, proftpd is disabled at start up
To enable it, type svcadmin enable network/TSTproftpd
The end :)
If you want to test the pkg file and to take a look at the ControlFiles take a look here:
http://idea-soft.sci-office.com/~dan/down/TSTproftpd/
More useful links:
http://www.sunfreeware.com/pkgadd.html
http://www.opencsw.org/standards/smf
First, you must decide how many packages you will need and what will be their names
the distributables names have the form:
<$PKG>-<$VERSION>--<$ARCH>-local[.tgz]
where local means that the package is installable on /opt or /usr/local
According to the solaris filesystem (man filesystem), add-on software could install files only on:
/opt/
/etc/opt/
/var/opt/
/var/svc/manifest
/var/tmp
/usr/local is not an SVR4 approved directory: /usr is availble only for Solaris bundled software; exceptionally, /usr/local could be a softlink to /opt/local
the usernames are limited to 8 characters.
In opensolaris the pkg have the name format XXXyyy, where XXX is the name of the of company and tge yyy is the name of the software.For example, SUNWpostgr-83-libs
So, let's start work on the proftpd pkg file.
Setup the directory structure in your home directory somethinglike this: ~/pkg/build/$PKG/{ControlFiles,Objects}
- $PKG is TSTproftpd
Copy the proftpd files structure in Objects directory
#pwd
#/root/pkg/build/TSTproftpd/Objects
root@freya:~/pkg/build/TSTproftpd/Objects# ls
_EXTRAS FAKE_ROOT
- FAKE_ROOT
-- contain the TSTproftpd directory (here are the files of the proftpd server).This will have a structure bin include lib libexec sbin share usr var.You will notice no etc directory (etc of proftpd will be located in /etc/opt/TSTSproftpd
-- in FAKE_ROOT/etc/opt/TSTproftpd are the conf files, proftpd.conf, proftpd.key/pem etc.
-- in FAKE_ROOT/var/opt/TSTproftpd directory will contain the pid file and the delay file
FAKE_ROOT is the proftpd directory structure after the install of the pkg file.
- _EXTRAS
Here we have the smf method file, sysV init script and the xml manifest file
#~/pkg/build/TSTproftpd/Objects/_EXTRAS# pwd
/root/pkg/build/TSTproftpd/Objects/_EXTRAS
#~/pkg/build/TSTproftpd/Objects/_EXTRAS# ls
etc TSTproftpd var
The structure of the _EXTRAS dir:
#~/pkg/build/TSTproftpd/Objects/_EXTRAS# ls -R
.:
etc TSTproftpd var
./etc:
init.d
./etc/init.d:
proftpd
./TSTproftpd:
lib
./TSTproftpd/lib:
svc
./TSTproftpd/lib/svc:
method
./TSTproftpd/lib/svc/method:
proftpd
./var:
opt svc
./var/opt:
TSTproftpd
./var/opt/TSTproftpd:
proftpd
./var/opt/TSTproftpd/proftpd:
proftpd.delay
./var/svc:
manifest
./var/svc/manifest:
network
./var/svc/manifest/network:
proftpd.xml
The second and the most and difficult step is to create the ControlFiles directory and the files from it.
create ControlFiles/copyright
(optional) create ControlFiles/space
(optional) create ControlFiles/compver
(optional) create ControlFiles/depend
(optional) create ControlFiles/checkinstall script
(optional) create ControlFiles/{preinstall, postinstall, preremove, postremove} procedure scripts
(optional) create ControlFiles/{i., r.} class action scripts
(optional) create ControlFiles/request user interaction script
#:~/pkg/build/TSTproftpd/ControlFiles# pwd
/root/pkg/build/TSTproftpd/ControlFiles
#:~/pkg/build/TSTproftpd/ControlFiles# ls
checkinstall compver copyright depend i.init i.smf pkginfo postinstall preremove prototype space
- pkginfo -
PKG=TSTproftpd
NAME=ProFTPD server and utilities
ARCH=i386
VERSION=1.3.2
CATEGORY=daemon
DESC=Professional grade GPL-licensed FTP server software; see www.proftpd.org
BASEDIR=/opt
CLASSES=none
- checkinstall -
# proftpd - checkinstall script
#
trap `exit 3` 15
# Assign Solaris release class to install release specific files
smf=no
if [ -f /usr/sbin/svccfg -a -f /usr/sbin/svcadm ] ; then smf=yes ; fi
if [ $smf = yes ]; then
CLASSES='none smf'
else
CLASSES='none init'
fi
# Make env variables available to other packaging scripts
cat >$1 <CLASSES='$CLASSES'
!
exit 0
- compver -
1.3.1, 2009.02.01
1.2.2
1.0.1
- copyright -
#Copyright (c) 1999 company_name
#All Rights Reserved.
#THIS PACKAGE CONTAINS UNPUBLISHED PROPRIETARY SOURCE CODE OF
#company_name.
#The copyright notice above does not evidence any
#actual or intended publication of such source code
- depend -
P SUNWpostgr-83-libs PostgreSQL client libraries
!!!! my proftpd server is using pgsql for storing users and quota.
- i.init -
# proftpd - i.init script
#
# Copy the SysV specific files to the base directory.
# These are:
# /etc/init.d/proftpd
# /etc/rc0.d/K10proftpd=/etc/init.d/proftpd
# /etc/rc1.d/K10proftpd=/etc/init.d/proftpd
# /etc/rc2.d/K10proftpd=/etc/init.d/proftpd
# /etc/rc3.d/S70proftpd=/etc/init.d/proftpd
#
while read src dest; do
/usr/bin/cp $src $dest || exit 2
echo $dest
done
exit 0
- i.smf -
# proftpd - i.smf script
#
# Copy the SMF specific files to the base directory.
# The files specific to SMF are:
# TSTproftpd/lib/svc
# TSTproftpd/lib/svc/method
# TSTproftpd/lib/svc/method/proftpd
# /var/svc
# /var/svc/manifest
# /var/svc/manifest/network
# /var/svc/manifest/network/proftpd.xml
#
while read src dest; do
/usr/bin/cp $src $dest || exit 2
echo $dest
done
exit 0
- postinstall -
# proftpd - postinstall script
# 2009/04/23 - add SMF capabilities
#
# Set variable smf depending on the availability of SMF binaries
smf=no
if [ -f /usr/sbin/svccfg -a -f /usr/sbin/svcadm ]; then
smf=yes
fi
# If needed, configure SMF
if [ $smf = yes ]; then
# registering with SMF
/usr/sbin/svccfg import /var/svc/manifest/network/proftpd.xml >/dev/null 2>&1
echo "ProFTPD is using SMF; the FMRI is:"
echo " svc:/network/proftpd"
# disable the service, by default
/usr/sbin/svcadm disable -s network/proftpd
echo "The service is disabled by default!"
else
echo "ProFTPD is using the SysVinit style"
fi
exit 0
- preremove -
# proftpd - preremove script
# 2009/04/23 - add SMF functionality
#
# Set variable smf depending on the availability of SMF binaries
smf=no
if [ -f /usr/sbin/svccfg -a -f /usr/sbin/svcadm ]; then
smf=yes
fi
if [ $smf = yes ]; then
# disable the service
echo "Disabling the service (if running)"
/usr/sbin/svcadm disable -s network/proftpd >/dev/null 2>&1
# remove the service hook from SMF
echo "Unregistering the SMF service"
/usr/sbin/svccfg delete network/proftpd >/dev/null 2>&1
fi
exit 0
- space -
#empty file, nothing here
Finaly the prototype file must be created, this is the difficult part ;)
# cd ~/pkg/build/TSTproftpd
# pkgproto Objects/ > ControlFiles/prototype
This will create a file, containing the pkg structure.Anyway, some modifications must be done.
i pkginfo
i copyright
i compver
i depend
i space
i checkinstall
i i.smf
i i.init
i postinstall
i preremove
edit the paths for the relocatable objects
add the {e, v, x} entries
modify the (user, group) owner for the entries
modify the file permissions for the entries
(optional) add the classes entries, other than 'none'
build the package:
The file should be like this:
i pkginfo
i copyright
i compver
i depend
i space
i checkinstall
i i.smf
i i.init
i postinstall
i preremove
d none /etc/opt/TSTproftpd 0755 root root
f none /etc/opt/TSTproftpd/proftpd.conf 0440 root bin
f none /etc/opt/TSTproftpd/proftpd.key.pem 0444 root bin
f none /etc/opt/TSTproftpd/proftpd.conf.orig 0444 root bin
f none /etc/opt/TSTproftpd/proftpd.cert.pem 0444 root bin
d none TSTproftpd 0755 root root
d none TSTproftpd/share 0555 root bin
d none TSTproftpd/share/locale 0555 root bin
d none TSTproftpd/share/man 0555 root bin
d none TSTproftpd/share/man/man5 0555 root bin
f none TSTproftpd/share/man/man5/xferlog.5 0444 root bin
d none TSTproftpd/share/man/man8 0555 root bin
f none TSTproftpd/share/man/man8/ftpshut.8 0444 root bin
f none TSTproftpd/share/man/man8/proftpd.8 0444 root bin
f none TSTproftpd/share/man/man8/ftpdctl.8 0444 root bin
d none TSTproftpd/share/man/man1 0555 root bin
f none TSTproftpd/share/man/man1/ftpwho.1 0444 root bin
f none TSTproftpd/share/man/man1/ftpcount.1 0444 root bin
f none TSTproftpd/share/man/man1/ftptop.1 0444 root bin
d none TSTproftpd/lib 0555 root bin
d none TSTproftpd/lib/pkgconfig 0555 root bin
f none TSTproftpd/lib/pkgconfig/proftpd.pc 0444 root bin
d none TSTproftpd/lib/proftpd 0555 root bin
d none TSTproftpd/include 0555 root bin
d none TSTproftpd/include/proftpd 0555 root bin
f none TSTproftpd/include/proftpd/response.h 0444 root bin
f none TSTproftpd/include/proftpd/compat.h 0444 root bin
f none TSTproftpd/include/proftpd/regexp.h 0444 root bin
f none TSTproftpd/include/proftpd/timers.h 0444 root bin
f none TSTproftpd/include/proftpd/conf.h 0444 root bin
f none TSTproftpd/include/proftpd/str.h 0444 root bin
f none TSTproftpd/include/proftpd/help.h 0444 root bin
f none TSTproftpd/include/proftpd/modules.h 0444 root bin
f none TSTproftpd/include/proftpd/netio.h 0444 root bin
f none TSTproftpd/include/proftpd/sets.h 0444 root bin
f none TSTproftpd/include/proftpd/config.h 0444 root bin
f none TSTproftpd/include/proftpd/default_paths.h 0444 root bin
f none TSTproftpd/include/proftpd/ctrls.h 0444 root bin
f none TSTproftpd/include/proftpd/trace.h 0444 root bin
f none TSTproftpd/include/proftpd/child.h 0444 root bin
f none TSTproftpd/include/proftpd/xferlog.h 0444 root bin
f none TSTproftpd/include/proftpd/throttle.h 0444 root bin
f none TSTproftpd/include/proftpd/bindings.h 0444 root bin
f none TSTproftpd/include/proftpd/event.h 0444 root bin
f none TSTproftpd/include/proftpd/proftpd.h 0444 root bin
f none TSTproftpd/include/proftpd/display.h 0444 root bin
f none TSTproftpd/include/proftpd/ftp.h 0444 root bin
f none TSTproftpd/include/proftpd/log.h 0444 root bin
f none TSTproftpd/include/proftpd/fsio.h 0444 root bin
f none TSTproftpd/include/proftpd/mkhome.h 0444 root bin
f none TSTproftpd/include/proftpd/mod_ctrls.h 0444 root bin
f none TSTproftpd/include/proftpd/pr-syslog.h 0444 root bin
f none TSTproftpd/include/proftpd/env.h 0444 root bin
f none TSTproftpd/include/proftpd/data.h 0444 root bin
f none TSTproftpd/include/proftpd/var.h 0444 root bin
f none TSTproftpd/include/proftpd/class.h 0444 root bin
f none TSTproftpd/include/proftpd/options.h 0444 root bin
f none TSTproftpd/include/proftpd/version.h 0444 root bin
f none TSTproftpd/include/proftpd/mod_sql.h 0444 root bin
f none TSTproftpd/include/proftpd/glibc-glob.h 0444 root bin
f none TSTproftpd/include/proftpd/netaddr.h 0444 root bin
f none TSTproftpd/include/proftpd/netacl.h 0444 root bin
f none TSTproftpd/include/proftpd/mod_quotatab.h 0444 root bin
f none TSTproftpd/include/proftpd/expr.h 0444 root bin
f none TSTproftpd/include/proftpd/scoreboard.h 0444 root bin
f none TSTproftpd/include/proftpd/inet.h 0444 root bin
f none TSTproftpd/include/proftpd/parser.h 0444 root bin
f none TSTproftpd/include/proftpd/libsupp.h 0444 root bin
f none TSTproftpd/include/proftpd/buildstamp.h 0444 root bin
f none TSTproftpd/include/proftpd/encode.h 0444 root bin
f none TSTproftpd/include/proftpd/dirtree.h 0444 root bin
f none TSTproftpd/include/proftpd/table.h 0444 root bin
f none TSTproftpd/include/proftpd/auth.h 0444 root bin
f none TSTproftpd/include/proftpd/support.h 0444 root bin
f none TSTproftpd/include/proftpd/pool.h 0444 root bin
f none TSTproftpd/include/proftpd/pidfile.h 0444 root bin
d none TSTproftpd/bin 0555 root bin
f none TSTproftpd/bin/ftptop 0555 root bin
f none TSTproftpd/bin/prxs 0555 root bin
f none TSTproftpd/bin/ftpdctl 0555 root bin
f none TSTproftpd/bin/ftpcount 0555 root bin
f none TSTproftpd/bin/ftpwho 0555 root bin
d none TSTproftpd/usr 0755 root sys
d none TSTproftpd/usr/proftpd-1.3.2 0755 root sys
d none TSTproftpd/usr/proftpd-1.3.2/include 0755 root sys
d none TSTproftpd/usr/proftpd-1.3.2/include/proftpd 0755 root sys
f none TSTproftpd/usr/proftpd-1.3.2/include/proftpd/privs.h 0444 root bin
f none TSTproftpd/usr/proftpd-1.3.2/include/proftpd/proctitle.h 0444 root bin
f none TSTproftpd/usr/proftpd-1.3.2/include/proftpd/feat.h 0444 root bin
d none TSTproftpd/sbin 0555 root bin
f none TSTproftpd/sbin/proftpd 0555 root bin
s none TSTproftpd/sbin/in.proftpd=proftpd
f none TSTproftpd/sbin/ftpshut 0555 root bin
d none TSTproftpd/libexec 0555 root bin
f none TSTproftpd/libexec/mod_sql.so 0555 root bin
f none TSTproftpd/libexec/mod_sql_postgres.a 0644 root root
f none TSTproftpd/libexec/mod_quotatab.a 0444 root bin
f none TSTproftpd/libexec/mod_sql_postgres.so 0755 root root
f none TSTproftpd/libexec/mod_quotatab.la 0555 root bin
f none TSTproftpd/libexec/mod_quotatab.so 0555 root bin
f none TSTproftpd/libexec/mod_sql_postgres.la 0644 root root
f none TSTproftpd/libexec/mod_quotatab_file.a 0444 root bin
f none TSTproftpd/libexec/mod_sql.la 0555 root bin
f none TSTproftpd/libexec/mod_sql.a 0444 root bin
f none TSTproftpd/libexec/mod_quotatab_file.so 0555 root bin
f none TSTproftpd/libexec/mod_quotatab_sql.so 0555 root bin
f none TSTproftpd/libexec/mod_quotatab_file.la 0555 root bin
f none TSTproftpd/libexec/mod_quotatab_sql.a 0444 root bin
f none TSTproftpd/libexec/mod_quotatab_sql.la 0555 root bin
d none TSTproftpd/var 0555 root bin
d none TSTproftpd/var/proftpd 0555 root bin
#d none /var/opt 0755 root root
d none /var/opt/TSTproftpd 0755 root root
d none /var/opt/TSTproftpd/proftpd 0755 root root
v none /var/opt/TSTproftpd/proftpd/proftpd.delay 0644 root bin
#
# the smf class files
#
d smf TSTproftpd/lib/svc 0755 root bin
d smf TSTproftpd/lib/svc/method 0755 root bin
f smf TSTproftpd/lib/svc/method/proftpd 0755 root bin
f smf /var/svc/manifest/network/proftpd.xml 0444 root sys
# the init class files
#
f init /etc/init.d/proftpd 0744 root sys
s init /etc/rc0.d/K10proftpd=/etc/init.d/proftpd
s init /etc/rc1.d/K10proftpd=/etc/init.d/proftpd
s init /etc/rc2.d/K10proftpd=/etc/init.d/proftpd
s init /etc/rc3.d/S70proftpd=/etc/init.d/proftpd
The proftpd will be installed in /opt/TSTproftpd directory.The conf file in /etc/opt/TSTproftpd directory, the svc method in /opt/TSTproftpd/lib/svc/method.The xml manifest will be in /var/svc/manifest/network.For more info about filesystem organization in opensolaris system, read man filesystem
Now it's time to build the pkg file.By default, the package in filesystem format will be generated on the 'spool' device: /var/spool/pkg/. For other destinations, see the '-d' option of pkgmk.
# pkgmk -o -f ControlFiles/prototype -r Objects/FAKE_ROOT,Objects/_EXTRAS
!!!! No errors are allowed. !!!!
# cd /var/spool/pkg
Translate the package to the datastream format, suitable for distribution:
# pkgtrans -s `pwd` /tmp/TSTproftpd.pkg
The following packages are available:
1 TSTproftpd ProFTPD server and utilities
(i386) 1.3.2
Select package(s) you wish to process (or 'all' to process
all packages). (default: all) [?,??,q]:all
Transferring
To install the TSTproftpd server, type # pkgadd -d TSTproftpd
By default, proftpd is disabled at start up
To enable it, type svcadmin enable network/TSTproftpd
The end :)
If you want to test the pkg file and to take a look at the ControlFiles take a look here:
http://idea-soft.sci-office.com/~dan/down/TSTproftpd/
More useful links:
http://www.sunfreeware.com/pkgadd.html
http://www.opencsw.org/standards/smf
Sunday, May 3, 2009
Wednesday, March 18, 2009
ProFTPD manifest xml for opensolaris
In order to start/stop/refresh proftpd using SMF method, you need two files, the manifest xml file and the start/stop/refresh proftpd script.
First, the xml file:
Copy this file in /var/svc/manifest/network/proftpd.xml
To import this file type as root:
svccfg import /var/svc/manifest/network/proftpd.xml
Second file, the proftpd start up script:
#!/sbin/sh
#
#proftpd start up script
# ident "%Z%%M% %I% %E% SMI"
. /lib/svc/share/smf_include.sh
PROFTPDIR=/usr/proftpd-1.3.2/
PROFTPCONF=/usr/proftpd-1.3.2/etc/proftpd.conf
PIDFILE=/usr/proftpd-1.3.2/var/proftpd.pid
if [ ! -d $PROFTPDIR ]; then
echo "Error: proftpd dir not found"
exit $SMF_EXIT_ERR_CONFIG
fi
if [ ! -f $PROFTPCONF ]; then
echo "Error: proftpd conf file not found"
exit $SMF_EXIT_ERR_CONFIG
fi
# This script is being used for two purposes: as part of an SMF
# start/stop/refresh method, and as a sysidconfig(1M)/sys-unconfig(1M)
# application.
#
# Both, the SMF methods and sysidconfig/sys-unconfig use different
# arguments..
case $1 in
'start')
$PROFTPDIR/sbin/proftpd -c $PROFTPCONF 2> /dev/null
;;
'stop')
if [ -f "$PIDFILE" ]; then
kill -9 `/usr/bin/cat $PIDFILE`
rm -f $PIDFILE 2>/dev/null
else
pkill proftpd 2>/dev/null
rm -f $PIDFILE 2>/dev/null
fi
;;
'restart')
if [ -f "$PIDFILE" ]; then
/usr/bin/kill -HUP `/usr/bin/cat $PIDFILE`
fi
;;
*)
echo "Usage: $0 { start | stop | restart }"
exit 1
;;
esac
exit $?
Copy this file in /lib/svc/method/
In order to start up the proftpd server (read more about how to compile proftpd on opensolari here) type:
svcadm enable proftpd-server
To check if the proftpd server is running type:
svcs -p proftpd-server
The output will something like that
root@opensolaris:/var/lib# svcs -p proftpd-server
STATE STIME FMRI
online 12:07:06 svc:/network/proftpd-server:default
11:56:03 276 proftpd
To stop the proftpd server type:
svcadm disable proftpd-server
Same for refresh/restart method
svcadm refresh proftpd-server
The script and the xml file are self explained, and if you installed the proftpd in a different path, do not forget to change the PROFTPDIR, PROFTPCONF and PIDFILE variables from proftpd script acording to your proftpd prefix.
Troubleshooting Tips
If you have problems with the proftpd manifest check the /var/svc/log/network-proftpd-server\:default.log file.
To see if the proftpd is running:
svcs -xv proftpd-server
The output is something like this:
svc:/network/proftpd-server:default (PROFTPD server)
State: online since Wed Mar 18 12:35:33 2009
See: man -M /usr/proftpd-1.3.2/share/man -s 1M in.proftpd
See: /var/svc/log/network-proftpd-server:default.log
Impact: None.
First, the xml file:
<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<service_bundle type="manifest" name="proftpd-server">
<service
name="network/proftpd-server"
type="service"
version="1">
<create_default_instance enabled="false">
<single_instance>
<dependency name='net-loopback'
grouping='require_all'
restart_on='none'
type='service'>
<service_fmri value="'svc:/network/loopback'">
</dependency>
<dependency name='net-physical'
grouping='require_all'
restart_on='none'
type='service'>
<service_fmri value="'svc:/network/physical'">
</dependency>
<exec_method
type="method"
name="start"
exec="/lib/svc/method/proftpd start"
timeout_seconds="60">
</exec_method>
<exec_method
type="method" name="stop"
exec="/lib/svc/method/proftpd stop"
timeout_seconds="60">
</exec_method>
<exec_method
type="method"
name="refresh"
exec="/lib/svc/method/proftpd restart"
timeout_seconds="60">
</exec_method>
<stability value="Unstable">
<template>
<common_name>
<loctext lang="C">
PROFTPD server
</loctext>
</common_name>
<documentation>
<manpage title='in.proftpd'
section='1M'
manpath='/usr/proftpd-1.3.2/share/man' />
</documentation>
</template>
</service>
</service_bundle>
Copy this file in /var/svc/manifest/network/proftpd.xml
To import this file type as root:
svccfg import /var/svc/manifest/network/proftpd.xml
Second file, the proftpd start up script:
#!/sbin/sh
#
#proftpd start up script
# ident "%Z%%M% %I% %E% SMI"
. /lib/svc/share/smf_include.sh
PROFTPDIR=/usr/proftpd-1.3.2/
PROFTPCONF=/usr/proftpd-1.3.2/etc/proftpd.conf
PIDFILE=/usr/proftpd-1.3.2/var/proftpd.pid
if [ ! -d $PROFTPDIR ]; then
echo "Error: proftpd dir not found"
exit $SMF_EXIT_ERR_CONFIG
fi
if [ ! -f $PROFTPCONF ]; then
echo "Error: proftpd conf file not found"
exit $SMF_EXIT_ERR_CONFIG
fi
# This script is being used for two purposes: as part of an SMF
# start/stop/refresh method, and as a sysidconfig(1M)/sys-unconfig(1M)
# application.
#
# Both, the SMF methods and sysidconfig/sys-unconfig use different
# arguments..
case $1 in
'start')
$PROFTPDIR/sbin/proftpd -c $PROFTPCONF 2> /dev/null
;;
'stop')
if [ -f "$PIDFILE" ]; then
kill -9 `/usr/bin/cat $PIDFILE`
rm -f $PIDFILE 2>/dev/null
else
pkill proftpd 2>/dev/null
rm -f $PIDFILE 2>/dev/null
fi
;;
'restart')
if [ -f "$PIDFILE" ]; then
/usr/bin/kill -HUP `/usr/bin/cat $PIDFILE`
fi
;;
*)
echo "Usage: $0 { start | stop | restart }"
exit 1
;;
esac
exit $?
Copy this file in /lib/svc/method/
In order to start up the proftpd server (read more about how to compile proftpd on opensolari here) type:
svcadm enable proftpd-server
To check if the proftpd server is running type:
svcs -p proftpd-server
The output will something like that
root@opensolaris:/var/lib# svcs -p proftpd-server
STATE STIME FMRI
online 12:07:06 svc:/network/proftpd-server:default
11:56:03 276 proftpd
To stop the proftpd server type:
svcadm disable proftpd-server
Same for refresh/restart method
svcadm refresh proftpd-server
The script and the xml file are self explained, and if you installed the proftpd in a different path, do not forget to change the PROFTPDIR, PROFTPCONF and PIDFILE variables from proftpd script acording to your proftpd prefix.
Troubleshooting Tips
If you have problems with the proftpd manifest check the /var/svc/log/network-proftpd-server\:default.log file.
To see if the proftpd is running:
svcs -xv proftpd-server
The output is something like this:
svc:/network/proftpd-server:default (PROFTPD server)
State: online since Wed Mar 18 12:35:33 2009
See: man -M /usr/proftpd-1.3.2/share/man -s 1M in.proftpd
See: /var/svc/log/network-proftpd-server:default.log
Impact: None.
Subscribe to:
Posts (Atom)

.jpg)














