Difference between revisions of "OS-SCO-OpenSource-sudo"

From KRayWiki
Jump to navigation Jump to search
(Add notes that describe how the sudo resources were built.)
 
(Renames to more easily differentiate between files including upstream source tarball.)
 
(5 intermediate revisions by the same user not shown)
Line 21: Line 21:
 
Create a workspace.
 
Create a workspace.
  
<div style="background-color: #EEEEEE; border: dashed; border-width: 1px; font-family: courier; margin: 1em 2em; padding: 1ex; white-space: pre;"><nowiki>$ mkdir -p ~/src/sudo
+
<div style="background-color: #EEEEEE; border: dashed; border-width: 1px; font-family: courier; margin: 1em 2em; padding: 1ex; white-space: pre;"><nowiki>$ mkdir -p ~/src/sudo/dist
 
$ cd ~/src/sudo
 
$ cd ~/src/sudo
 
</nowiki></div>
 
</nowiki></div>
Line 35: Line 35:
 
Build the project
 
Build the project
  
<div style="background-color: #EEEEEE; border: dashed; border-width: 1px; font-family: courier; margin: 1em 2em; padding: 1ex; white-space: pre;"><nowiki>$ CC= CFLAGS="-static" ./configure -C --prefix="/usr/local"
+
<div style="background-color: #EEEEEE; border: dashed; border-width: 1px; font-family: courier; margin: 1em 2em; padding: 1ex; white-space: pre;"><nowiki>$ CC= CFLAGS="-static" ./configure -C --prefix="${HOME}/src/sudo/dist/usr/local" --sysconfdir="${HOME}/src/sudo/dist/etc"
 
$ make
 
$ make
 
</nowiki></div>
 
</nowiki></div>
Line 41: Line 41:
 
Snapshot the file system before `make install`.
 
Snapshot the file system before `make install`.
  
<div style="background-color: #EEEEEE; border: dashed; border-width: 1px; font-family: courier; margin: 1em 2em; padding: 1ex; white-space: pre;"><nowiki>$ find / | sort >../sudo-1.6.9p23.before.files
+
<div style="background-color: #EEEEEE; border: dashed; border-width: 1px; font-family: courier; margin: 1em 2em; padding: 1ex; white-space: pre;"><nowiki>$ su root -c "find / | sort >../sudo-1.6.9p23.before.files"
 
</nowiki></div>
 
</nowiki></div>
  
Install sudo.
+
Install sudo to dist folder.
  
<div style="background-color: #EEEEEE; border: dashed; border-width: 1px; font-family: courier; margin: 1em 2em; padding: 1ex; white-space: pre;"><nowiki>$ su csdi -c "make install"
+
<div style="background-color: #EEEEEE; border: dashed; border-width: 1px; font-family: courier; margin: 1em 2em; padding: 1ex; white-space: pre;"><nowiki>$ su root -c "make install"
 
</nowiki></div>
 
</nowiki></div>
  
 
Snapshot the file system after `make install`.
 
Snapshot the file system after `make install`.
  
<div style="background-color: #EEEEEE; border: dashed; border-width: 1px; font-family: courier; margin: 1em 2em; padding: 1ex; white-space: pre;"><nowiki>$ find / | sort >../sudo-1.6.9p23.after.files
+
<div style="background-color: #EEEEEE; border: dashed; border-width: 1px; font-family: courier; margin: 1em 2em; padding: 1ex; white-space: pre;"><nowiki>$ su root -c "find / | sort >../sudo-1.6.9p23.after.files"
 
</nowiki></div>
 
</nowiki></div>
  
Review the installed file list
+
Review the installed file list:
  
 
<div style="background-color: #EEEEEE; border: dashed; border-width: 1px; font-family: courier; margin: 1em 2em; padding: 1ex; white-space: pre;"><nowiki>$ cd ..
 
<div style="background-color: #EEEEEE; border: dashed; border-width: 1px; font-family: courier; margin: 1em 2em; padding: 1ex; white-space: pre;"><nowiki>$ cd ..
$ diff -u sudo-1.6.9p23.before.files sudo-1.6.9p23.after.files
+
$ su chown `who am i` ../sudo-1.6.9p23.*.files
 +
$ diff ../sudo-1.6.9p23.before.files ../sudo-1.6.9p23.after.files
 +
$ find ../dist -type f
 
</nowiki></div>
 
</nowiki></div>
  
As desired, create an archive of the essential files.
+
After verifying ../dist content agrees with the difference analysis (no files installed outside of the dist folder), build sudo using actual system paths.
  
<div style="background-color: #EEEEEE; border: dashed; border-width: 1px; font-family: courier; margin: 1em 2em; padding: 1ex; white-space: pre;"><nowiki>$ cd /
+
<div style="background-color: #EEEEEE; border: dashed; border-width: 1px; font-family: courier; margin: 1em 2em; padding: 1ex; white-space: pre;"><nowiki>$ CC= CFLAGS="-static" ./configure -C --prefix="/usr/local"
$ su csdi -c "( echo etc/sudoers; echo usr/local/share/man/man1m/sudoedit.1m; echo usr/local/share/man/man1m/sudo.1m; echo usr/local/share/man/man1m/visudo.1m; echo usr/local/share/man/man4/sudoers.4; echo usr/local/bin/sudoedit; echo usr/local/bin/sudo; echo usr/local/sbin/visudo; echo usr/local/libexec/sudo_noexec.so; ) | cpio -ocvB >${HOME}/src/sudo/sudo-1.6.9p23-sco507.cpio"
+
$ make
 +
</nowiki></div>
 +
 
 +
As desired, create an archive of the essential files by installing and archiving all the pertinent files.
 +
 
 +
<div style="background-color: #EEEEEE; border: dashed; border-width: 1px; font-family: courier; margin: 1em 2em; padding: 1ex; white-space: pre;"><nowiki>$ su root -c "make install"
 +
$ cd ..
 +
$ su root -c "tar -cAf sudo-1.6.9p23-sco507-bin.tar `( find dist -type f -exec echo -n '{} ' \; ; echo ) | sed -e 's/dist//g'`"
 +
$ su root -c "chown `id -un` sudo-1.6.9p23-sco507.tar"
 +
$ tar -itf sudo-1.6.9p23-sco507-bin.tar
 +
$ gzip sudo-1.6.9p23-sco507-bin.tar
 
</nowiki></div>
 
</nowiki></div>
  
Line 69: Line 81:
  
 
<div style="background-color: #EEEEEE; border: dashed; border-width: 1px; font-family: courier; margin: 1em 2em; padding: 1ex; white-space: pre;"><nowiki>$ cd ${HOME}/src/sudo
 
<div style="background-color: #EEEEEE; border: dashed; border-width: 1px; font-family: courier; margin: 1em 2em; padding: 1ex; white-space: pre;"><nowiki>$ cd ${HOME}/src/sudo
$ mkdir pkg
+
$ mkdir -p pkg
 +
$ pkgproto `( find dist -type f -exec echo -n '{} ' \; ; echo ) | sed -e 's/dist//g'` >pkg/prototype
 
$ cd pkg
 
$ cd pkg
$ su csdi -c "pkgproto etc/sudoers usr/local/share/man/man1m/sudoedit.1m \
 
    usr/local/share/man/man1m/sudo.1m usr/local/share/man/man1m/visudo.1m \
 
      usr/local/share/man/man4/sudoers.4 usr/local/bin/sudoedit \
 
        usr/local/bin/sudo usr/local/sbin/visudo \
 
          usr/local/libexec/sudo_noexec.so >prototype"
 
 
$ vim prototype
 
$ vim prototype
 
$ cat prototype
 
$ cat prototype
Line 102: Line 110:
 
<div style="background-color: #EEEEEE; border: dashed; border-width: 1px; font-family: courier; margin: 1em 2em; padding: 1ex; white-space: pre;"><nowiki>PKG=sudo
 
<div style="background-color: #EEEEEE; border: dashed; border-width: 1px; font-family: courier; margin: 1em 2em; padding: 1ex; white-space: pre;"><nowiki>PKG=sudo
 
VERSION=1.6.9p23
 
VERSION=1.6.9p23
PSTAMP=SYSTEMSDESIGNUSA.COM-20180629
+
PSTAMP=SYSTEMSDESIGNUSA.COM-20180705
 
NAME=sudo, sudoedit -- execute a command as another user
 
NAME=sudo, sudoedit -- execute a command as another user
 
DESC=sudo allows a permitted user to execute a command as the superuser or another user, as specified by security policy.
 
DESC=sudo allows a permitted user to execute a command as the superuser or another user, as specified by security policy.
Line 117: Line 125:
  
 
<div style="background-color: #EEEEEE; border: dashed; border-width: 1px; font-family: courier; margin: 1em 2em; padding: 1ex; white-space: pre;"><nowiki>$ vim pkgmk.sh
 
<div style="background-color: #EEEEEE; border: dashed; border-width: 1px; font-family: courier; margin: 1em 2em; padding: 1ex; white-space: pre;"><nowiki>$ vim pkgmk.sh
 +
$ chmod 744 pkgmk.sh
 
$ cat pkgmk.sh
 
$ cat pkgmk.sh
 
</nowiki></div>
 
</nowiki></div>
Line 123: Line 132:
 
eval `grep "^VERSION=" ./pkginfo`
 
eval `grep "^VERSION=" ./pkginfo`
 
echo
 
echo
echo "Specify 'csdi' password to make '/var/spool/pkg/${PKG}'."
+
echo "Specify 'root' password to make '/var/spool/pkg/${PKG}'."
 
echo
 
echo
su csdi -c "pkgmk -o"
+
su root -c "pkgmk -o"
 
echo
 
echo
echo "Specify 'csdi' password to make '/var/spool/pkg/${PKG}-${VERSION}.pkg'."
+
echo "Specify 'root' password to make '/var/spool/pkg/${PKG}-${VERSION}.pkg'."
 
echo
 
echo
su csdi -c "pkgtrans -o -s /var/spool/pkg ${PKG}-${VERSION}.pkg sudo"
+
su root -c "pkgtrans -o -s /var/spool/pkg ${PKG}-${VERSION}-sco507.pkg sudo"
 
echo
 
echo
 
echo "Install example:"
 
echo "Install example:"
Line 153: Line 162:
 
Create the .pkg distributable file.
 
Create the .pkg distributable file.
  
<div style="background-color: #EEEEEE; border: dashed; border-width: 1px; font-family: courier; margin: 1em 2em; padding: 1ex; white-space: pre;"><nowiki>$ su csdi -c "pkgmk -o"
+
<div style="background-color: #EEEEEE; border: dashed; border-width: 1px; font-family: courier; margin: 1em 2em; padding: 1ex; white-space: pre;"><nowiki>$ su root -c "./pkgmk.sh"
 
</nowiki></div>
 
</nowiki></div>
  
 
Attempt to create a binary distribution tarball using the project Makefile:
 
Attempt to create a binary distribution tarball using the project Makefile:
  
<div style="background-color: #EEEEEE; border: dashed; border-width: 1px; font-family: courier; margin: 1em 2em; padding: 1ex; white-space: pre;"><nowiki>$ make bindist
+
<div style="background-color: #EEEEEE; border: dashed; border-width: 1px; font-family: courier; margin: 1em 2em; padding: 1ex; white-space: pre;"><nowiki>$ cd ~/src/sudo/sudo-1.6.9p23
 +
$ make bindist
 
...
 
...
 
+ cp ./INSTALL.binary tmp.i386+SCO_SV_3.2/sudo-1.6.9p23/INSTALL
 
+ cp ./INSTALL.binary tmp.i386+SCO_SV_3.2/sudo-1.6.9p23/INSTALL
Line 167: Line 177:
 
</nowiki></div>
 
</nowiki></div>
  
Obtain the missing project resources.  Apparently the binary distribution support is in process of being removed from the project. The required files are:
+
Apparently, the binary distribution support is in process of being removed from the project, so identify the most recent and applicable revisions of the missing project resources.
  
 
* [https://www.sudo.ws/repos/sudo/log?rev=Makefile.binary.in Makefile.binary.in information]
 
* [https://www.sudo.ws/repos/sudo/log?rev=Makefile.binary.in Makefile.binary.in information]
 
*: Wed, 07 Apr 2010 06:35:52 -0400        Todd C. Miller  Remove $Sudo$ tags 1.6
 
*: Wed, 07 Apr 2010 06:35:52 -0400        Todd C. Miller  Remove $Sudo$ tags 1.6
 
*:: [https://www.sudo.ws/repos/sudo/file/7aafc44a4a80/Makefile.binary.in Makefile.binary.in]
 
*:: [https://www.sudo.ws/repos/sudo/file/7aafc44a4a80/Makefile.binary.in Makefile.binary.in]
* [https://www.sudo.ws/repos/sudo/log?rev=INSTALL.binary INSTALL.binary]
+
* [https://www.sudo.ws/repos/sudo/log?rev=INSTALL.binary INSTALL.binary information]
 
*: Wed, 07 Apr 2010 06:24:08 -0400        Todd C. Miller
 
*: Wed, 07 Apr 2010 06:24:08 -0400        Todd C. Miller
 
*: Merge some things that got missed in the original cvs -> hg import 1.6
 
*: Merge some things that got missed in the original cvs -> hg import 1.6
*:: [https://www.sudo.ws/repos/sudo/file/fe5532ce4375/INSTALL.binary INSTALL.binary information]
+
*:: [https://www.sudo.ws/repos/sudo/file/fe5532ce4375/INSTALL.binary INSTALL.binary]
 +
 
 +
Download the missing files and incorporate them into the project.
  
 
<div style="background-color: #EEEEEE; border: dashed; border-width: 1px; font-family: courier; margin: 1em 2em; padding: 1ex; white-space: pre;"><nowiki>$ cd ~/src/sudo
 
<div style="background-color: #EEEEEE; border: dashed; border-width: 1px; font-family: courier; margin: 1em 2em; padding: 1ex; white-space: pre;"><nowiki>$ cd ~/src/sudo
Line 184: Line 196:
 
$ cd sudo-1.6.9p23
 
$ cd sudo-1.6.9p23
 
$ cp ../*.binary.* .
 
$ cp ../*.binary.* .
$ make bindist
+
</nowiki></div>
$ mv sudo-1.6.9p23-i386+SCO_SV_3.2.tar.gz ..
+
 
 +
Create the binary distribution tarball.
 +
 
 +
<div style="background-color: #EEEEEE; border: dashed; border-width: 1px; font-family: courier; margin: 1em 2em; padding: 1ex; white-space: pre;"><nowiki>$ make bindist
 +
$ mv sudo-1.6.9p23-i386+SCO_SV_3.2.tar.gz ../sudo-1.6.9p23-sco507-bindist.tar.gz
 +
</nowiki></div>
 +
 
 +
Create a source distribution tarball.
 +
 
 +
<div style="background-color: #EEEEEE; border: dashed; border-width: 1px; font-family: courier; margin: 1em 2em; padding: 1ex; white-space: pre;"><nowiki>$ cd ~/src/sudo/sudo-1.6.9p23
 +
$ make dist
 +
$ cd ..
 +
$ mv sudo-1.6.9p23.tar.gz sudo-1.6.9p23-sco507-dist.tar.gz
 
</nowiki></div>
 
</nowiki></div>
  

Latest revision as of 04:11, 6 July 2018

sudo for SCO OpenServer 5.0.7

See Also: 
OS-SCO-OpenSource
OS-SCO


Summary

  • sudo releases 1.7.* and 1.8.* seem to not compile as of 2018/07/02.
    Additional effort is required to find a way to resolve the build issues.
  • sudo 1.6.9p23 is the last of the 1.6.x series; the build "just worked", though creation of a .pkg file required a minor change.

Procedure

Create a workspace.

$ mkdir -p ~/src/sudo/dist $ cd ~/src/sudo

Download and unpack a source release from one of the download mirrors.

$ curl -O http://www.netgull.com/sudo/OLD/sudo-1.6.9p23.tar.gz $ gunzip sudo-1.6.9p23.tar.gz $ tar -xf sudo-1.6.9p23.tar $ cd sudo-1.6.9p23

Build the project

$ CC= CFLAGS="-static" ./configure -C --prefix="${HOME}/src/sudo/dist/usr/local" --sysconfdir="${HOME}/src/sudo/dist/etc" $ make

Snapshot the file system before `make install`.

$ su root -c "find / | sort >../sudo-1.6.9p23.before.files"

Install sudo to dist folder.

$ su root -c "make install"

Snapshot the file system after `make install`.

$ su root -c "find / | sort >../sudo-1.6.9p23.after.files"

Review the installed file list:

$ cd .. $ su chown `who am i` ../sudo-1.6.9p23.*.files $ diff ../sudo-1.6.9p23.before.files ../sudo-1.6.9p23.after.files $ find ../dist -type f

After verifying ../dist content agrees with the difference analysis (no files installed outside of the dist folder), build sudo using actual system paths.

$ CC= CFLAGS="-static" ./configure -C --prefix="/usr/local" $ make

As desired, create an archive of the essential files by installing and archiving all the pertinent files.

$ su root -c "make install" $ cd .. $ su root -c "tar -cAf sudo-1.6.9p23-sco507-bin.tar `( find dist -type f -exec echo -n '{} ' \; ; echo ) | sed -e 's/dist//g'`" $ su root -c "chown `id -un` sudo-1.6.9p23-sco507.tar" $ tar -itf sudo-1.6.9p23-sco507-bin.tar $ gzip sudo-1.6.9p23-sco507-bin.tar

Attempt creation of a .pkg distribution file.

$ cd ${HOME}/src/sudo $ mkdir -p pkg $ pkgproto `( find dist -type f -exec echo -n '{} ' \; ; echo ) | sed -e 's/dist//g'` >pkg/prototype $ cd pkg $ vim prototype $ cat prototype
!srcdir=../sudo-1.6.9p23 !bindir=$srcdir !libdir=$srcdir/.libs !mandir=$srcdir i pkginfo e sudo /etc/sudoers=$srcdir/sudoers 0440 root root f sudo share/man/man1m/sudoedit.1m=$mandir/sudo.man 0444 root root l sudo share/man/man1m/sudo.1m=share/man/man1m/sudoedit.1m f sudo share/man/man1m/visudo.1m=$mandir/visudo.man 0444 root root f sudo share/man/man4/sudoers.4=$mandir/sudoers.man 0444 root root f sudo bin/sudoedit=$bindir/sudo 4111 root root l sudo bin/sudo=bin/sudoedit f sudo sbin/visudo=$bindir/visudo 0111 root root f sudo libexec/sudo_noexec.so=$libdir/sudo_noexec.so 0755 root root
$ vim pkginfo $ cat pkginfo
PKG=sudo VERSION=1.6.9p23 PSTAMP=SYSTEMSDESIGNUSA.COM-20180705 NAME=sudo, sudoedit -- execute a command as another user DESC=sudo allows a permitted user to execute a command as the superuser or another user, as specified by security policy. ARCH=i386 BASEDIR=/usr/local VENDOR=https://www.sudo.ws/ COPYRIGHT=https://www.sudo.ws/license.html EMAIL=kevinb@systemsdesignusa.com CATEGORY=utilities CLASSES="sudo" ORDER="sudo" MAXINST=1
$ vim pkgmk.sh $ chmod 744 pkgmk.sh $ cat pkgmk.sh
eval `grep "^PKG=" ./pkginfo` eval `grep "^VERSION=" ./pkginfo` echo echo "Specify 'root' password to make '/var/spool/pkg/${PKG}'." echo su root -c "pkgmk -o" echo echo "Specify 'root' password to make '/var/spool/pkg/${PKG}-${VERSION}.pkg'." echo su root -c "pkgtrans -o -s /var/spool/pkg ${PKG}-${VERSION}-sco507.pkg sudo" echo echo "Install example:" echo " su root -c 'pkgadd ${PKG}'" echo " To install on another machine, copy ${PKG}-${VERSION}.pkg to" echo " its /var/spool/pkg first." echo echo "See Also:" echo " http://osr507doc.sco.com/en/topics/PackagSWApps.html" echo " man -a pkginfo" echo " man pkgparam" echo " man pkgproto" echo " man pkgtrans" echo " man protoype" echo " man pkgadd" echo " man pkgask" echo " man pkgchk" echo " man pkgrm" echo " man pkgmk" echo

Create the .pkg distributable file.

$ su root -c "./pkgmk.sh"

Attempt to create a binary distribution tarball using the project Makefile:

$ cd ~/src/sudo/sudo-1.6.9p23 $ make bindist ... + cp ./INSTALL.binary tmp.i386+SCO_SV_3.2/sudo-1.6.9p23/INSTALL cp: cannot access ./INSTALL.binary: No such file or directory (error 2) + sh ./config.status --file=Makefile.binary config.status: error: cannot find input file: Makefile.binary.in ...

Apparently, the binary distribution support is in process of being removed from the project, so identify the most recent and applicable revisions of the missing project resources.

Download the missing files and incorporate them into the project.

$ cd ~/src/sudo $ curl -ko Makefile.binary.in \ https://www.sudo.ws/repos/sudo/raw-file/7aafc44a4a80/Makefile.binary.in $ curl -ko Makefile.binary.in \ https://www.sudo.ws/repos/sudo/raw-file/fe5532ce4375/INSTALL.binary $ cd sudo-1.6.9p23 $ cp ../*.binary.* .

Create the binary distribution tarball.

$ make bindist $ mv sudo-1.6.9p23-i386+SCO_SV_3.2.tar.gz ../sudo-1.6.9p23-sco507-bindist.tar.gz

Create a source distribution tarball.

$ cd ~/src/sudo/sudo-1.6.9p23 $ make dist $ cd .. $ mv sudo-1.6.9p23.tar.gz sudo-1.6.9p23-sco507-dist.tar.gz