create core package

This commit is contained in:
aydemir
2015-02-24 11:18:35 +02:00
parent 0e4b743b82
commit 70b25d0f95
1098 changed files with 169545 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Licensed under the GNU General Public License, version 3.
# See the file http://www.gnu.org/licenses/gpl.txt
from pisi.actionsapi import autotools
from pisi.actionsapi import pisitools
from pisi.actionsapi import shelltools
from pisi.actionsapi import get
def build():
shelltools.export("LDFLAGS", "%s -Wl,-z,now" % get.LDFLAGS())
pisitools.dosed("Makefile", "gcc (\-Wall.*)", "%s \\1 %s" % (get.CC(), get.CFLAGS()))
pisitools.dosed("Makefile", "^(LDFLAGS[ \t]+=).*", "\\1 %s" % get.LDFLAGS())
autotools.make()
def install():
pisitools.doman("crontab.1", "crontab.5", "cron.8")
pisitools.dodoc("CHANGES", "CONVERSION", "FEATURES", "MAIL", "README", "THANKS")
pisitools.dosbin("cron")
pisitools.dobin("crontab")
pisitools.dodir("/var/spool/cron/crontabs")
pisitools.dodir("/etc/cron.d")
+23
View File
@@ -0,0 +1,23 @@
#!/usr/bin/python
import os
import os.path
def postInstall(fromVersion, fromRelease, toVersion, toRelease):
os.system("/bin/chown -R root:cron /var/spool/cron")
os.system("/bin/chmod -R 01730 /var/spool/cron")
os.system("/bin/chmod 0755 /etc/conf.d")
os.system("/bin/chmod 0644 /etc/pam.d/cron")
os.system("/bin/chown root:wheel /usr/sbin/cron")
os.system("/bin/chmod 0750 /usr/sbin/cron")
os.system("/bin/chown root:cron /usr/bin/crontab")
os.system("/bin/chmod 02755 /usr/bin/crontab")
crontabs = "/var/spool/cron/crontabs"
for user in os.listdir(crontabs):
os.system("/bin/chown %s:cron %s" % (user, os.path.join(crontabs, user)))
os.system("/bin/chmod 0600 %s" % os.path.join(crontabs, user))
+20
View File
@@ -0,0 +1,20 @@
from comar.service import *
serviceType = "local"
serviceDesc = _({"en": "Cron Task Scheduler",
"tr": "Cron Görev Zamanlayıcı"})
serviceDefault = "on"
@synchronized
def start():
startService(command="/usr/sbin/cron",
pidfile="/var/run/cron.pid",
donotify=True)
@synchronized
def stop():
stopService(pidfile="/var/run/cron.pid",
donotify=True)
def status():
return isServiceRunning("/var/run/cron.pid")
@@ -0,0 +1,29 @@
diff -uPr do_command.c do_command.c
--- do_command.c 2006-05-25 16:44:26.000000000 +0400
+++ do_command.c 2006-05-25 16:42:25.000000000 +0400
@@ -240,12 +240,23 @@
}
}
#else
- setgid(e->pwd->pw_gid);
+
initgroups(usernm, e->pwd->pw_gid);
#if (defined(BSD)) && (BSD >= 199103)
setlogin(usernm);
#endif /* BSD */
- setuid(e->pwd->pw_uid); /* we aren't root after this... */
+ // setuid(e->pwd->pw_uid); /* we aren't root after this... */
+
+ if ( setgid(e->pwd->pw_gid) == -1 ) {
+ fprintf(stderr,"can't set gid for %s\n", e->pwd->pw_name);
+ _exit(1);
+ }
+
+ if ( setuid(e->pwd->pw_uid) == -1 ) {
+ fprintf(stderr,"can't set uid for %s\n", e->pwd->pw_name);
+ _exit(1);
+ }
+
#endif /* LOGIN_CAP */
chdir(env_get("HOME", e->envp));
@@ -0,0 +1,11 @@
--- database.c.orig 2007-04-08 21:06:16.913019387 +0200
+++ database.c 2007-04-08 21:06:29.489736093 +0200
@@ -251,7 +251,7 @@
log_it(fname, getpid(), "WRONG FILE OWNER", tabname);
goto next_crontab;
}
- if (statbuf->st_nlink != 1) {
+ if (statbuf->st_nlink != 1 && pw != NULL) {
log_it(fname, getpid(), "BAD LINK COUNT", tabname);
goto next_crontab;
}
+7
View File
@@ -0,0 +1,7 @@
#%PAM-1.0
account required pam_unix.so
auth required pam_unix.so
session required pam_limits.so
+14
View File
@@ -0,0 +1,14 @@
# for vixie cron
# Global variables
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
# check scripts in cron.hourly, cron.daily, cron.weekly and cron.monthly
*/15 * * * * root test -x /usr/sbin/run-crons && /usr/sbin/run-crons
0 * * * * root rm -f /var/spool/cron/lastrun/cron.hourly
0 3 * * * root rm -f /var/spool/cron/lastrun/cron.daily
15 4 * * 6 root rm -f /var/spool/cron/lastrun/cron.weekly
30 5 1 * * root rm -f /var/spool/cron/lastrun/cron.monthly
@@ -0,0 +1,35 @@
--- crontab.5.orig 2004-02-19 20:40:04.954132624 +0000
+++ crontab.5 2004-02-19 20:45:27.033169168 +0000
@@ -153,6 +153,32 @@
``30 4 1,15 * 5''
would cause a command to be run at 4:30 am on the 1st and 15th of each
month, plus every Friday.
+.PP
+Instead of the first five fields, one of eight special strings may
+appear:
+.IP
+.ta 1.5i
+string meaning
+.br
+------ -------
+.br
+@reboot Run once, at startup.
+.br
+@yearly Run once a year, "0 0 1 1 *".
+.br
+@annually (same as @yearly)
+.br
+@monthly Run once a month, "0 0 1 * *".
+.br
+@weekly Run once a week, "0 0 * * 0".
+.br
+@daily Run once a day, "0 0 * * *".
+.br
+@midnight (same as @daily)
+.br
+@hourly Run once an hour, "0 * * * *".
+.br
+.fi
.SH EXAMPLE CRON FILE
.nf
@@ -0,0 +1,87 @@
#!/bin/bash
#
# Mostly copied from SuSE and Gentoo
#
# this script looks into /etc/cron.[hourly|daily|weekly|monthly]
# for scripts to be executed. The info about last run is stored in
# /var/spool/cron/lastrun
LOCKDIR=/var/spool/cron/lastrun
LOCKFILE=${LOCKDIR}/lock
mkdir -p ${LOCKDIR}
# Make sure we're not running multiple instances at once.
# Try twice to lock, otherwise give up.
for ((i = 0; i < 2; i = i + 1)); do
ln -sn $$ ${LOCKFILE} 2>/dev/null && break
# lock failed, check for a running process.
# handle both old- and new-style locking.
cronpid=$(readlink ${LOCKFILE} 2>/dev/null) ||
cronpid=$(cat ${LOCKFILE} 2>/dev/null) ||
continue # lockfile disappeared? try again
# better than kill -0 because we can verify that it's really
# another run-crons process
if [[ $(</proc/${cronpid}/cmdline) == $(</proc/$$/cmdline) ]] 2>/dev/null; then
# whoa, another process is really running
exit 0
else
rm -f ${LOCKFILE}
fi
done
# Check to make sure locking was successful
if [[ ! -L ${LOCKFILE} ]]; then
echo "Can't create or read existing ${LOCKFILE}, giving up"
exit 1
fi
# Set a trap to remove the lockfile when we're finished
trap "rm -f ${LOCKFILE}" 0 1 2 3 15
for BASE in hourly daily weekly monthly
do
CRONDIR=/etc/cron.${BASE}
test -d $CRONDIR || continue
if [ -e ${LOCKDIR}/cron.$BASE ]
then
case $BASE in
hourly)
#>= 1 hour, 5 min -=> +65 min
TIME="-cmin +65" ;;
daily)
#>= 1 day, 5 min -=> +1445 min
TIME="-cmin +1445" ;;
weekly)
#>= 1 week, 5 min -=> +10085 min
TIME="-cmin +10085" ;;
monthly)
#>= 31 days, 5 min -=> +44645 min
TIME="-cmin +44645" ;;
esac
find ${LOCKDIR} -name cron.$BASE $TIME -exec rm {} \;
fi
# if there is no touch file, make one then run the scripts
if [ ! -e ${LOCKDIR}/cron.$BASE ]
then
touch ${LOCKDIR}/cron.$BASE
set +e
for SCRIPT in $CRONDIR/*
do
if [[ -x $SCRIPT && ! -d $SCRIPT ]]; then
$SCRIPT
fi
done
fi
done
# Clean out bogus cron.$BASE files with future times
touch ${LOCKDIR}
find ${LOCKDIR} -newer ${LOCKDIR} -exec /bin/rm -f {} \;
@@ -0,0 +1,24 @@
--- vixie-cron-4.1/crontab.c.CAN-2005-1038 2005-04-14 18:39:04.356618000 -0400
+++ vixie-cron-4.1/crontab.c 2005-04-14 18:43:50.262425000 -0400
@@ -497,6 +497,21 @@
ProgramName);
goto remove;
}
+
+ if ( (!S_ISREG(statbuf.st_mode))
+ ||(S_ISLNK(statbuf.st_mode))
+ ||(S_ISDIR(statbuf.st_mode))
+ ||(S_ISCHR(statbuf.st_mode))
+ ||(S_ISBLK(statbuf.st_mode))
+ ||(S_ISFIFO(statbuf.st_mode))
+ ||(S_ISSOCK(statbuf.st_mode))
+ )
+ {
+ fprintf(stderr, "%s: illegal crontab\n",
+ ProgramName);
+ goto remove;
+ }
+
fprintf(stderr, "%s: installing new crontab\n", ProgramName);
fclose(NewCrontab);
NewCrontab=fopen(Filename,"r+");
@@ -0,0 +1,12 @@
--- entry.c 2004-08-27 20:09:34.000000000 +0200
+++ /root/entry.c 2004-09-26 14:41:46.929137000 +0200
@@ -336,7 +336,8 @@
/* If the first character of the command is '-' it is a cron option.
*/
- while ((ch = get_char(file)) == '-') {
+ ch = get_char(file);
+ while (ch == '-') {
switch (ch = get_char(file)) {
case 'q':
e->flags |= DONT_LOG;
@@ -0,0 +1,3 @@
# If for any reason you have users in the 'cron' group who should not
# be allowed to run crontab, add them to this file (one username per
# line)
@@ -0,0 +1,67 @@
--- vixie-cron-3.0.1.orig/Makefile Thu May 30 19:47:00 2002
+++ vixie-cron-3.0.1/Makefile Thu May 30 20:54:46 2002
@@ -55,7 +55,7 @@
INCLUDE = -I.
#INCLUDE =
#<<need getopt()>>
-LIBS =
+LIBS = -lpam
#<<optimize or debug?>>
OPTIM = $(RPM_OPT_FLAGS)
#OPTIM = -g
--- vixie-cron-3.0.1.orig/do_command.c Thu May 30 19:47:00 2002
+++ vixie-cron-3.0.1/do_command.c Thu May 30 20:55:50 2002
@@ -25,6 +25,18 @@
#include "cron.h"
+#include <security/pam_appl.h>
+static pam_handle_t *pamh = NULL;
+static const struct pam_conv conv = {
+ NULL
+};
+#define PAM_FAIL_CHECK if (retcode != PAM_SUCCESS) { \
+ fprintf(stderr,"\n%s\n",pam_strerror(pamh, retcode)); \
+ syslog(LOG_ERR,"%s",pam_strerror(pamh, retcode)); \
+ pam_end(pamh, retcode); exit(1); \
+ }
+
+
static void child_process(entry *, user *);
static int safe_p(const char *, const char *);
@@ -65,6 +77,7 @@
int stdin_pipe[2], stdout_pipe[2];
char *input_data, *usernm, *mailto;
int children = 0;
+ int retcode = 0;
Debug(DPROC, ("[%ld] child_process('%s')\n", (long)getpid(), e->cmd))
@@ -134,6 +147,16 @@
*p = '\0';
}
+
+ retcode = pam_start("cron", usernm, &conv, &pamh);
+ PAM_FAIL_CHECK;
+ retcode = pam_acct_mgmt(pamh, PAM_SILENT);
+ PAM_FAIL_CHECK;
+ retcode = pam_open_session(pamh, PAM_SILENT);
+ PAM_FAIL_CHECK;
+ retcode = pam_setcred(pamh, PAM_ESTABLISH_CRED | PAM_SILENT);
+ PAM_FAIL_CHECK;
+
/* fork again, this time so we can exec the user's command.
*/
switch (vfork()) {
@@ -507,6 +530,9 @@
Debug(DPROC, (", dumped core"))
Debug(DPROC, ("\n"))
}
+ pam_setcred(pamh, PAM_DELETE_CRED | PAM_SILENT);
+ retcode = pam_close_session(pamh, PAM_SILENT);
+ pam_end(pamh, retcode);
}
static int
+73
View File
@@ -0,0 +1,73 @@
<?xml version="1.0" ?>
<!DOCTYPE PISI SYSTEM "http://www.pisilinux.org/projeler/pisi/pisi-spec.dtd">
<PISI>
<Source>
<Name>vixie-cron</Name>
<Homepage>http://www.gentoo.org/</Homepage>
<Packager>
<Name>PisiLinux Community</Name>
<Email>admins@pisilinux.org</Email>
</Packager>
<License>as-is</License>
<IsA>service</IsA>
<Summary>Paul Vixie's cron daemon, a fully featured crond implementation</Summary>
<Description>Vixie cron (Cron is a daemon that runs scheduled tasks.) is a full featured cron implementation based on SysV cron. Each user has his own crontab ( Crontab (CRON TABle) is a file which contains the schedule of cron) and is allowed to specify environment variables within that crontab.</Description>
<Archive sha1sum="d8b087c0e5f7a2a9c74e3400b660756ab6d800c9" type="tarbz2">ftp://ftp.linux.org.tr/pub/gentoo/distfiles/vixie-cron-4.1.tar.bz2</Archive>
<BuildDependencies>
<Dependency>sed</Dependency>
<Dependency>pam</Dependency>
</BuildDependencies>
<Patches>
<Patch compressionType="bz2" level="1">vixie-cron-4.1-gentoo-r4.patch.bz2</Patch>
<Patch level="0">crontab.5.diff</Patch>
<Patch level="0">vixie-cron-4.1-commandline.patch</Patch>
<Patch level="1">vixie-cron-4.1-pam.patch</Patch>
<Patch level="1">vixie-cron-4.1-CAN-2005-1038.patch</Patch>
<Patch>CVE-2006-2607.patch</Patch>
<Patch>CVE-2007-1856.patch</Patch>
</Patches>
</Source>
<Package>
<Name>vixie-cron</Name>
<RuntimeDependencies>
<Dependency>pam</Dependency>
<Dependency>comar-api</Dependency>
</RuntimeDependencies>
<Files>
<Path fileType="executable">/usr/sbin</Path>
<Path fileType="executable">/usr/bin</Path>
<Path fileType="config">/etc</Path>
<Path fileType="data">/var/spool</Path>
<Path fileType="doc">/usr/share/doc</Path>
<Path fileType="man">/usr/share/man</Path>
</Files>
<AdditionalFiles>
<AdditionalFile owner="root" permission="0755" target="/usr/sbin/run-crons">run-crons-0.3.1</AdditionalFile>
<AdditionalFile owner="root" permission="0600" target="/etc/crontab">crontab</AdditionalFile>
<AdditionalFile owner="root" permission="0644" target="/etc/cron.deny">vixie-cron-4.1-cron.deny</AdditionalFile>
<AdditionalFile owner="root" permission="0644" target="/etc/pam.d/cron">cron.pam.d</AdditionalFile>
</AdditionalFiles>
<Provides>
<COMAR script="package.py">System.Package</COMAR>
<COMAR script="service.py">System.Service</COMAR>
</Provides>
</Package>
<History>
<Update release="2">
<Date>2014-05-11</Date>
<Version>4.1</Version>
<Comment>Release bump.</Comment>
<Name>Marcin Bojara</Name>
<Email>marcin@pisilinux.org</Email>
</Update>
<Update release="1">
<Date>2010-10-11</Date>
<Version>4.1</Version>
<Comment>First release</Comment>
<Name>Pisi Linux Admins</Name>
<Email>admins@pisilinux.org</Email>
</Update>
</History>
</PISI>
+9
View File
@@ -0,0 +1,9 @@
<?xml version="1.0" ?>
<PISI>
<Source>
<Name>vixie-cron</Name>
<Summary xml:lang="tr">Tam teşekküllü bir crond uyarlaması</Summary>
<Description xml:lang="tr">Vixie-cron (cron, zamanlanmış görevleri çalıştıran dinleyici programdır.) SysV cron tabanlı tam sürüm cron uygulamasıdır. Her kullanıcı kendi crontab 'ına (crontab cron listesini içeren dosyadır.) sahiptir ve bu crontab içinde ortam değişkenlerini yazmasına müsade edilmiştir.</Description>
<Description xml:lang="fr">Vixie cron (Cron est un daemon qui lance des tâches planifiées) est une implémentation riche basée sur le cron SysV. Chaque utilisateur possède sa propre table de planification (ou crontab - la CRON TABle de Crontab) est un fichier qui contient le planning de cron) et a la possibilité de spécifier des variables d'environnement au sein de la table.</Description>
</Source>
</PISI>