Added rc script for the Validate AuthToken service.
This commit is contained in:
		@@ -1,3 +1,8 @@
 | 
			
		||||
-------------------------------------------------------------------
 | 
			
		||||
Thu Sep 14 17:41:40 MDT 2006 - jluciani@novell.com
 | 
			
		||||
 | 
			
		||||
- Added rc script for Validate AuthToken Service. 
 | 
			
		||||
 | 
			
		||||
-------------------------------------------------------------------
 | 
			
		||||
Thu Sep 14 09:48:54 MDT 2006 - jluciani@novell.com
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -15,7 +15,7 @@ Name:           CASA_auth_token_native
 | 
			
		||||
%define debug_opt ""
 | 
			
		||||
                                                                                                                           
 | 
			
		||||
URL:            http://www.novell.com/products
 | 
			
		||||
BuildRequires:  CASA-devel apache2-devel expat gcc-c++ glib2-devel krb5-devel libgcc libgssapi libstdc++ libstdc++-devel mono-devel pam-devel pkgconfig update-alternatives java-1_5_0-ibm java-1_5_0-ibm-devel 
 | 
			
		||||
BuildRequires:  CASA-devel apache2-devel expat gcc-c++ glib2-devel krb5-devel libgcc libgssapi libstdc++ libstdc++-devel mono-devel pam-devel pkgconfig update-alternatives java-1_5_0-ibm java-1_5_0-ibm-devel java-1_5_0-ibm-alsa sysvinit insserv
 | 
			
		||||
%define prefix /usr
 | 
			
		||||
License:        LGPL
 | 
			
		||||
Group:          System/Libraries
 | 
			
		||||
@@ -26,8 +26,10 @@ Release:        1
 | 
			
		||||
Summary:        Novell CASA Authentication Token Libraries
 | 
			
		||||
Source:         %{name}-%{version}.tar.bz2
 | 
			
		||||
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 | 
			
		||||
Requires:       expat java-1_5_0-ibm CASA_auth_token_jaas_support
 | 
			
		||||
Requires:       expat binutils java-1_5_0-ibm CASA_auth_token_jaas_support sysvinit insserv
 | 
			
		||||
PreReq:         %fillup_prereq %insserv_prereq
 | 
			
		||||
PreReq:		/usr/bin/awk, /usr/bin/test, /bin/grep, /bin/cat, /usr/bin/install, /bin/pwd
 | 
			
		||||
PreReq:		/usr/sbin/groupadd, /usr/sbin/useradd, /usr/sbin/userdel, /usr/bin/getent
 | 
			
		||||
 | 
			
		||||
%description
 | 
			
		||||
CASA_auth_token is an authentication token infrastructure with support
 | 
			
		||||
@@ -162,6 +164,7 @@ install -d -m 755 %{buildroot}/var/lib/CASA/authtoken
 | 
			
		||||
install -d -m 755 %{buildroot}/var/lib/CASA/authtoken/validate
 | 
			
		||||
install -d -m 755 %{buildroot}/etc/CASA
 | 
			
		||||
install -d -m 755 %{buildroot}/etc/CASA/authtoken.d
 | 
			
		||||
install -d -m 755 %{buildroot}/etc/CASA/authtoken.d/validate.d
 | 
			
		||||
install -d -m 755 %{buildroot}/etc/CASA/authtoken.d/modules.d
 | 
			
		||||
 | 
			
		||||
## CASA_auth_token_native ##
 | 
			
		||||
@@ -182,10 +185,11 @@ ln -sf libcasa_s_ipc.so.%{bldno} %{buildroot}%{prefix}/%{_lib}/libcasa_s_ipc.so
 | 
			
		||||
ln -sf libcasa_s_ipc.so.%{bldno} %{buildroot}%{prefix}/%{_lib}/libcasa_s_ipc.so.1
 | 
			
		||||
 | 
			
		||||
# Bins
 | 
			
		||||
install -m 755 bin/%{cfg}/CasaAuthtokenValidateD %{buildroot}%{prefix}/bin/CasaAuthtokenValidateD
 | 
			
		||||
install -m 755 bin/%{cfg}/CasaAuthtokenValidateD %{buildroot}%{prefix}/bin/casa_atvd
 | 
			
		||||
 | 
			
		||||
# Others
 | 
			
		||||
install -m 644 server/AuthTokenValidate/idenTokenProviders/casa/linux/CasaIdentityToken.conf %{buildroot}/etc/CASA/authtoken.d/modules.d/CasaIdentityToken.conf
 | 
			
		||||
install -m 755 server/AuthTokenValidate/Svc/linux/CasaAuthtokenValidateD %{buildroot}/etc/init.d/casa_atvd
 | 
			
		||||
 | 
			
		||||
## CASA_auth_token_pam_support ##
 | 
			
		||||
# Libs
 | 
			
		||||
@@ -214,24 +218,131 @@ rm -rf $RPM_BUILD_ROOT
 | 
			
		||||
 | 
			
		||||
## CASA_auth_token_native ##
 | 
			
		||||
%pre
 | 
			
		||||
# Nothing to do in this pre script
 | 
			
		||||
 | 
			
		||||
# Do necessary user and group administration
 | 
			
		||||
group_present=`getent group | grep ^casaauth`
 | 
			
		||||
if [ -z "$group_present" ] ; then
 | 
			
		||||
        /usr/sbin/groupadd -r casaauth
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
user_present=`getent passwd | grep ^casaatvd`
 | 
			
		||||
if [ -z "$user_present" ] ; then
 | 
			
		||||
        /usr/sbin/useradd -c "casa_atvd System User" -s /bin/false -r -d /var/lib/CASA/authtoken/validate -g casaauth casaatvd 2> /dev/null || :
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
%post
 | 
			
		||||
/sbin/ldconfig
 | 
			
		||||
 | 
			
		||||
CAVD_ETC_DIR=/etc/CASA/authtoken.d/validate.d
 | 
			
		||||
 | 
			
		||||
setup_casa_atvd_env()
 | 
			
		||||
{
 | 
			
		||||
        # Save copy of enviroments file if it already exists
 | 
			
		||||
        if [ -f $CAVD_ETC_DIR/envvars ]; then
 | 
			
		||||
                mv $CAVD_ETC_DIR/envvars $CAVD_ETC_DIR/envvars.bak
 | 
			
		||||
        fi
 | 
			
		||||
        
 | 
			
		||||
        # Create envvars file
 | 
			
		||||
        cat > $CAVD_ETC_DIR/envvars <<!
 | 
			
		||||
############################################################
 | 
			
		||||
#                                                          #
 | 
			
		||||
# Environment variable file for casa_atvd.                 #
 | 
			
		||||
#                                                          #
 | 
			
		||||
# Note: This file is sourced by the casa_atvd rc script    #
 | 
			
		||||
# when starting the service.                               #
 | 
			
		||||
#                                                          #
 | 
			
		||||
# The following variables are utilized by the daemon       #
 | 
			
		||||
# and its rc script:                                       #
 | 
			
		||||
#                                                          #
 | 
			
		||||
#   DAEMON_NO_AUTORESTART_AFTER_CRASH -                    #
 | 
			
		||||
#                                                          #
 | 
			
		||||
#   Set this variable to "1" if you want to disable the    #
 | 
			
		||||
#   auto-restart daemon after abnormal termination         #
 | 
			
		||||
#   feature. This variable is intended to facilitate       #
 | 
			
		||||
#   the discovery of problems during quality assurance     #
 | 
			
		||||
#   testing. Disabling of the auto-restart daemon after    #
 | 
			
		||||
#   abnormal termination feature will result in a          #
 | 
			
		||||
#   configuration that is less fault tolerant.             #
 | 
			
		||||
#                                                          #
 | 
			
		||||
#   DAEMON_COREDUMPS_WANTED -                              #
 | 
			
		||||
#                                                          #
 | 
			
		||||
#   Set this variable to allow core dumps to be taken      #
 | 
			
		||||
#   when a daemon terminates abnormally. This variable     #
 | 
			
		||||
#   is only meaningful when the auto-restart daemon        #
 | 
			
		||||
#   feature mentioned above is enabled. Core dumps are     #
 | 
			
		||||
#   allowed to be taken when the auto-restart daemon       #
 | 
			
		||||
#   feature is disabled. Core dumps of novell-xsrvd        #
 | 
			
		||||
#   service processes are taken to the                     #
 | 
			
		||||
#   /var/novell/xtier folder.                              #
 | 
			
		||||
#                                                          #
 | 
			
		||||
############################################################
 | 
			
		||||
LD_LIBRARY_PATH="\${LD_LIBRARY_PATH}":/usr/lib/jvm/java-1.5.0-ibm/jre/bin:/usr/lib/jvm/java-1.5.0-ibm/jre/bin/classic
 | 
			
		||||
export LD_LIBRARY_PATH
 | 
			
		||||
!
 | 
			
		||||
        chmod +x $CAVD_ETC_DIR/envvars
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Do not run the rest of the script if this is an upgrade
 | 
			
		||||
if test "$1" != 1; then
 | 
			
		||||
	setup_casa_atvd_env
 | 
			
		||||
        exit 0
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# Create link to init.d script in /usr/sbin
 | 
			
		||||
if [ -f /usr/sbin/rccasa_atvd ] || [ -L /usr/sbin/rccasa_atvd ]; then
 | 
			
		||||
        rm -f /usr/sbin/rccasa_atvd
 | 
			
		||||
fi
 | 
			
		||||
ln -s /etc/init.d/casa_atvd /usr/sbin/rccasa_atvd
 | 
			
		||||
 | 
			
		||||
setup_casa_atvd_env
 | 
			
		||||
 | 
			
		||||
# Install casa_atvd init script
 | 
			
		||||
/usr/lib/lsb/install_initd /etc/init.d/casa_atvd
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
%preun
 | 
			
		||||
# Nothing to do in this preun script
 | 
			
		||||
 | 
			
		||||
# Do not run script if this is an install
 | 
			
		||||
if test "$1" == 1; then
 | 
			
		||||
        exit 0
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# Stop casa_atvd
 | 
			
		||||
/etc/init.d/casa_atvd stop
 | 
			
		||||
 | 
			
		||||
# Remove casa_atvd init script
 | 
			
		||||
/usr/lib/lsb/remove_initd /etc/init.d/casa_atvd
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
%postun
 | 
			
		||||
/sbin/ldconfig
 | 
			
		||||
 | 
			
		||||
# We just want to start the casa_atvd service if this is an upgrade
 | 
			
		||||
if test "$1" == 1; then
 | 
			
		||||
        /etc/init.d/casa_atvd start
 | 
			
		||||
        exit 0
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# Remove symbolic link to init.d script
 | 
			
		||||
if [ -f /usr/sbin/rccasa_atvd ] || [ -L /usr/sbin/rccasa_atvd ]; then
 | 
			
		||||
        rm -f /usr/sbin/rccasa_atvd
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# Delete the casaatvd user
 | 
			
		||||
userdel casaatvd
 | 
			
		||||
 | 
			
		||||
# Delete the var files
 | 
			
		||||
rm -rf //var/lib/CASA/authtoken/validate
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
%files
 | 
			
		||||
%defattr(-,root,root)
 | 
			
		||||
%dir /var/lib/CASA
 | 
			
		||||
%dir /var/lib/CASA/authtoken
 | 
			
		||||
%dir /var/lib/CASA/authtoken/validate
 | 
			
		||||
%dir %attr(-, casaatvd, casaauth) /var/lib/CASA/authtoken/validate
 | 
			
		||||
%dir /etc/CASA
 | 
			
		||||
%dir /etc/CASA/authtoken.d
 | 
			
		||||
%dir /etc/CASA/authtoken.d/validate.d
 | 
			
		||||
%dir /etc/CASA/authtoken.d/modules.d
 | 
			
		||||
%{prefix}/%{_lib}/libcasa_s_authtoken.so.%{bldno}
 | 
			
		||||
%{prefix}/%{_lib}/libcasa_s_authtoken.so
 | 
			
		||||
@@ -245,8 +356,9 @@ rm -rf $RPM_BUILD_ROOT
 | 
			
		||||
%{prefix}/%{_lib}/libcasa_s_ipc.so.%{bldno}
 | 
			
		||||
%{prefix}/%{_lib}/libcasa_s_ipc.so
 | 
			
		||||
%{prefix}/%{_lib}/libcasa_s_ipc.so.1
 | 
			
		||||
%{prefix}/bin/CasaAuthtokenValidateD
 | 
			
		||||
%{prefix}/bin/casa_atvd
 | 
			
		||||
/etc/CASA/authtoken.d/modules.d/CasaIdentityToken.conf
 | 
			
		||||
/etc/init.d/casa_atvd
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## CASA_auth_token_pam_support ##
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,129 @@
 | 
			
		||||
#!/bin/sh
 | 
			
		||||
#
 | 
			
		||||
# Startup script for the Casa Authtoken Validate Daemon (casa_atvd)
 | 
			
		||||
#
 | 
			
		||||
# /etc/init.d/casa_atvd
 | 
			
		||||
#
 | 
			
		||||
# description: casa_atvd validates CASA
 | 
			
		||||
# authentication tokens on behalf of native (non-java)
 | 
			
		||||
# services.
 | 
			
		||||
#
 | 
			
		||||
# processname: casa_atvd
 | 
			
		||||
# pidfile: None
 | 
			
		||||
# config utility: None
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
### BEGIN INIT INFO
 | 
			
		||||
# Provides: casa_atvd
 | 
			
		||||
# Required-Start: $local_fs
 | 
			
		||||
# Required-Stop: $local_fs $network
 | 
			
		||||
# Default-Start: 1 2 3 5
 | 
			
		||||
# Default-Stop:
 | 
			
		||||
# Short-Description: Casa Authtoken Validate Daemon
 | 
			
		||||
# Description: Start Casa Authtoken Validate Daemon
 | 
			
		||||
### END INIT INFO
 | 
			
		||||
 | 
			
		||||
. /etc/rc.status
 | 
			
		||||
 | 
			
		||||
# Shell functions sourced from /etc/rc.status:
 | 
			
		||||
#      rc_check         check and set local and overall rc status
 | 
			
		||||
#      rc_status        check and set local and overall rc status
 | 
			
		||||
#      rc_status -v     ditto but be verbose in local rc status
 | 
			
		||||
#      rc_status -v -r  ditto and clear the local rc status
 | 
			
		||||
#      rc_failed        set local and overall rc status to failed
 | 
			
		||||
#      rc_reset         clear local rc status (overall remains)
 | 
			
		||||
#      rc_exit          exit appropriate to overall rc status
 | 
			
		||||
 | 
			
		||||
# First reset status of this service
 | 
			
		||||
rc_reset
 | 
			
		||||
 | 
			
		||||
MyStatus()
 | 
			
		||||
{
 | 
			
		||||
  ps ax | grep "$DAEMON" | grep -v grep 2>&1 > /dev/null
 | 
			
		||||
  if [ "x$?" = "x0" ]; then
 | 
			
		||||
    RVAL=0
 | 
			
		||||
  else
 | 
			
		||||
    RVAL=3
 | 
			
		||||
  fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
START_DAEMON_CMD=start_daemon
 | 
			
		||||
START_DAEMON_CMD_FLAG=-u
 | 
			
		||||
STATUS=MyStatus
 | 
			
		||||
LOG_SUCCESS=log_success_msg
 | 
			
		||||
LOG_FAILURE=log_failure_msg
 | 
			
		||||
LOG_WARNING=log_warning_msg
 | 
			
		||||
ECHO=
 | 
			
		||||
 | 
			
		||||
DAEMON=/usr/bin/casa_atvd
 | 
			
		||||
DAEMON_USER=casaatvd
 | 
			
		||||
 | 
			
		||||
StartDAEMON()
 | 
			
		||||
{
 | 
			
		||||
  # Source the environments file for our daemon
 | 
			
		||||
  . /etc/CASA/authtoken.d/validate.d/envvars
 | 
			
		||||
  
 | 
			
		||||
  # Update the limit parameters
 | 
			
		||||
  #
 | 
			
		||||
  # Do not allow for unlimited core dumps if the daemon is automatically
 | 
			
		||||
  # re-starting crashed processes.
 | 
			
		||||
  if [ $DAEMON_NO_AUTORESTART_AFTER_CRASH ]; then
 | 
			
		||||
    if [ $DAEMON_NO_AUTORESTART_AFTER_CRASH -ne 0 ]; then
 | 
			
		||||
      # Feature disabled, allow core dumping.
 | 
			
		||||
      ulimit -c unlimited
 | 
			
		||||
    else
 | 
			
		||||
      # Check if core dumping is allowed with the feature enabled
 | 
			
		||||
      if [ $DAEMON_COREDUMPS_WANTED ]; then
 | 
			
		||||
        ulimit -c unlimited
 | 
			
		||||
      fi
 | 
			
		||||
    fi
 | 
			
		||||
  else    
 | 
			
		||||
    # Check if core dumping is allowed with the feature enabled
 | 
			
		||||
    if [ $DAEMON_COREDUMPS_WANTED ]; then
 | 
			
		||||
      ulimit -c unlimited
 | 
			
		||||
    fi
 | 
			
		||||
  fi
 | 
			
		||||
  
 | 
			
		||||
  ulimit -f unlimited
 | 
			
		||||
  
 | 
			
		||||
  # Start the daemon
 | 
			
		||||
  echo -n "Starting casa_atvd..."
 | 
			
		||||
  $START_DAEMON_CMD $START_DAEMON_CMD_FLAG $DAEMON_USER $DAEMON -d
 | 
			
		||||
  RVAL=$?
 | 
			
		||||
  $ECHO
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
StopDAEMON()
 | 
			
		||||
{
 | 
			
		||||
  echo -n "Stopping casa_atvd..."
 | 
			
		||||
  killproc $DAEMON
 | 
			
		||||
  RVAL=$?
 | 
			
		||||
  $ECHO
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
case "$1" in
 | 
			
		||||
start)
 | 
			
		||||
  StartDAEMON
 | 
			
		||||
  ;;
 | 
			
		||||
stop)
 | 
			
		||||
  StopDAEMON
 | 
			
		||||
  ;;
 | 
			
		||||
restart|reload|force-reload)
 | 
			
		||||
  StopDAEMON
 | 
			
		||||
  sleep 1
 | 
			
		||||
  StartDAEMON
 | 
			
		||||
  ;;
 | 
			
		||||
status)
 | 
			
		||||
  $STATUS
 | 
			
		||||
  ;;
 | 
			
		||||
*)
 | 
			
		||||
  echo -n "Usage: $0 <start|stop|restart|reload|force-reload>" > /dev/stderr
 | 
			
		||||
  RVAL=1
 | 
			
		||||
  ;;
 | 
			
		||||
esac
 | 
			
		||||
 | 
			
		||||
rc_failed $RVAL
 | 
			
		||||
rc_status -v
 | 
			
		||||
rc_exit
 | 
			
		||||
 | 
			
		||||
@@ -64,7 +64,7 @@ LDFLAGS = -L$(LIBDIR)/$(TARGET_CFG) -L$(JAVA_LIBDIR) -L$(JAVA_LIBDIR)/classic
 | 
			
		||||
OBJDIR = ./$(TARGET_CFG)/$(LIB)
 | 
			
		||||
OBJS = $(addprefix $(OBJDIR)/, $(CFILES:%.c=%.o)) $(addprefix $(OBJDIR)/, $(CPPFILES:%.cpp=%.o))
 | 
			
		||||
 | 
			
		||||
EXTRA_DIST = $(CFILES) $(CPPFILES) *.h
 | 
			
		||||
EXTRA_DIST = $(CFILES) $(CPPFILES) *.h CasaAuthtokenValidateD
 | 
			
		||||
 | 
			
		||||
CUR_DIR := $(shell pwd)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -56,8 +56,11 @@ CSFILES_CSC :=
 | 
			
		||||
INCLUDES = -I. -I.. -I$(CASAINCLUDE) -I../../../include
 | 
			
		||||
RESOURCES =
 | 
			
		||||
DEFINES = -fno-strict-aliasing 
 | 
			
		||||
if LIB64
 | 
			
		||||
DEFINES += -D_LIB64
 | 
			
		||||
endif
 | 
			
		||||
CFLAGS += $(INCLUDES) $(DEFINES)
 | 
			
		||||
LIBS = -lpthread -ldl -lexpat
 | 
			
		||||
LIBS = -lpthread -ldl
 | 
			
		||||
LDFLAGS = -Bsymbolic -shared -Wl,-soname=$(MODULE_NAME).$(MODULE_EXT) -L$(ROOT)/lib/$(TARGET_CFG)
 | 
			
		||||
 | 
			
		||||
OBJDIR = ./$(TARGET_CFG)/$(LIB)
 | 
			
		||||
 
 | 
			
		||||
@@ -48,8 +48,12 @@ pthread_mutex_t   g_hModuleMutex = PTHREAD_MUTEX_INITIALIZER;
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
// Ipc client library path
 | 
			
		||||
// 
 | 
			
		||||
//
 | 
			
		||||
#ifdef _LIB64
 | 
			
		||||
char  IpcClientLibraryPath[] = "/usr/lib64/libcasa_c_ipc.so";
 | 
			
		||||
#else
 | 
			
		||||
char  IpcClientLibraryPath[] = "/usr/lib/libcasa_c_ipc.so";
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
//++=======================================================================
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user