create core package
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
# -*- 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 shelltools
|
||||
from pisi.actionsapi import autotools
|
||||
from pisi.actionsapi import pisitools
|
||||
from pisi.actionsapi import get
|
||||
|
||||
|
||||
def build():
|
||||
# NOTE: This is only for the start-stop-daemon
|
||||
autotools.make('-C src CC="%s" LD="%s %s" CFLAGS="%s"' % (get.CC(), get.CC(), get.LDFLAGS(), get.CFLAGS()))
|
||||
|
||||
def install():
|
||||
def chmod(path, mode):
|
||||
shelltools.chmod("%s%s" % (get.installDIR(), path), mode)
|
||||
|
||||
# Install everything
|
||||
pisitools.insinto("/", "root/*")
|
||||
|
||||
# Install baselayout utilities
|
||||
shelltools.cd("src/")
|
||||
autotools.rawInstall('DESTDIR="%s"' % get.installDIR())
|
||||
|
||||
# Adjust permissions
|
||||
chmod("/tmp", 01777)
|
||||
chmod("/var/tmp", 01777)
|
||||
chmod("/run/shm", 01777)
|
||||
chmod("/var/lock", 0775)
|
||||
chmod("/usr/share/baselayout/shadow", 0600)
|
||||
|
||||
if get.ARCH() == "x86_64":
|
||||
# Directories for 32bit libraries
|
||||
pisitools.dodir("/lib32")
|
||||
pisitools.dodir("/usr/lib32")
|
||||
|
||||
# Hack for binary blobs built on multi-lib systems
|
||||
pisitools.dosym("lib", "/lib64")
|
||||
|
||||
pisitools.dosym("pisilinux-release", "/etc/system-release")
|
||||
@@ -0,0 +1,320 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import os
|
||||
import grp
|
||||
import pwd
|
||||
import shutil
|
||||
|
||||
import libuser
|
||||
|
||||
### Helper methods
|
||||
|
||||
def hav(method, *args):
|
||||
try:
|
||||
call("baselayout", "User.Manager", method, args)
|
||||
except:
|
||||
pass
|
||||
|
||||
def deleteGroup(group):
|
||||
try:
|
||||
gid = grp.getgrnam(group)[2]
|
||||
# deleteGroup(gid)
|
||||
hav("deleteGroup", gid)
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
def deleteUser(user):
|
||||
try:
|
||||
uid = pwd.getpwnam(user)[2]
|
||||
# deleteUser(uid, delete_files)
|
||||
hav("deleteUser", uid, False)
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
def setGroupId(group_name, gid):
|
||||
ctx = libuser.admin()
|
||||
group = ctx.lookupGroupByName(group_name)
|
||||
if group:
|
||||
group.set(libuser.GIDNUMBER, [gid])
|
||||
ctx.modifyGroup(group)
|
||||
|
||||
def setUserId(user_name, uid):
|
||||
ctx = libuser.admin()
|
||||
user = ctx.lookupUserByName(user_name)
|
||||
if user:
|
||||
user.set(libuser.UIDNUMBER, [uid])
|
||||
ctx.modifyUser(user)
|
||||
|
||||
def migrateUsers():
|
||||
# build user -> group map for migration (hopefully we'll drop this in 2012)
|
||||
migration = []
|
||||
migrationMap = {
|
||||
"removable" : ["cdrom", "plugdev"],
|
||||
"pnp" : ["lp", "floppy"],
|
||||
"pnpadmin" : ["lpadmin"],
|
||||
}
|
||||
for user in pwd.getpwall():
|
||||
groups = set()
|
||||
if 1000 <= user.pw_uid < 65534:
|
||||
for group in grp.getgrall():
|
||||
if user.pw_name in group.gr_mem:
|
||||
groups.add(group.gr_name)
|
||||
|
||||
for oldGroup, newGroups in migrationMap.items():
|
||||
if oldGroup in groups:
|
||||
#groups.remove(oldGroup)
|
||||
groups.update(newGroups)
|
||||
|
||||
if groups:
|
||||
migration.append((user.pw_uid, list(groups)))
|
||||
|
||||
# Migrate regular user groups
|
||||
for user, group in migration:
|
||||
# setUser(uid, realname, homedir, shell, passwd, groups)
|
||||
hav("setUser", user, "", "", "", "", group)
|
||||
|
||||
# Big ugly zemberek-openoffice hack
|
||||
def zemberek_hack():
|
||||
import re
|
||||
|
||||
f = "/var/db/comar3/scripts/System.Package/zemberek_openoffice.py"
|
||||
|
||||
if os.path.exists(f):
|
||||
postContent = open(f).read()
|
||||
pattern = re.compile('oxt"\)\[0\]$', re.M)
|
||||
postContent = re.sub(pattern, 'oxt")', postContent)
|
||||
postContent = re.sub("raise Exception", "print", postContent)
|
||||
postFile = open(f, 'w')
|
||||
postFile.write(postContent)
|
||||
|
||||
|
||||
### COMAR methods
|
||||
|
||||
|
||||
def postInstall(fromVersion, fromRelease, toVersion, toRelease):
|
||||
# We don't want to overwrite an existing file during upgrade
|
||||
specialFiles = ["passwd", "shadow", "group", "fstab", "hosts", "ld.so.conf", "resolv.conf"]
|
||||
|
||||
for specialFile in specialFiles:
|
||||
if not os.path.exists("/etc/%s" % specialFile):
|
||||
shutil.copy("/usr/share/baselayout/%s" % specialFile, "/etc")
|
||||
|
||||
shutil.copy("/etc/passwd", "/usr/share/baselayout/passwd.backup")
|
||||
shutil.copy("/etc/group", "/usr/share/baselayout/group.backup")
|
||||
|
||||
if fromRelease and int(fromRelease) < 143:
|
||||
# Release 143 starts using /etc/ld.so.conf.d. Copy ld.so.conf
|
||||
# for "include" statement.
|
||||
shutil.copy("/usr/share/baselayout/ld.so.conf", "/etc")
|
||||
|
||||
##################################
|
||||
# Merge new system groups
|
||||
# addGroup(gid, name)
|
||||
groups = (
|
||||
(7, "lp"),
|
||||
(11, "cdrom"),
|
||||
(14, "lpadmin"),
|
||||
(19, "floppy"),
|
||||
(20, "dialout"),
|
||||
(22, "sshd"),
|
||||
(30, "squid"),
|
||||
(32, "rpc"),
|
||||
#(46, "plugdev"),
|
||||
(50, "named"),
|
||||
# For systemd/var-lock.mount
|
||||
(54, "lock"),
|
||||
(60, "mysql"),
|
||||
(70, "postgres"),
|
||||
(80, "apache"),
|
||||
(90, "dovecot"),
|
||||
(100, "users"),
|
||||
(102, "hal"),
|
||||
(103, "polkitd"),
|
||||
(104, "postfix"),
|
||||
(105, "postdrop"),
|
||||
(106, "smmsp"),
|
||||
(107, "locate"),
|
||||
(108, "utmp"),
|
||||
(109, "firebird"),
|
||||
(110, "dhcp"),
|
||||
(111, "ldap"),
|
||||
(112, "clamav"),
|
||||
(113, "ntlmaps"),
|
||||
(116, "colord"),
|
||||
(120, "avahi"),
|
||||
(121, "avahi-autoipd"),
|
||||
(123, "ntp"),
|
||||
(124, "gdm"),
|
||||
(130, "tss"),
|
||||
(131, "ejabberd"),
|
||||
(132, "tomcat"),
|
||||
(133, "ups"),
|
||||
(134, "partimag"),
|
||||
(135, "radiusd"),
|
||||
(136, "oprofile"),
|
||||
(137, "mediatomb"),
|
||||
# 'pulse' is for system wide PA daemon.
|
||||
(138, "pulse"),
|
||||
# In order to access to a system wide PA daemon,
|
||||
# a user should be a member of the 'pulse-access' group.
|
||||
(139, "pulse-access"),
|
||||
(141, "italc"),
|
||||
(142, "quassel"),
|
||||
(143, "bitlbee"),
|
||||
(144, "icecast"),
|
||||
(145, "virt"),
|
||||
(995, "vboxusers"),
|
||||
# Gnokii system user for the SMS daemon
|
||||
(146, "gnokii"),
|
||||
(150, "svn"),
|
||||
(151, "memcached"),
|
||||
(152, "rtkit"),
|
||||
# NetworkManager user for OpenConnect VPN helper
|
||||
(153, "nm-openconnect"),
|
||||
(160, "usbmuxd"),
|
||||
(161, "openvpn"),
|
||||
(162, "privoxy"),
|
||||
(163, "kvm"),
|
||||
(164, "qemu"),
|
||||
(165, "kdm"),
|
||||
(166, "polipo"),
|
||||
(167, "nginx"),
|
||||
(168, "guests"),
|
||||
(169, "ntop"),
|
||||
# COMAR profile groups
|
||||
(200, "pnp"),
|
||||
(201, "removable"),
|
||||
(204, "power"),
|
||||
(205, "pnpadmin"),
|
||||
# for RT jackaudio
|
||||
(206, "jackuser"),
|
||||
(207, "wireshark"),
|
||||
(209, "vdr"),
|
||||
(210, "ecryptfs"),
|
||||
(211, "slocate"),
|
||||
(212, "dansguardian"),
|
||||
)
|
||||
|
||||
for gid, groupName in groups:
|
||||
try:
|
||||
group = grp.getgrnam(groupName)
|
||||
except KeyError:
|
||||
hav("addGroup", gid, groupName)
|
||||
else:
|
||||
if group.gr_gid != gid:
|
||||
setGroupId(groupName, gid)
|
||||
|
||||
|
||||
##################################
|
||||
# Merge new system users
|
||||
# addUser(uid, nick, realname, homedir, shell, password, groups, grantedauths, blockedauths)
|
||||
|
||||
users = (
|
||||
(4, "lp", "CUPS user", "/var/spool/cups", "/sbin/nologin", "", ["lp"], [], []),
|
||||
(15, "lpadmin", "CUPS administrator", "/var/spool/cups", "/sbin/nologin", "", ["lpadmin"], [], []),
|
||||
(20, "dialout", "Dialout", "/dev/null", "/bin/false", "", ["dialout"], [], []),
|
||||
(22, "sshd", "Privilege-separated SSH", "/var/empty/sshd", "/sbin/nologin", "", ["sshd"], [], []),
|
||||
(30, "squid", "Squid", "/var/cache/squid", "/bin/false", "", ["squid"], [], []),
|
||||
(32, "rpc", "Rpcbind daemon", "/var/lib/rpcbind", "/sbin/nologin", "", ["rpc"], [], []),
|
||||
(40, "named", "Bind", "/var/named", "/bin/false", "", ["named"], [], []),
|
||||
(60, "mysql", "MySQL", "/var/lib/mysql", "/bin/false", "", ["mysql"], [], []),
|
||||
(70, "postgres", "PostgreSQL", "/var/lib/postgresql", "/bin/false", "", ["postgres"], [], []),
|
||||
(80, "apache", "Apache", "/dev/null", "/bin/false", "", ["apache", "svn"], [], []),
|
||||
(90, "dovecot", "Dovecot", "/dev/null", "/bin/false", "", ["dovecot"], [], []),
|
||||
(102, "hal", "HAL", "/dev/null", "/bin/false", "", ["hal"], [], []),
|
||||
(103, "polkitd", "PolicyKit", "/var/lib/polkit-1", "/bin/false", "", ["polkitd"], [], []),
|
||||
(104, "postfix", "Postfix", "/var/spool/postfix", "/bin/false", "", ["postfix"], [], []),
|
||||
(106, "smmsp", "smmsp", "/var/spool/mqueue", "/bin/false", "", ["smmsp"], [], []),
|
||||
(107, "colord", "colord colour management daemon", "/var/lib/colord", "/bin/false", "", ["colord"], [], []),
|
||||
(109, "firebird", "Firebird", "/opt/firebird", "/bin/false", "", ["firebird"], [], []),
|
||||
(110, "dhcp", "DHCP", "/dev/null", "/bin/false", "", ["dhcp"], [], []),
|
||||
(111, "ldap", "OpenLDAP", "/dev/null", "/bin/false", "", ["ldap"], [], []),
|
||||
(112, "clamav", "Clamav", "/dev/null", "/bin/false", "", ["clamav"], [], []),
|
||||
(113, "ntlmaps", "NTLMaps", "/dev/null", "/bin/false", "", ["ntlmaps"], [], []),
|
||||
(120, "avahi", "Avahi mDNS/DNS-SD Stack", "/run/avahi-daemon", "/sbin/nologin", "", ["avahi"], [], []),
|
||||
(121, "avahi-autoipd", "Avahi IPv4LL Stack", "/var/lib/avahi-autoipd", "/sbin/nologin", "", ["avahi-autoipd"], [], []),
|
||||
(123, "ntp", "NTP", "/dev/null", "/bin/false", "", ["ntp"], [], []),
|
||||
(124, "gdm", "gdm", "/var/lib/gdm", "/sbin/nologin", "", ["gdm"], [], []),
|
||||
(130, "tss", "tss", "/var/lib/tpm", "/bin/false", "", ["tss"], [], []),
|
||||
(131, "ejabberd", "Ejabberd", "/var/lib/ejabberd", "/bin/false", "", ["ejabberd"], [], []),
|
||||
(132, "tomcat", "Tomcat", "/var/lib/tomcat", "/bin/false", "", ["tomcat"], [], []),
|
||||
(133, "ups", "UPS", "/var/lib/nut", "/bin/false", "", ["ups", "dialout", "tty", "pnp"], [], []),
|
||||
(134, "partimag", "Partimage", "/var/lib/partimaged", "/bin/false", "", ["partimag"], [], []),
|
||||
(135, "radiusd", "Freeradius", "/dev/null", "/bin/false", "", ["radiusd"], [], []),
|
||||
(136, "oprofile", "oprofile", "/dev/null", "/bin/false", "", ["oprofile"], [], []),
|
||||
(137, "mediatomb", "mediatomb", "/dev/null", "/bin/false", "", ["mediatomb"], [], []),
|
||||
(138, "pulse", "PulseAudio System Daemon", "/run/pulse", "/bin/false", "", ["pulse", "pulse-access", "pulse-rt", "audio"], [], []),
|
||||
(139, "quasselcore", "Quassel IRC System", "/var/cache/quassel", "/bin/false", "", ["quassel"], [], []),
|
||||
(140, "bitlbee", "Bitlbee Gateway", "/var/lib/bitlbee", "/bin/false", "", ["bitlbee"], [], []),
|
||||
(141, "spamd", "Spamassassin Daemon", "/var/lib/spamd", "/bin/false", "", [], [], []),
|
||||
(145, "vboxadd", "VirtualBox Guest Additions", "/dev/null", "/bin/false", "", [], [], []),
|
||||
(146, "gnokii", "Gnokii system user", "/", "/sbin/nologin", "", ["gnokii"], [], []),
|
||||
(150, "svn", "Subversion", "/dev/null", "/bin/false", "", ["svn"], [], []),
|
||||
(151, "icecast", "Icecast Server", "/dev/null", "/bin/false", "", ["icecast"], [], []),
|
||||
(152, "memcached", "Memcached daemon", "/run/memcached", "/bin/false", "", ["memcached"], [], []),
|
||||
(153, "rtkit", "RealtimeKit", "/proc", "/sbin/nologin", "", ["rtkit"], [], []),
|
||||
(154, "nm-openconnect", "NetworkManager user for OpenConnect", "/", "/sbin/nologin", "", ["nm-openconnect"], [], []),
|
||||
(160, "usbmuxd", "usbmuxd daemon", "/", "/sbin/nologin", "", ["usbmuxd"], [], []),
|
||||
(161, "openvpn", "OpenVPN", "/etc/openvpn", "/sbin/nologin", "", ["openvpn"], [], []),
|
||||
(162, "privoxy", "Privoxy", "/etc/privoxy", "/sbin/nologin", "", ["privoxy"], [], []),
|
||||
(163, "qemu", "qemu user", "/", "/sbin/nologin", "", ["qemu", "kvm"], [], []),
|
||||
(164, "polipo", "polipo user", "/", "/sbin/nologin", "", ["polipo"], [], []),
|
||||
(165, "kdm", "kdm", "/var", "/sbin/nologin", "", ["kdm"], [], []),
|
||||
(166, "nginx", "nginx user", "/etc/nginx", "/sbin/nologin", "", ["nginx"], [], []),
|
||||
(167, "ntop", "ntop user", "/var/lib/ntop", "/sbin/nologin", "", ["ntop"], [], []),
|
||||
(168, "smolt", "smolt user", "/dev/null", "/bin/false", "", [], [], []),
|
||||
(169, "svxlink", "Svxlink Daemon", "/", "/sbin/nologin", "", ["daemon", "audio", "dialout"], [], []),
|
||||
(170, "dansguardian", "Dansguardian web content filter", "/usr/share/dansguardian", "/sbin/nologin", "", ["dansguardian"], [], []),
|
||||
(200, "pnp", "PnP", "/dev/null", "/bin/false", "", ["pnp"], [], []),
|
||||
(250, "mpd", "Music Player Daemon", "/var/lib/mpd", "/bin/false", "", ["audio", "pulse", "pulse-access", "pulse-rt"], [], []),
|
||||
(252, "vdr", "VDR User", "/var/vdr", "/bin/false", "", ["audio", "video", "cdrom", "dialout"], [], []),
|
||||
)
|
||||
|
||||
for uid, nick, realname, homedir, shell, password, groups, grantedauths, blockedauths in users:
|
||||
try:
|
||||
user = pwd.getpwnam(nick)
|
||||
except KeyError:
|
||||
hav("addUser", uid, nick, realname, homedir, shell, password, groups, grantedauths, blockedauths)
|
||||
else:
|
||||
if user.pw_uid == uid:
|
||||
# setUser(uid, realname, homedir, shell, passwd, groups)
|
||||
hav("setUser", uid, realname, homedir, shell, password, groups)
|
||||
else:
|
||||
setUserId(nick, uid)
|
||||
|
||||
# Migrate users to their new groups if any
|
||||
migrateUsers()
|
||||
|
||||
# We should only install empty files if these files don't already exist.
|
||||
if not os.path.exists("/var/log/lastlog"):
|
||||
os.system("/bin/touch /var/log/lastlog")
|
||||
|
||||
if not os.path.exists("/run/utmp"):
|
||||
os.system("/usr/bin/install -m 0664 -g utmp /dev/null /run/utmp")
|
||||
|
||||
if not os.path.exists("/var/log/wtmp"):
|
||||
os.system("/usr/bin/install -m 0664 -g utmp /dev/null /var/log/wtmp")
|
||||
|
||||
# Enable shadow groups
|
||||
os.system("/usr/sbin/grpconv")
|
||||
os.system("/usr/sbin/grpck -r &>/dev/null")
|
||||
|
||||
# Create /root if not exists
|
||||
if not os.path.exists("/root/"):
|
||||
shutil.copytree("/etc/skel", "/root")
|
||||
os.chown("/root", 0, 0)
|
||||
os.chmod("/root", 0700)
|
||||
|
||||
# Tell init to reload new inittab
|
||||
os.system("/sbin/telinit q")
|
||||
|
||||
# Save user defined DNS
|
||||
if not os.access("/etc/resolv.default.conf", os.R_OK):
|
||||
os.system("cp /etc/resolv.conf /etc/resolv.default.conf")
|
||||
|
||||
# Apply zemberek hack
|
||||
zemberek_hack()
|
||||
|
||||
# Fix permissions of /var/lock folder
|
||||
os.chown("/var/lock", 0, 54)
|
||||
os.chmod("/var/lock", 0775)
|
||||
@@ -0,0 +1,33 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
def update_ld_so_cache(filepath):
|
||||
import glob
|
||||
import piksemel
|
||||
import subprocess
|
||||
|
||||
libdirs = []
|
||||
|
||||
for config_file in glob.glob("/etc/ld.so.conf.d/*.conf"):
|
||||
for line in open(config_file):
|
||||
line = line.strip()
|
||||
if line.startswith("/"):
|
||||
libdirs.append(line[1:])
|
||||
|
||||
libdirs = tuple(libdirs)
|
||||
|
||||
doc = piksemel.parse(filepath)
|
||||
for item in doc.tags("File"):
|
||||
path = item.getTagData("Path")
|
||||
if path.startswith(libdirs):
|
||||
subprocess.call(["/sbin/ldconfig", "-X"])
|
||||
return
|
||||
|
||||
def setupPackage(metapath, filepath):
|
||||
update_ld_so_cache(filepath)
|
||||
|
||||
def cleanupPackage(metapath, filepath):
|
||||
pass
|
||||
|
||||
def postCleanupPackage(metapath, filepath):
|
||||
update_ld_so_cache(filepath)
|
||||
@@ -0,0 +1,174 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import string
|
||||
import subprocess
|
||||
|
||||
# Translations
|
||||
|
||||
MSG_HOSTNAME = {
|
||||
"en": "Hostname contains invalid characters: '%s'",
|
||||
"tr": "Makine ismi geçersiz karakterler içeriyor: '%s'",
|
||||
"fr": "Le nom d'hôte contient des caractères invalides: '%s'",
|
||||
"nl": "Hostnaam bevat ongeldige lettertekens: '%s'",
|
||||
}
|
||||
|
||||
# Translations End
|
||||
|
||||
HEADER_DEFAULT = """# Default DNS settings
|
||||
#
|
||||
"""
|
||||
|
||||
HEADER_DYNAMIC = """# This file is automatically generated by COMAR
|
||||
# Use network-manager to set default DNS settings or edit "resolv.default.conf"
|
||||
#
|
||||
# Bu dosya COMAR tarafından otomatik olarak üretilir.
|
||||
# Öntanımlı DNS ayalarını değiştirmek için network-manager uygulamasını kullanın
|
||||
# veya "resolv.default.conf" dosyasını düzenleyin.
|
||||
#
|
||||
"""
|
||||
|
||||
MAX_SERVERS = 3
|
||||
|
||||
HOST_CHARS = string.ascii_letters + string.digits + '.' + '_' + '-'
|
||||
NAME_PATH = "/etc/env.d/01hostname"
|
||||
CMD_ENV = "/sbin/update-environment"
|
||||
HOSTS_PATH = "/etc/hosts"
|
||||
|
||||
RESOLV_USER = "/etc/resolv.default.conf"
|
||||
RESOLV_PISILINUX = "/usr/share/baselayout/resolv.conf"
|
||||
|
||||
def getSearchDomain():
|
||||
if not os.access(RESOLV_USER, os.R_OK):
|
||||
return None
|
||||
for line in file(RESOLV_USER):
|
||||
line = line.strip()
|
||||
if line.startswith("search"):
|
||||
return line.split()[1]
|
||||
return None
|
||||
|
||||
def getPisiLinuxNameServers():
|
||||
servers = []
|
||||
if not os.access(RESOLV_PISILINUX, os.R_OK):
|
||||
return servers
|
||||
for line in file(RESOLV_PISILINUX):
|
||||
line = line.strip()
|
||||
if line.startswith("nameserver"):
|
||||
ip = line.split()[1]
|
||||
if ip not in servers:
|
||||
servers.append(ip)
|
||||
return servers
|
||||
|
||||
# Network.Stack methods
|
||||
|
||||
def getNameServers():
|
||||
servers = []
|
||||
if not os.access(RESOLV_USER, os.R_OK):
|
||||
return servers
|
||||
for line in file(RESOLV_USER):
|
||||
line = line.strip()
|
||||
if line.startswith("nameserver"):
|
||||
ip = line.split()[1]
|
||||
if ip not in servers:
|
||||
servers.append(ip)
|
||||
return servers
|
||||
|
||||
def setNameServers(nameservers, searchdomain):
|
||||
f = file("/etc/resolv.default.conf", "w")
|
||||
f.write(HEADER_DEFAULT)
|
||||
|
||||
for server in nameservers:
|
||||
f.write("nameserver %s\n" % server)
|
||||
|
||||
if searchdomain:
|
||||
f.write("searchdomain %s\n" % searchdomain)
|
||||
|
||||
f.close()
|
||||
|
||||
def useNameServers(nameservers, searchdomain):
|
||||
# Append default name servers
|
||||
nameservers.extend(getNameServers())
|
||||
nameservers.extend(getPisiLinuxNameServers())
|
||||
|
||||
servers = []
|
||||
for server in nameservers:
|
||||
if server not in servers:
|
||||
servers.append(server)
|
||||
|
||||
f = file("/etc/resolv.conf", "w")
|
||||
f.write(HEADER_DYNAMIC)
|
||||
|
||||
for server in servers[:MAX_SERVERS]:
|
||||
f.write("nameserver %s\n" % server)
|
||||
|
||||
if searchdomain:
|
||||
f.write("search %s\n" % searchdomain)
|
||||
elif getSearchDomain():
|
||||
f.write("search %s\n" % getSearchDomain())
|
||||
|
||||
f.close()
|
||||
|
||||
def registerNameServers(iface, nameservers, searchdomain):
|
||||
useNameServers(nameservers, searchdomain)
|
||||
|
||||
def unregisterNameServers(iface, nameservers, searchdomain):
|
||||
# Remove nameservers from list
|
||||
nameservers = getNameServers()
|
||||
for server in nameservers:
|
||||
try:
|
||||
nameservers.remove(server)
|
||||
except ValueError:
|
||||
pass
|
||||
# Set search domain to "" if it's active one
|
||||
if searchdomain == getSearchDomain():
|
||||
searchdomain = ""
|
||||
useNameServers(nameservers, searchdomain)
|
||||
|
||||
def flushNameCache():
|
||||
pass
|
||||
|
||||
def getHostName():
|
||||
cmd = subprocess.Popen(["/usr/bin/hostname"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
a = cmd.communicate()
|
||||
if a[1] == "":
|
||||
return a[0].rstrip("\n")
|
||||
return ""
|
||||
|
||||
def setHostName(hostname):
|
||||
if not hostname:
|
||||
return
|
||||
invalid = filter(lambda x: not x in HOST_CHARS, hostname)
|
||||
if len(invalid) > 0:
|
||||
fail(_(MSG_HOSTNAME) % ("".join(invalid)))
|
||||
|
||||
# hostname
|
||||
if os.path.exists(NAME_PATH):
|
||||
import re
|
||||
f = file(NAME_PATH)
|
||||
data = f.read()
|
||||
f.close()
|
||||
data = re.sub('HOSTNAME="(.*)"', 'HOSTNAME="%s"' % hostname, data)
|
||||
else:
|
||||
data = 'HOSTNAME="%s"\n' % hostname
|
||||
f = file(NAME_PATH, "w")
|
||||
f.write(data)
|
||||
f.close()
|
||||
|
||||
# hosts
|
||||
f = file(HOSTS_PATH)
|
||||
data = f.readlines()
|
||||
f.close()
|
||||
f = file(HOSTS_PATH, "w")
|
||||
flag = 1
|
||||
for line in data:
|
||||
if line.startswith("127.0.0.1"):
|
||||
line = "127.0.0.1 localhost %s\n" % hostname
|
||||
flag = 0
|
||||
f.write(line)
|
||||
if flag:
|
||||
f.write("127.0.0.1 localhost %s\n" % hostname)
|
||||
f.close()
|
||||
|
||||
# update environment
|
||||
os.system(CMD_ENV)
|
||||
@@ -0,0 +1,690 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2006-2010 TUBITAK/UEKAE
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify it under
|
||||
# the terms of the GNU General Public License as published by the Free
|
||||
# Software Foundation; either version 2 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
|
||||
import os
|
||||
import glob
|
||||
import fcntl
|
||||
import random
|
||||
import shutil
|
||||
import hashlib
|
||||
|
||||
from string import ascii_letters, digits
|
||||
from pardus.fileutils import FileLock
|
||||
|
||||
try:
|
||||
import polkit
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
|
||||
# faces
|
||||
|
||||
FACES = [
|
||||
"/usr/share/kde4/apps/kdm/pics/users",
|
||||
]
|
||||
|
||||
# messages
|
||||
|
||||
invalid_username_msg = {
|
||||
"en": "User name is invalid.",
|
||||
"tr": "Kullanıcı adı geçersiz.",
|
||||
"fr": "Nom d'utilisateur invalide.",
|
||||
"es": "Nombre de usuario no es válido.",
|
||||
"de": "Benutzername nicht erlaubt.",
|
||||
"nl": "Gebruikernaam is ongeldig.",
|
||||
}
|
||||
|
||||
invalid_realname_msg = {
|
||||
"en": "Real name is invalid.",
|
||||
"tr": "Gerçek isim geçersiz.",
|
||||
"fr": "Nom réel invalide.",
|
||||
"es": "Nombre real no es válido.",
|
||||
"de": "Dieser vollständige Name ist nicht erlaubt.",
|
||||
"nl": "Echte naam is ongeldig.",
|
||||
}
|
||||
|
||||
short_password_msg = {
|
||||
"en": "Password is too short.",
|
||||
"tr": "Parola çok kısa.",
|
||||
"fr": "Mot de passe trop court.",
|
||||
"es": "Contraseña es demadiado corta.",
|
||||
"de": "Passwort ist zu kurz.",
|
||||
"nl": "Wachtwoord is te kort.",
|
||||
}
|
||||
|
||||
name_password_msg = {
|
||||
"en": "Dont use your name as a password.",
|
||||
"tr": "Adınızı parola olarak kullanmayın.",
|
||||
"fr": "N'utilisez pas votre nom comme mot de passe.",
|
||||
"es": "No use su nombre como contraseña.",
|
||||
"de": "Benutzen Sie nicht Ihren Namen als Passwort.",
|
||||
"nl": "Uw naam niet als wachtwoord gebruiken.",
|
||||
}
|
||||
|
||||
invalid_group_msg = {
|
||||
"en": "Invalid group name:",
|
||||
"tr": "Geçersiz grup adı:",
|
||||
"fr": "Nom de groupe invalide:",
|
||||
"es": "Nombre de grupo inválido:",
|
||||
"de": "Gruppenname nicht erlaubt:",
|
||||
"nl": "Ongeldige groepnaam:",
|
||||
}
|
||||
|
||||
invalid_userid_msg = {
|
||||
"en": "Invalid user ID.",
|
||||
"tr": "Geçersiz kullanıcı numarası.",
|
||||
"fr": "Identifiant utilisateur invalide.",
|
||||
"es": "ID de usuario no válido.",
|
||||
"de": "User-ID nicht erlaubt.",
|
||||
"nl": "Gebruiker-id is ongeldig.",
|
||||
}
|
||||
|
||||
used_userid_msg = {
|
||||
"en": "This user ID is already used.",
|
||||
"tr": "Bu kullanıcı numarası zaten kullanılmakta.",
|
||||
"fr": "Cet identifiant utilisateur est déjà utilisé.",
|
||||
"es": "Este ID de usuario ya está en uso.",
|
||||
"de": "Dieser user-ID is schon vergeben.",
|
||||
"nl": "Deze gebruiker-id is reeds in gebruik.",
|
||||
}
|
||||
|
||||
used_username_msg = {
|
||||
"en": "This user name is already used.",
|
||||
"tr": "Bu kullanıcı adı zaten kullanılmakta.",
|
||||
"fr": "Ce nom d'utilisateur est déjà utilisé.",
|
||||
"es": "Este nombre de usuario ya está en uso.",
|
||||
"de": "Dieser Benutzername is schon vergeben.",
|
||||
"nl": "Deze gebruikernaam is reeds in gebruik.",
|
||||
}
|
||||
|
||||
no_group_msg = {
|
||||
"en": "No such group exists.",
|
||||
"tr": "Böyle bir grup yok.",
|
||||
"fr": "Il n'existe aucun groupe de ce nom-là.",
|
||||
"es": "No existe el grupo.",
|
||||
"de": "Diese Gruppe gibt es nicht.",
|
||||
"nl": "Deze groep bestaat niet.",
|
||||
}
|
||||
|
||||
no_user_msg = {
|
||||
"en": "No user with given ID.",
|
||||
"tr": "Verilen numaralı bir kullanıcı yok.",
|
||||
"fr": "Il n'existe aucun utilisateur avec et identifiant.",
|
||||
"es": "No existe usuario con éste ID.",
|
||||
"de": "Es gibt keien Benutzer mit dem angegebenen ID.",
|
||||
"nl": "Gebruiker met opgegeven ID bestaat niet.",
|
||||
}
|
||||
|
||||
delete_root_msg = {
|
||||
"en": "You cant delete root user.",
|
||||
"tr": "Kök kullanıcıyı silemezsiniz.",
|
||||
"fr": "Vous ne pouvez pas supprimer l'administrateur.",
|
||||
"es": "No se puede eliminar al usuario root.",
|
||||
"de": "Benutzer ROOT darf nicht gelöscht werden.",
|
||||
"nl": "Systeembeheerder (root) kan niet verwijderd worden.",
|
||||
}
|
||||
|
||||
invalid_groupid_msg = {
|
||||
"en": "Invalid group ID.",
|
||||
"tr": "Geçersiz grup numarası.",
|
||||
"fr": "Identifiant de groupe invalide.",
|
||||
"es": "ID del grupo inválido.",
|
||||
"de": "Gruppen-ID nicht zulässig.",
|
||||
"nl": "Groep-ID is ongeldig.",
|
||||
}
|
||||
|
||||
used_groupid_msg = {
|
||||
"en": "This group ID is already used.",
|
||||
"tr": "Bu grup numarası zaten kullanılmakta.",
|
||||
"fr": "Cet identifiant de groupe est déjà utilisé.",
|
||||
"es": "Este ID de grupo ya está en uso.",
|
||||
"de": "Dieser Gruppen-ID is schon vergeben.",
|
||||
"nl": "Deze groep-ID is reeds in gebruik.",
|
||||
}
|
||||
|
||||
used_groupname_msg = {
|
||||
"en": "This group name is already used.",
|
||||
"tr": "Bu grup adı zaten kullanılmakta.",
|
||||
"fr": "Ce nom de groupe est déjà utilisé.",
|
||||
"es": "Este nombre de grupo ya está en uso.",
|
||||
"de": "Dieser Gruppennam is schon vergeben.",
|
||||
"nl": "Deze groepnaam is reeds in gebruik.",
|
||||
}
|
||||
|
||||
# parameters
|
||||
uid_minimum = 1000
|
||||
uid_maximum = 65000
|
||||
|
||||
#
|
||||
|
||||
def setFace(uid, homedir):
|
||||
files = []
|
||||
for directory in FACES:
|
||||
if os.path.exists(directory):
|
||||
for filename in os.listdir(directory):
|
||||
if filename.endswith(".png"):
|
||||
files.append(os.path.join(directory, filename))
|
||||
if len(files):
|
||||
icon = os.path.join(homedir, ".face.icon")
|
||||
shutil.copy(random.choice(files), icon)
|
||||
os.chmod(icon, 0644)
|
||||
os.chown(icon, uid, 100)
|
||||
|
||||
def checkName(name):
|
||||
first_valid = ascii_letters
|
||||
valid = ascii_letters + "_-" + digits
|
||||
if len(name) == 0 or len(filter(lambda x: not x in valid, name)) != 0 or not name[0] in first_valid:
|
||||
fail(_(invalid_username_msg))
|
||||
|
||||
def checkRealName(realname):
|
||||
if len(filter(lambda x: x == "\n" or x == ":", realname)) != 0:
|
||||
fail(_(invalid_realname_msg))
|
||||
|
||||
def checkPassword(password, badlist):
|
||||
if len(password) < 1:
|
||||
fail(_(short_password_msg))
|
||||
if password in badlist:
|
||||
fail(_(name_password_msg))
|
||||
|
||||
def checkGroupName(name):
|
||||
valid = ascii_letters + "_-"
|
||||
if name == "" or len(filter(lambda x: not x in valid, name)) != 0:
|
||||
fail(_(invalid_group_msg) + " " + name)
|
||||
|
||||
#
|
||||
|
||||
class User:
|
||||
def __init__(self):
|
||||
self.password = None
|
||||
|
||||
def __str__(self):
|
||||
return "%s (%d, %d)\n %s\n %s\n %s\n %s" % (
|
||||
self.name, self.uid, self.gid,
|
||||
self.realname, self.homedir, self.shell,
|
||||
self.password
|
||||
)
|
||||
|
||||
|
||||
class Group:
|
||||
def __str__(self):
|
||||
s = "%s (%d)" % (self.name, self.gid)
|
||||
for name in self.members:
|
||||
s += "\n %s" % name
|
||||
return s
|
||||
|
||||
|
||||
class Database:
|
||||
passwd_path = "/etc/passwd"
|
||||
shadow_path = "/etc/shadow"
|
||||
group_path = "/etc/group"
|
||||
lock_path = "/etc/.pwd.lock"
|
||||
|
||||
def __init__(self, for_read=False):
|
||||
self.lock = FileLock(self.lock_path)
|
||||
self.lock.lock(shared=for_read)
|
||||
|
||||
self.users = {}
|
||||
self.users_by_name = {}
|
||||
self.groups = {}
|
||||
self.groups_by_name = {}
|
||||
|
||||
for line in file(self.passwd_path):
|
||||
if line != "" and line != "\n":
|
||||
parts = line.rstrip("\n").split(":")
|
||||
user = User()
|
||||
user.name = parts[0]
|
||||
user.uid = int(parts[2])
|
||||
user.gid = int(parts[3])
|
||||
user.realname = parts[4]
|
||||
user.homedir = parts[5]
|
||||
user.shell = parts[6]
|
||||
self.users[user.uid] = user
|
||||
self.users_by_name[user.name] = user
|
||||
|
||||
for line in file(self.shadow_path):
|
||||
if line != "" and line != "\n":
|
||||
parts = line.rstrip("\n").split(":")
|
||||
if self.users_by_name.has_key(parts[0]):
|
||||
user = self.users_by_name[parts[0]]
|
||||
user.password = parts[1]
|
||||
user.pwrest = parts[2:]
|
||||
|
||||
for line in file(self.group_path):
|
||||
if line != "" and line != "\n":
|
||||
parts = line.rstrip("\n").split(":")
|
||||
group = Group()
|
||||
group.name = parts[0]
|
||||
group.gid = int(parts[2])
|
||||
group.members = parts[3].split(",")
|
||||
if "" in group.members:
|
||||
group.members.remove("")
|
||||
self.groups[group.gid] = group
|
||||
self.groups_by_name[group.name] = group
|
||||
|
||||
def sync(self):
|
||||
lines = []
|
||||
keys = self.users.keys()
|
||||
keys.sort()
|
||||
for uid in keys:
|
||||
user = self.users[uid]
|
||||
lines.append("%s:x:%d:%d:%s:%s:%s\n" % (
|
||||
user.name, uid, user.gid,
|
||||
user.realname, user.homedir, user.shell
|
||||
))
|
||||
f = file(self.passwd_path, "w")
|
||||
f.writelines(lines)
|
||||
f.close()
|
||||
|
||||
lines = []
|
||||
keys = self.users.keys()
|
||||
keys.sort()
|
||||
for uid in keys:
|
||||
user = self.users[uid]
|
||||
if user.password:
|
||||
lines.append("%s:%s:%s\n" % (
|
||||
user.name,
|
||||
user.password,
|
||||
":".join(user.pwrest)
|
||||
))
|
||||
else:
|
||||
lines.append("%s::13094:0:99999:7:::\n" % user.name)
|
||||
f = file(self.shadow_path, "w")
|
||||
f.writelines(lines)
|
||||
f.close()
|
||||
|
||||
lines = []
|
||||
keys = self.groups.keys()
|
||||
keys.sort()
|
||||
for gid in keys:
|
||||
group = self.groups[gid]
|
||||
lines.append("%s:x:%s:%s\n" % (group.name, gid, ",".join(group.members)))
|
||||
f = file(self.group_path, "w")
|
||||
f.writelines(lines)
|
||||
f.close()
|
||||
|
||||
def set_groups(self, name, grouplist):
|
||||
for gid in self.groups.keys():
|
||||
g = self.groups[gid]
|
||||
if name in g.members:
|
||||
if not g.name in grouplist:
|
||||
g.members.remove(name)
|
||||
else:
|
||||
if g.name in grouplist:
|
||||
g.members.append(name)
|
||||
|
||||
def next_uid(self):
|
||||
for i in range(uid_minimum, uid_maximum):
|
||||
if not self.users.has_key(i):
|
||||
return i
|
||||
|
||||
def next_gid(self):
|
||||
for i in range(uid_minimum, uid_maximum):
|
||||
if not self.groups.has_key(i):
|
||||
return i
|
||||
|
||||
|
||||
def setup_home(uid, gid, path):
|
||||
if not os.path.exists(path):
|
||||
# Copy skeleton home dir
|
||||
os.system('/bin/cp -r %s "%s"' % ('/etc/skel', path))
|
||||
# Set a random face icon
|
||||
faces = glob.glob("/usr/share/*/apps/kdm/pics/users/*.png")
|
||||
if len(faces) > 0:
|
||||
facepath = os.path.join(path, '.face.icon')
|
||||
os.system('/bin/cp --remove-destination "%s" "%s"' % (random.choice(faces), facepath))
|
||||
os.chmod(facepath, 0644)
|
||||
# Set ownerships
|
||||
os.system('/bin/chown -R %d:%d "%s"' % (uid, gid, path))
|
||||
|
||||
# Make sure at least top of the home dir's permissions are correct
|
||||
os.system('/bin/chown %d:%d "%s"' % (uid, gid, path))
|
||||
os.chmod(path, 0711)
|
||||
|
||||
|
||||
# methods
|
||||
|
||||
def userList():
|
||||
def format(dict, uid):
|
||||
item = dict[uid]
|
||||
return (item.uid, item.name, item.realname)
|
||||
db = Database(for_read=True)
|
||||
return map(lambda x: format(db.users, x), db.users)
|
||||
|
||||
def userInfo(uid):
|
||||
uid = int(uid)
|
||||
db = Database(for_read=True)
|
||||
if db.users.has_key(uid):
|
||||
u = db.users[uid]
|
||||
groups = []
|
||||
for item in db.groups.keys():
|
||||
if u.name in db.groups[item].members:
|
||||
groups.append(db.groups[item].name)
|
||||
grp = db.groups.get(u.gid, None)
|
||||
if grp:
|
||||
if grp.name in groups:
|
||||
groups.remove(grp.name)
|
||||
groups.insert(0, grp.name)
|
||||
ret = (
|
||||
u.name,
|
||||
u.realname,
|
||||
u.gid,
|
||||
u.homedir,
|
||||
u.shell,
|
||||
groups,
|
||||
)
|
||||
return ret
|
||||
else:
|
||||
fail(_(no_user_msg))
|
||||
|
||||
def addUser(uid, name, realname, homedir, shell, password, groups, grants, blocks):
|
||||
if not realname:
|
||||
realname = ""
|
||||
if not homedir:
|
||||
homedir = "/home/" + name
|
||||
if not shell:
|
||||
shell = "/bin/bash"
|
||||
if not groups:
|
||||
groups = ["nogroup"]
|
||||
for item in groups:
|
||||
checkGroupName(item)
|
||||
checkName(name)
|
||||
checkRealName(realname)
|
||||
if password:
|
||||
checkPassword(password, (name, realname))
|
||||
|
||||
db = Database()
|
||||
|
||||
if uid == -1:
|
||||
uid = db.next_uid()
|
||||
else:
|
||||
try:
|
||||
uid = int(uid)
|
||||
if uid < 0 or uid > 65536:
|
||||
raise
|
||||
except:
|
||||
fail(_(invalid_userid_msg))
|
||||
if db.users.has_key(uid):
|
||||
fail(_(used_userid_msg))
|
||||
|
||||
if db.users_by_name.has_key(name):
|
||||
fail(_(used_username_msg))
|
||||
|
||||
# First group in the list is the user's main group
|
||||
g = db.groups_by_name.get(groups[0], None)
|
||||
if not g:
|
||||
fail(_(no_group_msg))
|
||||
gid = g.gid
|
||||
|
||||
u = User()
|
||||
u.uid = uid
|
||||
u.gid = gid
|
||||
u.name = name
|
||||
u.realname = realname
|
||||
u.homedir = homedir
|
||||
u.shell = shell
|
||||
if password:
|
||||
u.password = shadowCrypt(password)
|
||||
else:
|
||||
u.password = "*"
|
||||
u.pwrest = [ "13094", "0", "99999", "7", "", "", "" ]
|
||||
db.users[uid] = u
|
||||
db.set_groups(name, groups)
|
||||
# No need to setup a real home dir for daemons
|
||||
if uid >= 1000 or homedir.startswith("/home/"):
|
||||
setup_home(uid, gid, homedir)
|
||||
setFace(uid, homedir)
|
||||
db.sync()
|
||||
|
||||
for grant in grants:
|
||||
if grant != "":
|
||||
grantAuthorization(uid, grant)
|
||||
for block in blocks:
|
||||
if block != "":
|
||||
blockAuthorization(uid, block)
|
||||
|
||||
return uid
|
||||
|
||||
def setUser(uid, realname, homedir, shell, password, groups):
|
||||
uid = int(uid)
|
||||
|
||||
db = Database()
|
||||
u = db.users.get(uid, None)
|
||||
if u:
|
||||
if realname:
|
||||
checkRealName(realname)
|
||||
u.realname = realname
|
||||
if homedir:
|
||||
u.homedir = homedir
|
||||
if shell:
|
||||
u.shell = shell
|
||||
if password:
|
||||
checkPassword(password, (u.name, u.realname, realname))
|
||||
u.password = shadowCrypt(password)
|
||||
if groups:
|
||||
# FIXME: check main group
|
||||
for item in groups:
|
||||
checkGroupName(item)
|
||||
db.set_groups(u.name, groups)
|
||||
db.sync()
|
||||
else:
|
||||
fail(_(no_user_msg))
|
||||
|
||||
def deleteUser(uid, deletefiles):
|
||||
uid = int(uid)
|
||||
|
||||
if uid == 0:
|
||||
fail(_(delete_root_msg))
|
||||
|
||||
db = Database()
|
||||
u = db.users.get(uid, None)
|
||||
if u:
|
||||
#delete authorizations of user
|
||||
try:
|
||||
polkit.auth_revoke_all(uid)
|
||||
except:
|
||||
pass
|
||||
|
||||
home = u.homedir[:]
|
||||
db.set_groups(u.name, [])
|
||||
del db.users[uid]
|
||||
db.sync()
|
||||
if deletefiles:
|
||||
os.system('/bin/rm -rf "%s"' % home)
|
||||
|
||||
|
||||
def groupList():
|
||||
def format(dict, gid):
|
||||
item = dict[gid]
|
||||
return (item.gid, item.name)
|
||||
db = Database(for_read=True)
|
||||
return map(lambda x: format(db.groups, x), db.groups)
|
||||
|
||||
def addGroup(gid, name):
|
||||
checkGroupName(name)
|
||||
|
||||
db = Database()
|
||||
if gid == -1:
|
||||
gid = db.next_gid()
|
||||
else:
|
||||
try:
|
||||
gid = int(gid)
|
||||
if gid < 0 or gid > 65536:
|
||||
raise
|
||||
except:
|
||||
fail(_(invalid_groupid_msg))
|
||||
if db.groups.has_key(gid):
|
||||
fail(_(used_groupid_msg))
|
||||
|
||||
if db.groups_by_name.has_key(name):
|
||||
fail(_(used_groupname_msg))
|
||||
|
||||
g = Group()
|
||||
g.gid = gid
|
||||
g.name = name
|
||||
g.members = []
|
||||
db.groups[gid] = g
|
||||
db.sync()
|
||||
|
||||
return gid
|
||||
|
||||
def deleteGroup(gid):
|
||||
gid = int(gid)
|
||||
|
||||
db = Database()
|
||||
if db.groups.has_key(gid):
|
||||
del db.groups[gid]
|
||||
db.sync()
|
||||
|
||||
|
||||
#
|
||||
# Crypt function for shadow file
|
||||
#
|
||||
|
||||
def shadowCrypt(password):
|
||||
des_salt = list('./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz')
|
||||
salt, magic = str(random.random())[-8:], '$1$'
|
||||
|
||||
ctx = hashlib.md5(password)
|
||||
ctx.update(magic)
|
||||
ctx.update(salt)
|
||||
|
||||
ctx1 = hashlib.md5(password)
|
||||
ctx1.update(salt)
|
||||
ctx1.update(password)
|
||||
|
||||
final = ctx1.digest()
|
||||
|
||||
for i in range(len(password), 0 , -16):
|
||||
if i > 16:
|
||||
ctx.update(final)
|
||||
else:
|
||||
ctx.update(final[:i])
|
||||
|
||||
i = len(password)
|
||||
|
||||
while i:
|
||||
if i & 1:
|
||||
ctx.update('\0')
|
||||
else:
|
||||
ctx.update(password[:1])
|
||||
i = i >> 1
|
||||
final = ctx.digest()
|
||||
|
||||
for i in range(1000):
|
||||
ctx1 = hashlib.md5()
|
||||
if i & 1:
|
||||
ctx1.update(password)
|
||||
else:
|
||||
ctx1.update(final)
|
||||
if i % 3: ctx1.update(salt)
|
||||
if i % 7: ctx1.update(password)
|
||||
if i & 1:
|
||||
ctx1.update(final)
|
||||
else:
|
||||
ctx1.update(password)
|
||||
final = ctx1.digest()
|
||||
|
||||
def _to64(v, n):
|
||||
r = ''
|
||||
while (n-1 >= 0):
|
||||
r = r + des_salt[v & 0x3F]
|
||||
v = v >> 6
|
||||
n = n - 1
|
||||
return r
|
||||
|
||||
rv = magic + salt + '$'
|
||||
final = map(ord, final)
|
||||
l = (final[0] << 16) + (final[6] << 8) + final[12]
|
||||
rv = rv + _to64(l, 4)
|
||||
l = (final[1] << 16) + (final[7] << 8) + final[13]
|
||||
rv = rv + _to64(l, 4)
|
||||
l = (final[2] << 16) + (final[8] << 8) + final[14]
|
||||
rv = rv + _to64(l, 4)
|
||||
l = (final[3] << 16) + (final[9] << 8) + final[15]
|
||||
rv = rv + _to64(l, 4)
|
||||
l = (final[4] << 16) + (final[10] << 8) + final[5]
|
||||
rv = rv + _to64(l, 4)
|
||||
l = final[11]
|
||||
rv = rv + _to64(l, 2)
|
||||
|
||||
return rv
|
||||
|
||||
#
|
||||
# List authorizations by UID
|
||||
#
|
||||
|
||||
def listUserAuthorizations(uid):
|
||||
actions = polkit.auth_list_uid(int(uid))
|
||||
auths = []
|
||||
for action in actions:
|
||||
action_info = polkit.action_info(action['action_id'])
|
||||
auths.append((action['action_id'], action['scope'], action_info['description'], action_info['policy_active'], action['negative']))
|
||||
return auths
|
||||
|
||||
#
|
||||
# Grant authorization to user
|
||||
#
|
||||
|
||||
def grantAuthorization(uid, action):
|
||||
uid = int(uid)
|
||||
if action == "*":
|
||||
for action_id in polkit.action_list():
|
||||
try:
|
||||
polkit.auth_revoke(uid, action_id)
|
||||
polkit.auth_add(action_id, polkit.SCOPE_ALWAYS, uid)
|
||||
except:
|
||||
return False
|
||||
else:
|
||||
try:
|
||||
polkit.auth_revoke(uid, action)
|
||||
polkit.auth_add(action, polkit.SCOPE_ALWAYS, uid)
|
||||
except:
|
||||
return False
|
||||
return True
|
||||
|
||||
#
|
||||
# Revoke authorization of user
|
||||
#
|
||||
|
||||
def revokeAuthorization(uid, action):
|
||||
uid = int(uid)
|
||||
if action == "*":
|
||||
for action_id in polkit.action_list():
|
||||
try:
|
||||
polkit.auth_revoke(uid, action_id)
|
||||
except:
|
||||
return False
|
||||
else:
|
||||
try:
|
||||
polkit.auth_revoke(uid, action)
|
||||
except:
|
||||
return False
|
||||
return True
|
||||
|
||||
#
|
||||
# Block authorization of user
|
||||
#
|
||||
|
||||
def blockAuthorization(uid, action):
|
||||
uid = int(uid)
|
||||
if action == "*":
|
||||
for action_id in polkit.action_list():
|
||||
try:
|
||||
polkit.auth_revoke(uid, action_id)
|
||||
polkit.auth_block(uid, action_id)
|
||||
except:
|
||||
return False
|
||||
else:
|
||||
try:
|
||||
polkit.auth_revoke(uid, action)
|
||||
polkit.auth_block(uid, action)
|
||||
except:
|
||||
return False
|
||||
return True
|
||||
@@ -0,0 +1,7 @@
|
||||
f /run/utmp 0664 root utmp
|
||||
d /run/lock 0755 root lock
|
||||
d /run/lock/subsys 0755 root root
|
||||
d /run/pisilinux 0755 root root
|
||||
d /run/shm 1777 root root
|
||||
L /dev/shm - - - - /run/shm
|
||||
d /run/user 0755 root root
|
||||
@@ -0,0 +1 @@
|
||||
Pisi_Linux 1.0
|
||||
@@ -0,0 +1,162 @@
|
||||
# /etc/protocols:
|
||||
# $Id: protocols,v 1.10 2010/03/26 13:05:40 ovasik Exp $
|
||||
#
|
||||
# Internet (IP) protocols
|
||||
#
|
||||
# from: @(#)protocols 5.1 (Berkeley) 4/17/89
|
||||
#
|
||||
# Updated for NetBSD based on RFC 1340, Assigned Numbers (July 1992).
|
||||
# Last IANA update included dated 2010-03-11
|
||||
#
|
||||
# See also http://www.iana.org/assignments/protocol-numbers
|
||||
|
||||
ip 0 IP # internet protocol, pseudo protocol number
|
||||
hopopt 0 HOPOPT # hop-by-hop options for ipv6
|
||||
icmp 1 ICMP # internet control message protocol
|
||||
igmp 2 IGMP # internet group management protocol
|
||||
ggp 3 GGP # gateway-gateway protocol
|
||||
ipv4 4 IPv4 # IPv4 encapsulation
|
||||
st 5 ST # ST datagram mode
|
||||
tcp 6 TCP # transmission control protocol
|
||||
cbt 7 CBT # CBT, Tony Ballardie <A.Ballardie@cs.ucl.ac.uk>
|
||||
egp 8 EGP # exterior gateway protocol
|
||||
igp 9 IGP # any private interior gateway (Cisco: for IGRP)
|
||||
bbn-rcc 10 BBN-RCC-MON # BBN RCC Monitoring
|
||||
nvp 11 NVP-II # Network Voice Protocol
|
||||
pup 12 PUP # PARC universal packet protocol
|
||||
argus 13 ARGUS # ARGUS
|
||||
emcon 14 EMCON # EMCON
|
||||
xnet 15 XNET # Cross Net Debugger
|
||||
chaos 16 CHAOS # Chaos
|
||||
udp 17 UDP # user datagram protocol
|
||||
mux 18 MUX # Multiplexing protocol
|
||||
dcn 19 DCN-MEAS # DCN Measurement Subsystems
|
||||
hmp 20 HMP # host monitoring protocol
|
||||
prm 21 PRM # packet radio measurement protocol
|
||||
xns-idp 22 XNS-IDP # Xerox NS IDP
|
||||
trunk-1 23 TRUNK-1 # Trunk-1
|
||||
trunk-2 24 TRUNK-2 # Trunk-2
|
||||
leaf-1 25 LEAF-1 # Leaf-1
|
||||
leaf-2 26 LEAF-2 # Leaf-2
|
||||
rdp 27 RDP # "reliable datagram" protocol
|
||||
irtp 28 IRTP # Internet Reliable Transaction Protocol
|
||||
iso-tp4 29 ISO-TP4 # ISO Transport Protocol Class 4
|
||||
netblt 30 NETBLT # Bulk Data Transfer Protocol
|
||||
mfe-nsp 31 MFE-NSP # MFE Network Services Protocol
|
||||
merit-inp 32 MERIT-INP # MERIT Internodal Protocol
|
||||
dccp 33 DCCP # Datagram Congestion Control Protocol
|
||||
3pc 34 3PC # Third Party Connect Protocol
|
||||
idpr 35 IDPR # Inter-Domain Policy Routing Protocol
|
||||
xtp 36 XTP # Xpress Tranfer Protocol
|
||||
ddp 37 DDP # Datagram Delivery Protocol
|
||||
idpr-cmtp 38 IDPR-CMTP # IDPR Control Message Transport Proto
|
||||
tp++ 39 TP++ # TP++ Transport Protocol
|
||||
il 40 IL # IL Transport Protocol
|
||||
ipv6 41 IPv6 # IPv6 encapsulation
|
||||
sdrp 42 SDRP # Source Demand Routing Protocol
|
||||
ipv6-route 43 IPv6-Route # Routing Header for IPv6
|
||||
ipv6-frag 44 IPv6-Frag # Fragment Header for IPv6
|
||||
idrp 45 IDRP # Inter-Domain Routing Protocol
|
||||
rsvp 46 RSVP # Resource ReSerVation Protocol
|
||||
gre 47 GRE # Generic Routing Encapsulation
|
||||
dsr 48 DSR # Dynamic Source Routing Protocol
|
||||
bna 49 BNA # BNA
|
||||
esp 50 ESP # Encap Security Payload
|
||||
ipv6-crypt 50 IPv6-Crypt # Encryption Header for IPv6 (not in official list)
|
||||
ah 51 AH # Authentication Header
|
||||
ipv6-auth 51 IPv6-Auth # Authentication Header for IPv6 (not in official list)
|
||||
i-nlsp 52 I-NLSP # Integrated Net Layer Security TUBA
|
||||
swipe 53 SWIPE # IP with Encryption
|
||||
narp 54 NARP # NBMA Address Resolution Protocol
|
||||
mobile 55 MOBILE # IP Mobility
|
||||
tlsp 56 TLSP # Transport Layer Security Protocol
|
||||
skip 57 SKIP # SKIP
|
||||
ipv6-icmp 58 IPv6-ICMP # ICMP for IPv6
|
||||
ipv6-nonxt 59 IPv6-NoNxt # No Next Header for IPv6
|
||||
ipv6-opts 60 IPv6-Opts # Destination Options for IPv6
|
||||
# 61 # any host internal protocol
|
||||
cftp 62 CFTP # CFTP
|
||||
# 63 # any local network
|
||||
sat-expak 64 SAT-EXPAK # SATNET and Backroom EXPAK
|
||||
kryptolan 65 KRYPTOLAN # Kryptolan
|
||||
rvd 66 RVD # MIT Remote Virtual Disk Protocol
|
||||
ippc 67 IPPC # Internet Pluribus Packet Core
|
||||
# 68 # any distributed file system
|
||||
sat-mon 69 SAT-MON # SATNET Monitoring
|
||||
visa 70 VISA # VISA Protocol
|
||||
ipcv 71 IPCV # Internet Packet Core Utility
|
||||
cpnx 72 CPNX # Computer Protocol Network Executive
|
||||
cphb 73 CPHB # Computer Protocol Heart Beat
|
||||
wsn 74 WSN # Wang Span Network
|
||||
pvp 75 PVP # Packet Video Protocol
|
||||
br-sat-mon 76 BR-SAT-MON # Backroom SATNET Monitoring
|
||||
sun-nd 77 SUN-ND # SUN ND PROTOCOL-Temporary
|
||||
wb-mon 78 WB-MON # WIDEBAND Monitoring
|
||||
wb-expak 79 WB-EXPAK # WIDEBAND EXPAK
|
||||
iso-ip 80 ISO-IP # ISO Internet Protocol
|
||||
vmtp 81 VMTP # Versatile Message Transport
|
||||
secure-vmtp 82 SECURE-VMTP # SECURE-VMTP
|
||||
vines 83 VINES # VINES
|
||||
ttp 84 TTP # TTP
|
||||
nsfnet-igp 85 NSFNET-IGP # NSFNET-IGP
|
||||
dgp 86 DGP # Dissimilar Gateway Protocol
|
||||
tcf 87 TCF # TCF
|
||||
eigrp 88 EIGRP # Enhanced Interior Routing Protocol (Cisco)
|
||||
ospf 89 OSPFIGP # Open Shortest Path First IGP
|
||||
sprite-rpc 90 Sprite-RPC # Sprite RPC Protocol
|
||||
larp 91 LARP # Locus Address Resolution Protocol
|
||||
mtp 92 MTP # Multicast Transport Protocol
|
||||
ax.25 93 AX.25 # AX.25 Frames
|
||||
ipip 94 IPIP # Yet Another IP encapsulation
|
||||
micp 95 MICP # Mobile Internetworking Control Pro.
|
||||
scc-sp 96 SCC-SP # Semaphore Communications Sec. Pro.
|
||||
etherip 97 ETHERIP # Ethernet-within-IP Encapsulation
|
||||
encap 98 ENCAP # Yet Another IP encapsulation
|
||||
# 99 # any private encryption scheme
|
||||
gmtp 100 GMTP # GMTP
|
||||
ifmp 101 IFMP # Ipsilon Flow Management Protocol
|
||||
pnni 102 PNNI # PNNI over IP
|
||||
pim 103 PIM # Protocol Independent Multicast
|
||||
aris 104 ARIS # ARIS
|
||||
scps 105 SCPS # SCPS
|
||||
qnx 106 QNX # QNX
|
||||
a/n 107 A/N # Active Networks
|
||||
ipcomp 108 IPComp # IP Payload Compression Protocol
|
||||
snp 109 SNP # Sitara Networks Protocol
|
||||
compaq-peer 110 Compaq-Peer # Compaq Peer Protocol
|
||||
ipx-in-ip 111 IPX-in-IP # IPX in IP
|
||||
vrrp 112 VRRP # Virtual Router Redundancy Protocol
|
||||
pgm 113 PGM # PGM Reliable Transport Protocol
|
||||
# 114 # any 0-hop protocol
|
||||
l2tp 115 L2TP # Layer Two Tunneling Protocol
|
||||
ddx 116 DDX # D-II Data Exchange
|
||||
iatp 117 IATP # Interactive Agent Transfer Protocol
|
||||
stp 118 STP # Schedule Transfer
|
||||
srp 119 SRP # SpectraLink Radio Protocol
|
||||
uti 120 UTI # UTI
|
||||
smp 121 SMP # Simple Message Protocol
|
||||
sm 122 SM # SM
|
||||
ptp 123 PTP # Performance Transparency Protocol
|
||||
isis 124 ISIS # ISIS over IPv4
|
||||
fire 125 FIRE
|
||||
crtp 126 CRTP # Combat Radio Transport Protocol
|
||||
crdup 127 CRUDP # Combat Radio User Datagram
|
||||
sscopmce 128 SSCOPMCE
|
||||
iplt 129 IPLT
|
||||
sps 130 SPS # Secure Packet Shield
|
||||
pipe 131 PIPE # Private IP Encapsulation within IP
|
||||
sctp 132 SCTP # Stream Control Transmission Protocol
|
||||
fc 133 FC # Fibre Channel
|
||||
rsvp-e2e-ignore 134 RSVP-E2E-IGNORE
|
||||
# 135 # Mobility Header
|
||||
udplite 136 UDPLite
|
||||
mpls-in-ip 137 MPLS-in-IP
|
||||
manet 138 manet # MANET Protocols
|
||||
hip 139 HIP # Host Identity Protocol
|
||||
shim6 140 Shim6 # Shim6 Protocol
|
||||
wesp 141 WESP # Wrapped Encapsulating Security Payload
|
||||
rohc 142 ROHC # Robust Header Compression
|
||||
# 143-252 Unassigned [IANA]
|
||||
# 253 Use for experimentation and testing [RFC3692]
|
||||
# 254 Use for experimentation and testing [RFC3692]
|
||||
# 255 Reserved [IANA]
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,233 @@
|
||||
.\" Hey, Emacs! This is an -*- nroff -*- source file.
|
||||
.TH START\-STOP\-DAEMON 8 "15th March 1997" "Debian Project" "Debian GNU/Linux"
|
||||
.SH NAME
|
||||
start\-stop\-daemon \- start and stop system daemon programs
|
||||
.SH SYNOPSIS
|
||||
.B start-stop-daemon
|
||||
.BR -S | --start
|
||||
.IR options
|
||||
.RB [ \-\- ]
|
||||
.IR arguments
|
||||
.HP
|
||||
.B start-stop-daemon
|
||||
.BR -K | --stop
|
||||
.IR options
|
||||
.HP
|
||||
.B start-stop-daemon
|
||||
.BR -H | --help
|
||||
.HP
|
||||
.B start-stop-daemon
|
||||
.BR -V | --version
|
||||
.SH DESCRIPTION
|
||||
.B start\-stop\-daemon
|
||||
is used to control the creation and termination of system-level processes.
|
||||
Using the
|
||||
.BR --exec ", " --pidfile ", " --user ", and " --name " options,"
|
||||
.B start\-stop\-daemon
|
||||
can be configured to find existing instances of a running process.
|
||||
|
||||
With
|
||||
.BR --start ,
|
||||
.B start\-stop\-daemon
|
||||
checks for the existence of a specified process.
|
||||
If such a process exists,
|
||||
.B start\-stop\-daemon
|
||||
does nothing, and exits with error status 1 (0 if
|
||||
.BR --oknodo
|
||||
is specified).
|
||||
If such a process does not exist, it starts an
|
||||
instance, using either the executable specified by
|
||||
.BR --exec ,
|
||||
(or, if specified, by
|
||||
.BR --startas ).
|
||||
Any arguments given after
|
||||
.BR --
|
||||
on the command line are passed unmodified to the program being
|
||||
started. If
|
||||
.B --retry
|
||||
is specified then start-stop-daemon will check that the process(es)
|
||||
have terminated.
|
||||
|
||||
With
|
||||
.BR --stop ,
|
||||
.B start\-stop\-daemon
|
||||
also checks for the existence of a specified process.
|
||||
If such a process exists,
|
||||
.B start\-stop\-daemon
|
||||
sends it the signal specified by
|
||||
.BR --signal ,
|
||||
and exits with error status 0.
|
||||
If such a process does not exist,
|
||||
.B start\-stop\-daemon
|
||||
exits with error status 1
|
||||
(0 if
|
||||
.BR --oknodo
|
||||
is specified).
|
||||
|
||||
.SH OPTIONS
|
||||
|
||||
.TP
|
||||
\fB-x\fP|\fB--exec\fP \fIexecutable\fP
|
||||
Check for processes that are instances of this executable (according to
|
||||
.B /proc/
|
||||
.I pid
|
||||
.B /exe
|
||||
).
|
||||
.TP
|
||||
\fB-p\fP|\fB--pidfile\fP \fIpid-file\fP
|
||||
Check for processes whose process-id is specified in
|
||||
.I pid-file.
|
||||
.TP
|
||||
\fB-u\fP|\fB--user\fP \fIusername\fP|\fIuid\fP
|
||||
Check for processes owned by the user specified by
|
||||
.I username
|
||||
or
|
||||
.I uid.
|
||||
.TP
|
||||
\fB-n\fP|\fB--name\fP \fIprocess-name\fP
|
||||
Check for processes with the name
|
||||
.I process-name
|
||||
(according to
|
||||
.B /proc/
|
||||
.I pid
|
||||
.B /stat
|
||||
).
|
||||
.TP
|
||||
\fB-s\fP|\fB--signal\fP \fIsignal\fP
|
||||
With
|
||||
.BR --stop
|
||||
, specifies the signal to send to processes being stopped (default 15).
|
||||
.TP
|
||||
\fB-R\fP|\fB--retry\fP \fItimeout\fP|\fIschedule\fP
|
||||
With
|
||||
.BR --stop ,
|
||||
specifies that
|
||||
.B start-stop-daemon
|
||||
is to check whether the process(es)
|
||||
do finish. It will check repeatedly whether any matching processes
|
||||
are running, until none are. If the processes do not exit it will
|
||||
then take further action as determined by the schedule.
|
||||
|
||||
If
|
||||
.I timeout
|
||||
is specified instead of
|
||||
.I schedule
|
||||
then the schedule
|
||||
.IB signal / timeout /KILL/ timeout
|
||||
is used, where
|
||||
.I signal
|
||||
is the signal specified with
|
||||
.BR --signal .
|
||||
|
||||
.I schedule
|
||||
is a list of at least two items separated by slashes
|
||||
.RB ( / );
|
||||
each item may be
|
||||
.BI - signal-number
|
||||
or [\fB\-\fP]\fIsignal-name\fP,
|
||||
which means to send that signal,
|
||||
or
|
||||
.IR timeout ,
|
||||
which means to wait that many seconds for processes to
|
||||
exit,
|
||||
or
|
||||
.BR forever ,
|
||||
which means to repeat the rest of the schedule forever if
|
||||
necessary.
|
||||
|
||||
If the end of the schedule is reached and
|
||||
.BR forever
|
||||
is not specified, then
|
||||
.B start-stop-daemon
|
||||
exits with error status 2.
|
||||
If a schedule is specified, then any signal specified
|
||||
with
|
||||
.B --signal
|
||||
is ignored.
|
||||
.TP
|
||||
\fB-a\fP|\fB--startas\fP \fIpathname\fP
|
||||
With
|
||||
.BR --start ,
|
||||
start the process specified by
|
||||
.IR pathname .
|
||||
If not specified, defaults to the argument given to
|
||||
.BR --exec .
|
||||
.TP
|
||||
.BR -t | --test
|
||||
Print actions that would be taken and set appropriate return value,
|
||||
but take no action.
|
||||
.TP
|
||||
.BR -o | --oknodo
|
||||
Return exit status 0 instead of 1 if no actions are (would be) taken.
|
||||
.TP
|
||||
.BR -q | --quiet
|
||||
Do not print informational messages; only display error messages.
|
||||
.TP
|
||||
\fB-c\fP|\fB--chuid\fP \fIusername\fR|\fIuid\fP
|
||||
Change to this username/uid before starting the process. You can also
|
||||
specify a group by appending a
|
||||
.BR : ,
|
||||
then the group or gid in the same way
|
||||
as you would for the `chown' command (\fIuser\fP\fB:\fP\fIgroup\fP).
|
||||
When using this option
|
||||
you must realize that the primary and supplemental groups are set as well,
|
||||
even if the
|
||||
.B --group
|
||||
option is not specified. The
|
||||
.B --group
|
||||
option is only for
|
||||
groups that the user isn't normally a member of (like adding per/process
|
||||
group membership for generic users like
|
||||
.BR nobody ).
|
||||
.TP
|
||||
\fB-r\fP|\fB--chroot\fP \fIroot\fP
|
||||
Chdir and chroot to
|
||||
.I root
|
||||
before starting the process. Please note that the pidfile is also written
|
||||
after the chroot.
|
||||
.TP
|
||||
.BR -b | --background
|
||||
Typically used with programs that don't detach on their own. This option
|
||||
will force
|
||||
.B start-stop-daemon
|
||||
to fork before starting the process, and force it into the background.
|
||||
.B WARNING: start-stop-daemon
|
||||
cannot check the exit status if the process fails to execute for
|
||||
.B any
|
||||
reason. This is a last resort, and is only meant for programs that either
|
||||
make no sense forking on their own, or where it's not feasible to add the
|
||||
code for it to do this itself.
|
||||
.TP
|
||||
.BR -N | --nicelevel
|
||||
This alters the prority of the process before starting it.
|
||||
.TP
|
||||
.BR -m | --make-pidfile
|
||||
Used when starting a program that does not create its own pid file. This
|
||||
option will make
|
||||
.B start-stop-daemon
|
||||
create the file referenced with
|
||||
.B --pidfile
|
||||
and place the pid into it just before executing the process. Note, it will
|
||||
not be removed when stopping the program.
|
||||
.B NOTE:
|
||||
This feature may not work in all cases. Most notably when the program
|
||||
being executed forks from its main process. Because of this it is usually
|
||||
only useful when combined with the
|
||||
.B --background
|
||||
option.
|
||||
.TP
|
||||
.BR -v | --verbose
|
||||
Print verbose informational messages.
|
||||
.TP
|
||||
.BR -H | --help
|
||||
Print help information; then exit.
|
||||
.TP
|
||||
.BR -V | --version
|
||||
Print version information; then exit.
|
||||
|
||||
.SH AUTHORS
|
||||
Marek Michalkiewicz <marekm@i17linuxb.ists.pwr.wroc.pl> based on
|
||||
a previous version by Ian Jackson <ian@chiark.greenend.org.uk>.
|
||||
|
||||
Manual page by Klee Dienes <klee@mit.edu>, partially reformatted
|
||||
by Ian Jackson.
|
||||
@@ -0,0 +1,68 @@
|
||||
# For more information on how this file works, please see
|
||||
# the manpages sysctl(8) and sysctl.conf(5).
|
||||
#
|
||||
# In order for this file to work properly, you must first
|
||||
# enable 'Sysctl support' in the kernel.
|
||||
#
|
||||
# Look in /proc/sys/ for all the things you can setup.
|
||||
#
|
||||
|
||||
# Disables packet forwarding
|
||||
#net.ipv4.ip_forward = 0
|
||||
|
||||
# Disables IP dynaddr
|
||||
#net.ipv4.ip_dynaddr = 0
|
||||
|
||||
# Disable ECN
|
||||
#net.ipv4.tcp_ecn = 0
|
||||
|
||||
# Enables source route verification
|
||||
net.ipv4.conf.default.rp_filter = 1
|
||||
|
||||
# Enable reverse path
|
||||
net.ipv4.conf.all.rp_filter = 1
|
||||
|
||||
# Enable SYN cookies
|
||||
# http://cr.yp.to/syncookies.html
|
||||
#net.ipv4.tcp_syncookies = 1
|
||||
|
||||
# Disable source route
|
||||
#net.ipv4.conf.all.accept_source_route = 0
|
||||
#net.ipv4.conf.default.accept_source_route = 0
|
||||
|
||||
# Disable redirects
|
||||
#net.ipv4.conf.all.accept_redirects = 0
|
||||
#net.ipv4.conf.default.accept_redirects = 0
|
||||
|
||||
# Disable secure redirects
|
||||
#net.ipv4.conf.all.secure_redirects = 0
|
||||
#net.ipv4.conf.default.secure_redirects = 0
|
||||
|
||||
# Enable NF_CONNTRACK_ACCT
|
||||
# net.netfilter.nf_conntrack_acct = 1
|
||||
|
||||
# Ignore ICMP broadcasts
|
||||
net.ipv4.icmp_echo_ignore_broadcasts = 1
|
||||
|
||||
# Disables the magic-sysrq key
|
||||
#kernel.sysrq = 0
|
||||
|
||||
# When the kernel panics, automatically reboot in 3 seconds
|
||||
#kernel.panic = 3
|
||||
|
||||
# Allow for more PIDs (cool factor!); may break some programs
|
||||
#kernel.pid_max = 999999
|
||||
|
||||
# Controls whether core dumps will append the PID to the core filename.
|
||||
# Useful for debugging multi-threaded applications.
|
||||
kernel.core_uses_pid = 1
|
||||
|
||||
# TCP Port for lock manager
|
||||
#fs.nfs.nlm_tcpport = 0
|
||||
|
||||
# UDP Port for lock manager
|
||||
#fs.nfs.nlm_udpport = 0
|
||||
|
||||
# default is 8k, nepomuk runs better with 512K
|
||||
fs.inotify.max_user_watches = 524288
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
IANA_VERSION=2.30
|
||||
|
||||
wget http://sethwklein.net/iana-etc-$IANA_VERSION.tar.bz2
|
||||
tar xvf iana-etc-$IANA_VERSION.tar.bz2
|
||||
|
||||
pushd iana-etc-$IANA_VERSION
|
||||
|
||||
sed -i 's:file=protocol-numbers:file=protocol-numbers/protocol-numbers.txt:' Makefile
|
||||
|
||||
make get
|
||||
LC_ALL=C make
|
||||
make test
|
||||
|
||||
cp {services,protocols} ../
|
||||
|
||||
popd
|
||||
|
||||
# Cleanup
|
||||
rm -rf iana-etc-$IANA_VERSION
|
||||
@@ -0,0 +1,162 @@
|
||||
<?xml version="1.0" ?>
|
||||
<!DOCTYPE PISI SYSTEM "http://www.pisilinux.org/projeler/pisi/pisi-spec.dtd">
|
||||
<PISI>
|
||||
<Source>
|
||||
<Name>baselayout</Name>
|
||||
<Homepage>http://www.pisilinux.org</Homepage>
|
||||
<Packager>
|
||||
<Name>PisiLinux Community</Name>
|
||||
<Email>admins@pisilinux.org</Email>
|
||||
</Packager>
|
||||
<License>GPLv2</License>
|
||||
<IsA>app:console</IsA>
|
||||
<IsA>library</IsA>
|
||||
<IsA>data</IsA>
|
||||
<Summary>Filesystem baselayout</Summary>
|
||||
<Description>baselayout creates the Pisi Linux Linux main filesystem hierarchy.</Description>
|
||||
<Archive sha1sum="89cb1dc3c3a2fc47c299ae6c002cad212b7fc56e" type="targz">http://source.pisilinux.org/1.0/baselayout-3.10.0.tar.gz</Archive>
|
||||
</Source>
|
||||
|
||||
<Package>
|
||||
<Name>baselayout</Name>
|
||||
<RuntimeDependencies>
|
||||
<Dependency>pypolkit</Dependency>
|
||||
</RuntimeDependencies>
|
||||
<Files>
|
||||
<Path fileType="executable" permanent="true">/bin</Path>
|
||||
<Path fileType="executable" permanent="true">/sbin</Path>
|
||||
<Path fileType="library" permanent="true">/lib*</Path>
|
||||
<Path fileType="config" permanent="true">/etc</Path>
|
||||
<Path fileType="data" permanent="true">/etc/pisilinux-release</Path>
|
||||
<Path fileType="data" permanent="true">/media</Path>
|
||||
<Path fileType="data" permanent="true">/boot</Path>
|
||||
<Path fileType="data" permanent="true">/proc</Path>
|
||||
<Path fileType="data" permanent="true">/home</Path>
|
||||
<Path fileType="data" permanent="true">/mnt</Path>
|
||||
<Path fileType="data" permanent="true">/opt</Path>
|
||||
<Path fileType="data" permanent="true">/dev</Path>
|
||||
<Path fileType="data" permanent="true">/run</Path>
|
||||
<Path fileType="data" permanent="true">/sys</Path>
|
||||
<Path fileType="data" permanent="true">/srv</Path>
|
||||
<Path fileType="data" permanent="true">/tmp</Path>
|
||||
<Path fileType="data" permanent="true">/usr</Path>
|
||||
<Path fileType="data" permanent="true">/var</Path>
|
||||
<Path fileType="config">/usr/lib/tmpfiles.d/baselayout.conf</Path>
|
||||
</Files>
|
||||
<AdditionalFiles>
|
||||
<AdditionalFile owner="root" permission="0644" target="/usr/lib/tmpfiles.d/baselayout.conf">baselayout.conf</AdditionalFile>
|
||||
|
||||
<!-- Update these from fedora's setup package -->
|
||||
<AdditionalFile owner="root" permission="0644" target="/etc/services">services</AdditionalFile>
|
||||
<AdditionalFile owner="root" permission="0644" target="/etc/protocols">protocols</AdditionalFile>
|
||||
|
||||
<AdditionalFile owner="root" permission="0644" target="/etc/sysctl.conf">sysctl.conf</AdditionalFile>
|
||||
|
||||
<!-- Release file for Pisi Linux, there's another in lsb-release package -->
|
||||
<AdditionalFile owner="root" permission="0644" target="/etc/pisilinux-release">pisilinux-release</AdditionalFile>
|
||||
|
||||
<!-- Should be dropped after switching to systemd as the only user is COMAR -->
|
||||
<AdditionalFile owner="root" permission="0644" target="/usr/share/man/man8/start-stop-daemon.8">start-stop-daemon.8</AdditionalFile>
|
||||
</AdditionalFiles>
|
||||
<Provides>
|
||||
<COMAR script="pakhandler.py">System.PackageHandler</COMAR>
|
||||
<COMAR script="package.py">System.Package</COMAR>
|
||||
<COMAR script="usermgr.py">User.Manager</COMAR>
|
||||
<COMAR script="stack.py">Network.Stack</COMAR>
|
||||
</Provides>
|
||||
</Package>
|
||||
|
||||
<History>
|
||||
<Update release="13">
|
||||
<Date>2014-07-16</Date>
|
||||
<Version>3.10.0</Version>
|
||||
<Comment>Add vboxusers</Comment>
|
||||
<Name>Serdar Soytetir</Name>
|
||||
<Email>kaptan@pisilinux.org</Email>
|
||||
</Update>
|
||||
<Update release="12">
|
||||
<Date>2014-07-16</Date>
|
||||
<Version>3.10.0</Version>
|
||||
<Comment>Release Pisi Linux 1.0</Comment>
|
||||
<Name>Serdar Soytetir</Name>
|
||||
<Email>kaptan@pisilinux.org</Email>
|
||||
</Update>
|
||||
<Update release="11">
|
||||
<Date>2014-05-11</Date>
|
||||
<Version>3.10.0</Version>
|
||||
<Comment>Release bump.</Comment>
|
||||
<Name>Marcin Bojara</Name>
|
||||
<Email>marcin@pisilinux.org</Email>
|
||||
</Update>
|
||||
<Update release="10">
|
||||
<Date>2014-03-15</Date>
|
||||
<Version>3.10.0</Version>
|
||||
<Comment>Rebuild.</Comment>
|
||||
<Name>Marcin Bojara</Name>
|
||||
<Email>marcin@pisilinux.org</Email>
|
||||
</Update>
|
||||
<Update release="9">
|
||||
<Date>2014-01-19</Date>
|
||||
<Version>3.10.0</Version>
|
||||
<Comment>Update baselayout.conf</Comment>
|
||||
<Name>Marcin Bojara</Name>
|
||||
<Email>marcin@pisilinux.org</Email>
|
||||
</Update>
|
||||
<Update release="8">
|
||||
<Date>2014-01-08</Date>
|
||||
<Version>3.10.0</Version>
|
||||
<Comment>Add baselayout.conf</Comment>
|
||||
<Name>Marcin Bojara</Name>
|
||||
<Email>marcin@pisilinux.org</Email>
|
||||
</Update>
|
||||
<Update release="7">
|
||||
<Date>2013-12-20</Date>
|
||||
<Version>3.10.0</Version>
|
||||
<Comment>Release Pisi Linux Rc2</Comment>
|
||||
<Name>Serdar Soytetir</Name>
|
||||
<Email>kaptan@pisilinux.org</Email>
|
||||
</Update>
|
||||
<Update release="6">
|
||||
<Date>2013-10-27</Date>
|
||||
<Version>3.10.0</Version>
|
||||
<Comment>Add gdm user and group, apply chmod 1777 to dev/shm aka run/shm.</Comment>
|
||||
<Name>Serdar Soytetir</Name>
|
||||
<Email>kaptan@pisilinux.org</Email>
|
||||
</Update>
|
||||
<Update release="5">
|
||||
<Date>2013-09-10</Date>
|
||||
<Version>3.10.0</Version>
|
||||
<Comment>Add shm dir to run, new archive.</Comment>
|
||||
<Name>Serdar Soytetir</Name>
|
||||
<Email>kaptan@pisilinux.org</Email>
|
||||
</Update>
|
||||
<Update release="4">
|
||||
<Date>2013-09-05</Date>
|
||||
<Version>3.8.0</Version>
|
||||
<Comment>Add missing method to pakhandler.py</Comment>
|
||||
<Name>Marcin Bojara</Name>
|
||||
<Email>marcin@pisilinux.org</Email>
|
||||
</Update>
|
||||
<Update release="3">
|
||||
<Date>2013-08-31</Date>
|
||||
<Version>3.8.0</Version>
|
||||
<Comment>release Izmir</Comment>
|
||||
<Name>Erdinç Gültekin</Name>
|
||||
<Email>erdincgultekin@pisilinux.org</Email>
|
||||
</Update>
|
||||
<Update release="2">
|
||||
<Date>2013-03-24</Date>
|
||||
<Version>3.8.0</Version>
|
||||
<Comment>Pisi Linux changes.</Comment>
|
||||
<Name>Serdar Soytetir</Name>
|
||||
<Email>kaptan@pisilinux.org</Email>
|
||||
</Update>
|
||||
<Update release="1">
|
||||
<Date>2013-01-11</Date>
|
||||
<Version>3.7.1</Version>
|
||||
<Comment>First release</Comment>
|
||||
<Name>Serdar Soytetir</Name>
|
||||
<Email>kaptan@pisilinux.org</Email>
|
||||
</Update>
|
||||
</History>
|
||||
</PISI>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" ?>
|
||||
<PISI>
|
||||
<Source>
|
||||
<Name>baselayout</Name>
|
||||
<Summary xml:lang="tr">Dosya sisteminin temel planı</Summary>
|
||||
<Description xml:lang="tr">Bu paket, Pisi Linux dosya sisteminin temelini oluşturur.</Description>
|
||||
<Description xml:lang="fr">Ce paquet crée la hiérarchie du système de fichier principal de Pisi Linux.</Description>
|
||||
</Source>
|
||||
</PISI>
|
||||
Reference in New Issue
Block a user