本文整理汇总了PHP中unix::SystemCreateUser方法的典型用法代码示例。如果您正苦于以下问题:PHP unix::SystemCreateUser方法的具体用法?PHP unix::SystemCreateUser怎么用?PHP unix::SystemCreateUser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类unix
的用法示例。
在下文中一共展示了unix::SystemCreateUser方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: build
function build()
{
$unix = new unix();
$sock = new sockets();
$ClamavStreamMaxLength = $sock->GET_INFO("ClamavStreamMaxLength");
$ClamavMaxRecursion = $sock->GET_INFO("ClamavMaxRecursion");
$ClamavMaxFiles = $sock->GET_INFO("ClamavMaxFiles");
$PhishingScanURLs = $sock->GET_INFO("PhishingScanURLs");
$ClamavMaxScanSize = $sock->GET_INFO("ClamavMaxScanSize");
$ClamavMaxFileSize = $sock->GET_INFO("ClamavMaxFileSize");
$ClamavTemporaryDirectory = $sock->GET_INFO("ClamavTemporaryDirectory");
if ($ClamavTemporaryDirectory == null) {
$ClamavTemporaryDirectory = "/home/clamav";
}
if (!is_numeric($ClamavStreamMaxLength)) {
$ClamavStreamMaxLength = 12;
}
if (!is_numeric($ClamavMaxRecursion)) {
$ClamavMaxRecursion = 5;
}
if (!is_numeric($ClamavMaxFiles)) {
$ClamavMaxFiles = 10000;
}
if (!is_numeric($PhishingScanURLs)) {
$PhishingScanURLs = 1;
}
if (!is_numeric($ClamavMaxScanSize)) {
$ClamavMaxScanSize = 15;
}
if (!is_numeric($ClamavMaxFileSize)) {
$ClamavMaxFileSize = 20;
}
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} MaxFileSize: {$ClamavMaxFileSize}M\n";
}
$dirs[] = "/var/clamav";
$dirs[] = "/var/run/clamav";
$dirs[] = "/var/lib/clamav";
$dirs[] = "/var/log/clamav";
$dirs[] = $ClamavTemporaryDirectory;
while (list($i, $directory) = each($dirs)) {
@mkdir($directory, 0755, true);
@chmod($directory, 0755);
@chown($directory, "clamav");
@chgrp($directory, "clamav");
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Permissions on {$directory}\n";
}
$unix->chown_func("clamav", "clamav", $directory . "/*");
}
$PhishingScanURLs_text = "no";
if ($PhishingScanURLs == 1) {
$PhishingScanURLs_text = "yes";
}
$unix->SystemCreateUser("clamav", "clamav");
$f[] = "LocalSocket /var/run/clamav/clamav.sock";
$f[] = "FixStaleSocket true";
$f[] = "User clamav";
$f[] = "AllowSupplementaryGroups true";
$f[] = "ScanMail true";
$f[] = "ScanArchive true";
$f[] = "#ArchiveLimitMemoryUsage false (depreciated)";
$f[] = "ArchiveBlockEncrypted false";
$f[] = "MaxDirectoryRecursion 15";
$f[] = "FollowDirectorySymlinks false";
$f[] = "FollowFileSymlinks false";
$f[] = "ReadTimeout 180";
$f[] = "MaxThreads 12";
$f[] = "MaxConnectionQueueLength 15";
$f[] = "StreamMaxLength {$ClamavStreamMaxLength}M";
$f[] = "MaxFileSize {$ClamavMaxFileSize}M";
$f[] = "MaxScanSize {$ClamavMaxFileSize}M";
$f[] = "MaxFiles 10000";
$f[] = "MaxRecursion {$ClamavMaxRecursion}";
$f[] = "LogSyslog true";
$f[] = "LogFacility LOG_LOCAL6";
$f[] = "LogClean false";
$f[] = "LogVerbose false";
$f[] = "PidFile /var/run/clamav/clamd.pid";
$f[] = "TemporaryDirectory {$ClamavTemporaryDirectory}";
$f[] = "DatabaseDirectory /var/lib/clamav";
$f[] = "SelfCheck 3600";
$f[] = "Foreground false";
$f[] = "Debug false";
$f[] = "ScanPE true";
$f[] = "ScanOLE2 true";
$f[] = "ScanHTML true";
$f[] = "DetectBrokenExecutables false";
$f[] = "#MailFollowURLs false (depreciated)";
$f[] = "ExitOnOOM false";
$f[] = "LeaveTemporaryFiles false";
$f[] = "AlgorithmicDetection true";
$f[] = "ScanELF true";
$f[] = "IdleTimeout 30";
$f[] = "PhishingSignatures true";
$f[] = "PhishingScanURLs {$PhishingScanURLs_text}";
$f[] = "PhishingAlwaysBlockSSLMismatch false";
$f[] = "PhishingAlwaysBlockCloak false";
$f[] = "DetectPUA false";
$f[] = "ScanPartialMessages false";
//.........这里部分代码省略.........
示例2: build
function build()
{
$sock = new sockets();
$EnableRemoteStatisticsAppliance = $sock->GET_INFO("EnableRemoteStatisticsAppliance");
if (!is_numeric($EnableRemoteStatisticsAppliance)) {
$EnableRemoteStatisticsAppliance = 0;
}
if ($EnableRemoteStatisticsAppliance == 1) {
return;
}
send_email_events("Order to rebuild filters configuration", @implode("\nParams:", $argv), "proxy");
$funtion = __FUNCTION__;
if (!isset($GLOBALS["VERBOSE"])) {
$GLOBALS["VERBOSE"] = false;
}
if ($GLOBALS["VERBOSE"]) {
echo "{$funtion}::" . __LINE__ . " Loading libraries\n";
}
$users = new usersMenus();
$sock = new sockets();
$unix = new unix();
$php5 = $unix->LOCATE_PHP5_BIN();
$chown = $unix->find_program("chown");
$chmod = $unix->find_program("chmod");
$squidbin = $unix->find_program("squid3");
$nohup = $unix->find_program("nohup");
$unix->SystemCreateUser("squid", "squid");
@mkdir("/var/tmp", 0775, true);
$EnableWebProxyStatsAppliance = $sock->GET_INFO("EnableWebProxyStatsAppliance");
$EnableRemoteStatisticsAppliance = $sock->GET_INFO("EnableRemoteStatisticsAppliance");
if (!is_numeric($EnableWebProxyStatsAppliance)) {
$EnableWebProxyStatsAppliance = 0;
}
if (!is_numeric($EnableRemoteStatisticsAppliance)) {
$EnableRemoteStatisticsAppliance = 0;
}
$UseRemoteUfdbguardService = $sock->GET_INFO('UseRemoteUfdbguardService');
if (!is_file($squidbin)) {
$squidbin = $unix->find_program("squid");
}
$EnableUfdbGuard = intval($sock->EnableUfdbGuard());
$SQUIDEnable = $sock->GET_INFO("SQUIDEnable");
if (!is_numeric($SQUIDEnable)) {
$SQUIDEnable = 1;
}
if (!is_numeric($UseRemoteUfdbguardService)) {
$UseRemoteUfdbguardService = 0;
}
if ($GLOBALS["VERBOSE"]) {
echo "DEBUG::{$funtion}:: EnableWebProxyStatsAppliance={$EnableWebProxyStatsAppliance}\n";
}
if ($GLOBALS["VERBOSE"]) {
echo "DEBUG::{$funtion}:: EnableRemoteStatisticsAppliance={$EnableRemoteStatisticsAppliance}\n";
}
if ($GLOBALS["VERBOSE"]) {
echo "DEBUG::{$funtion}:: EnableUfdbGuard={$EnableUfdbGuard}\n";
}
if ($GLOBALS["VERBOSE"]) {
echo "DEBUG::{$funtion}:: SQUIDEnable={$SQUIDEnable}\n";
}
if ($GLOBALS["VERBOSE"]) {
echo "DEBUG::{$funtion}:: UseRemoteUfdbguardService={$UseRemoteUfdbguardService}\n";
}
$GLOBALS["SQUIDBIN"] = $squidbin;
if ($EnableWebProxyStatsAppliance == 0) {
$installed = false;
if ($users->SQUIDGUARD_INSTALLED) {
$installed = true;
echo "Starting......: " . date("H:i:s") . " SquidGuard is installed\n";
}
if ($users->APP_UFDBGUARD_INSTALLED) {
$installed = true;
echo "Starting......: " . date("H:i:s") . " Webfiltering service is installed\n";
}
if ($users->DANSGUARDIAN_INSTALLED) {
$installed = true;
echo "Starting......: " . date("H:i:s") . " Dansguardian is installed\n";
}
if (!$installed) {
if ($GLOBALS["VERBOSE"]) {
echo "No one installed...\n";
shell_exec("{$nohup} " . LOCATE_PHP5_BIN2() . " " . dirname(__FILE__) . "/exec.usrmactranslation.php >/dev/null 2>&1 &");
return false;
}
}
}
if ($EnableUfdbGuard == 0) {
if ($GLOBALS["VERBOSE"]) {
echo "UfDbguard is disabled ( see EnableUfdbGuard ) in line: " . __LINE__ . "\n";
}
return;
}
if ($SQUIDEnable == 0) {
if ($GLOBALS["VERBOSE"]) {
echo "UfDbguard is disabled ( see SQUIDEnable ) in line: " . __LINE__ . "\n";
}
return;
}
if ($UseRemoteUfdbguardService == 1) {
if ($GLOBALS["VERBOSE"]) {
//.........这里部分代码省略.........
示例3: start
function start($aspid = false)
{
$unix = new unix();
$sock = new sockets();
$LOGBIN = "DHCP Server";
$binpath = $unix->DHCPD_BIN_PATH();
if (!is_file($binpath)) {
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$LOGBIN}, not installed\n";
}
return;
}
if (!$aspid) {
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
$pid = $unix->get_pid_from_file($pidfile);
if ($unix->process_exists($pid, basename(__FILE__))) {
$time = $unix->PROCCESS_TIME_MIN($pid);
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$LOGBIN}, [START] Already Artica task running PID {$pid} since {$time}mn\n";
}
return false;
}
@file_put_contents($pidfile, getmypid());
}
$pid = PID_NUM();
if ($unix->process_exists($pid)) {
$timepid = $unix->PROCCESS_TIME_MIN($pid);
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$LOGBIN} Service already started {$pid} since {$timepid}Mn...\n";
}
return true;
}
$EnableDHCPServer = $sock->GET_INFO("EnableDHCPServer");
if (!is_numeric($EnableDHCPServer)) {
$EnableDHCPServer = 0;
}
$EnableChilli = $sock->GET_INFO("EnableChilli");
if (!is_numeric($EnableChilli)) {
$EnableChilli = 0;
}
if ($EnableChilli == 1) {
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$LOGBIN} replaced by HotSpot feature...\n";
}
$EnableDHCPServer = 0;
}
if ($EnableDHCPServer == 0) {
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$LOGBIN} service disabled\n";
}
build_progress("{starting_service} {failed}", 110);
return false;
}
build_progress("{starting_service}", 60);
@mkdir("/var/run/dhcp3-server", 0755, true);
@mkdir("/var/lib/dhcp3", 0755, true);
if (!is_file("/var/lib/dhcp3/dhcpd.other")) {
@file_put_contents("/var/lib/dhcp3/dhcpd.other", "#");
}
if (!is_file("/var/lib/dhcp3/dhcpd.leases")) {
@file_put_contents("/var/lib/dhcp3/dhcpd.leases", "#");
}
$unix->SystemCreateUser("dhcpd", "dhcpd");
$unix->chown_func("dhcpd", "dhcpd", "/var/run/dhcp3-server");
$unix->chown_func("dhcpd", "dhcpd", "/var/lib/dhcp3/dhcpd.leases");
$unix->chown_func("dhcpd", "dhcpd", "/var/lib/dhcp3/dhcpd.leases~");
$DHCP3ListenNIC = $sock->GET_INFO('DHCP3ListenNIC');
if ($DHCP3ListenNIC == null) {
$DHCP3ListenNIC = "eth0";
}
echo "Starting......: " . date("H:i:s") . " [INIT]: {$LOGBIN} Listen {$DHCP3ListenNIC}\n";
echo "Starting......: " . date("H:i:s") . " [INIT]: {$LOGBIN} building settings...\n";
BuildDHCP(true);
build_progress("{starting_service}", 75);
$CMD[] = "{$binpath} -q -pf " . PID_PATH();
$CMD[] = "-cf " . dhcp3Config();
$CMD[] = "-lf /var/lib/dhcp3/dhcpd.leases";
$cmd = @implode(" ", $CMD);
echo "Starting......: " . date("H:i:s") . " [INIT]: {$LOGBIN} service..\n";
if ($GLOBALS["VERBOSE"]) {
echo "{$cmd}\n";
}
shell_exec($cmd);
build_progress("{starting_service}", 80);
for ($i = 0; $i < 6; $i++) {
$pid = PID_NUM();
if ($unix->process_exists($pid)) {
break;
}
build_progress("{starting_service} waiting {$i}/6", 80);
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$LOGBIN} service waiting {$i}/6...\n";
}
sleep(1);
}
$pid = PID_NUM();
if ($unix->process_exists($pid)) {
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$LOGBIN} service Success service started pid:{$pid}...\n";
}
//.........这里部分代码省略.........
示例4: build
function build()
{
$unix = new unix();
$sock = new sockets();
$php5 = $unix->LOCATE_PHP5_BIN();
$sysctl = $unix->find_program("sysctl");
$EnableChilli = $sock->GET_INFO("EnableChilli");
if (!is_numeric($EnableChilli)) {
$EnableChilli = 0;
}
$KernelSendRedirects = $sock->GET_INFO("KernelSendRedirects");
if (!is_numeric($KernelSendRedirects)) {
$KernelSendRedirects = 1;
}
$save = false;
$ChilliConf = unserialize(base64_decode($sock->GET_INFO("ChilliConf")));
$ChilliConf = GetInterfaceArray($ChilliConf);
$php = $unix->LOCATE_PHP5_BIN();
if (!isset($ChilliConf["HS_UAMFREEWEB"])) {
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} FreeWeb Login page is not set...\n";
}
}
if (!is_file("/var/www/c2/index.php")) {
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Installing CakePHP\n";
}
shell_exec("/usr/share/artica-postfix/bin/artica-make APP_CAKEPHP >/dev/null 2>&1");
} else {
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} CakePHP done\n";
}
}
if (!is_file("/var/www/c2/yfi_cake/setup/coova_json/login.php")) {
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} `/var/www/c2/yfi_cake/setup/coova_json/login.php no such file Installing YFI CakePHP\n";
}
shell_exec("/usr/share/artica-postfix/bin/artica-make APP_CAKEPHP >/dev/null 2>&1");
} else {
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} YFI CakePHP done\n";
}
}
if (!is_dir("/usr/share/coova_json")) {
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} `/usr/share/coova_json` no such directory Installing Coova JSon\n";
}
shell_exec("/usr/share/artica-postfix/bin/artica-make APP_CAKEPHP >/dev/null 2>&1");
} else {
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Coova JSon done\n";
}
}
$unix->SystemCreateUser("chilli", "chilli");
$f[] = "include /etc/chilli/main.conf";
$f[] = "include /etc/chilli/hs.conf";
$f[] = "include /etc/chilli/local.conf";
$f[] = "ipup=/etc/chilli/up.sh";
$f[] = "ipdown=/etc/chilli/down.sh";
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Chilli: `/etc/chilli.conf` done\n";
}
file_put_contents("/etc/chilli.conf", @implode("\n", $f));
if (!is_numeric($ChilliConf["EnableSSLRedirection"])) {
$ChilliConf["EnableSSLRedirection"] = 0;
}
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Building main configuration: {$ChilliConf["HS_LANIF"]} -> {$ChilliConf["HS_WANIF"]}\n";
}
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Listen.....: {$ChilliConf["HS_UAMLISTEN"]}\n";
}
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} DHCP.......: {$ChilliConf["HS_DYNIP"]}/{$ChilliConf["HS_DYNIP_MASK"]} ({$ChilliConf["HS_NETWORK"]})\n";
}
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Proxy Port.: {$ChilliConf["SQUID_HTTP_PORT"]}\n";
}
$ldap = new clladp();
if (!is_numeric($ChilliConf["ENABLE_DHCP_RELAY"])) {
$ChilliConf["ENABLE_DHCP_RELAY"] = 0;
}
$t[] = "# -*- mode: shell-script; -*-";
$t[] = "#";
$t[] = "# Coova-Chilli Default Configurations. ";
$t[] = "# To customize, copy this file to /etc/chilli/config";
$t[] = "# and edit to your liking. This is included in shell scripts";
$t[] = "# that configure chilli and related programs before file 'config'. ";
$t[] = "";
$t[] = "";
$t[] = "###";
$t[] = "# Local Network Configurations";
$t[] = "# ";
$t[] = "";
if ($ChilliConf["HS_WANIF"] != null) {
$t[] = "HS_WANIF={$ChilliConf["HS_WANIF"]} # WAN Interface toward the Internet";
}
$t[] = "HS_LANIF={$ChilliConf["HS_LANIF"]}\t\t # Subscriber Interface for client devices";
$t[] = "HS_NETWORK={$ChilliConf["HS_NETWORK"]}\t # HotSpot Network (must include HS_UAMLISTEN)";
$t[] = "HS_NETMASK={$ChilliConf["HS_NETMASK"]} # HotSpot Network Netmask";
//.........这里部分代码省略.........
示例5: CheckPermissions
function CheckPermissions()
{
$unix = new unix();
$unix->SystemCreateUser("mail", "mail");
$unix->SystemCreateUser("postfix", "mail");
$unix->SystemCreateUser("cyrus", "cyrus");
$POSTFIX_QUEUE_DIRECTORY = $unix->POSTCONF_GET("queue_directory");
$dirs[] = "/var/lib/cyrus";
$dirs[] = "/var/lib/cyrus/db";
$dirs[] = "/var/lib/cyrus/socket";
$dirs[] = "/var/lib/cyrus/proc";
$dirs[] = "/var/run/cyrus/socket";
$dirs[] = "/var/spool/postfix/var/run/cyrus/socket";
$ln = $unix->find_program("ln");
$dirs[] = "{$POSTFIX_QUEUE_DIRECTORY}/var/run/cyrus";
while (list($num, $directory) = each($dirs)) {
if (!is_dir($directory)) {
@mkdir($directory, 0755, true);
}
$unix->chmod_func(0755, "{$directory}");
$unix->chown_func("cyrus", "mail", "{$directory}");
}
$unix->chown_func("cyrus", "cyrus", "/var/lib/cyrus");
if (!is_file("/var/lib/cyrus/user_deny.db")) {
@touch("/var/lib/cyrus/user_deny.db");
$unix->chown_func("cyrus", "mail", "/var/lib/cyrus/user_deny.db");
}
}
示例6: memboost
function memboost()
{
$workdir = "/var/lib/c_icap/temporary";
$sock = new sockets();
$unix = new unix();
$users = new usersMenus();
if (!$users->CORP_LICENSE) {
$umount = $unix->find_program("umount");
echo "Starting......: " . date("H:i:s") . "c-icap MemBoost license inactive...\n";
$mountedM = tmpfs_mounted_size();
if ($mountedM > 1) {
shell_exec("{$umount} -l {$workdir}");
}
return;
}
echo "Starting......: " . date("H:i:s") . "c-icap MemBoost `{$workdir}`\n";
$umount = $unix->find_program("umount");
$mount = $unix->find_program("mount");
$rm = $unix->find_program("rm");
$idbin = $unix->find_program("id");
$CiCAPMemBoost = $sock->GET_INFO("CiCAPMemBoost");
if (!is_numeric($CiCAPMemBoost)) {
$CiCAPMemBoost = 0;
}
if ($GLOBALS["VERBOSE"]) {
echo "Starting......: " . date("H:i:s") . "c-icap MemBoost -> {$CiCAPMemBoost} Mb\n";
}
$mountedM = tmpfs_mounted_size();
if ($GLOBALS["VERBOSE"]) {
echo "Starting......: " . date("H:i:s") . "c-icap mounted -> {$mountedM} Mb\n";
}
if ($CiCAPMemBoost < 2) {
if ($mountedM > 1) {
shell_exec("{$umount} -l {$workdir}");
}
return;
}
if ($CiCAPMemBoost == $mountedM) {
return;
}
$unix->SystemCreateUser("clamav", "clamav");
exec("{$idbin} clamav 2>&1", $results);
if (!preg_match("#uid=([0-9]+).*?gid=([0-9]+)#", @implode("", $results), $re)) {
echo "Starting......: " . date("H:i:s") . "c-icap MemBoost clamav no such user...\n";
return;
}
shell_exec("{$umount} -l {$workdir}");
$uid = $re[1];
$gid = $re[2];
recursive_remove_directory("{$workdir}");
@mkdir($workdir, 0755);
echo "Starting......: " . date("H:i:s") . "c-icap MemBoost clamav ({$uid}/{$gid})\n";
shell_exec("{$mount} -t tmpfs -o size={$CiCAPMemBoost}M,noauto,user,exec,uid={$uid},gid={$gid} tmpfs {$workdir}");
$mountedM = tmpfs_mounted_size();
if ($mountedM > 1) {
echo "Starting......: " . date("H:i:s") . "c-icap MemBoost mounted with {$mountedM}M\n";
} else {
echo "Starting......: " . date("H:i:s") . "c-icap MemBoost mounted failed\n";
}
}