function zfs_zpool_get_status()
{
    global $config;
    array_sort_key($config['zfs']['pools']['pool'], "name");
    array_sort_key($config['zfs']['vdevices']['vdevice'], "name");
    $a_pool = $config['zfs']['pools']['pool'];
    $a_vdevice = $config['zfs']['vdevices']['vdevice'];
    // Get zpool status informations
    $cmd = "zpool status -v";
    if (isset($_GET['pool'])) {
        $cmd .= " {$_GET['pool']}";
    }
    mwexec2($cmd, $rawdata);
    return implode("\n", $rawdata);
}
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
	POSSIBILITY OF SUCH DAMAGE.
*/
require "auth.inc";
require "guiconfig.inc";
$uuid = $_GET['uuid'];
if (isset($_POST['uuid'])) {
    $uuid = $_POST['uuid'];
}
$pgtitle = array(gettext("Network"), gettext("Interface Management"), gettext("Link Aggregation and Failover"), isset($uuid) ? gettext("Edit") : gettext("Add"));
if (!is_array($config['vinterfaces']['lagg'])) {
    $config['vinterfaces']['lagg'] = array();
}
$a_lagg =& $config['vinterfaces']['lagg'];
array_sort_key($a_lagg, "if");
if (isset($uuid) && FALSE !== ($cnid = array_search_ex($uuid, $a_lagg, "uuid"))) {
    $pconfig['enable'] = isset($a_lagg[$cnid]['enable']);
    $pconfig['uuid'] = $a_lagg[$cnid]['uuid'];
    $pconfig['if'] = $a_lagg[$cnid]['if'];
    $pconfig['laggproto'] = $a_lagg[$cnid]['laggproto'];
    $pconfig['laggport'] = $a_lagg[$cnid]['laggport'];
    $pconfig['desc'] = $a_lagg[$cnid]['desc'];
} else {
    $pconfig['enable'] = true;
    $pconfig['uuid'] = uuid();
    $pconfig['if'] = "lagg" . get_nextlagg_id();
    $pconfig['laggproto'] = "failover";
    $pconfig['laggport'] = array();
    $pconfig['desc'] = "";
}
	of the authors and should not be interpreted as representing official policies,
	either expressed or implied, of the NAS4Free Project.
*/
require "auth.inc";
require "guiconfig.inc";
if (isset($_GET['uuid'])) {
    $uuid = $_GET['uuid'];
}
if (isset($_POST['uuid'])) {
    $uuid = $_POST['uuid'];
}
$pgtitle = array(gettext("Disks"), gettext("Management"), gettext("iSCSI Initiator"), isset($uuid) ? gettext("Edit") : gettext("Add"));
if (!isset($config['iscsiinit']['vdisk']) || !is_array($config['iscsiinit']['vdisk'])) {
    $config['iscsiinit']['vdisk'] = array();
}
array_sort_key($config['iscsiinit']['vdisk'], "name");
$a_iscsiinit =& $config['iscsiinit']['vdisk'];
if (isset($uuid) && FALSE !== ($cnid = array_search_ex($uuid, $a_iscsiinit, "uuid"))) {
    $pconfig['uuid'] = $a_iscsiinit[$cnid]['uuid'];
    $pconfig['name'] = $a_iscsiinit[$cnid]['name'];
    $pconfig['targetname'] = $a_iscsiinit[$cnid]['targetname'];
    $pconfig['targetaddress'] = $a_iscsiinit[$cnid]['targetaddress'];
    $pconfig['initiatorname'] = $a_iscsiinit[$cnid]['initiatorname'];
} else {
    $pconfig['uuid'] = uuid();
    $pconfig['name'] = "";
    $pconfig['targetname'] = "";
    $pconfig['targetaddress'] = "";
    $pconfig['initiatorname'] = "iqn.2012-03.org.nas4free:nas4free";
}
if (isset($config['iscsitarget']['nodebase']) && !empty($config['iscsitarget']['nodebase'])) {
        if (!file_exists($d_sysrebootreqd_path)) {
            // Process notifications
            $retval = updatenotify_process("raid_gvinum", "gvinum_process_updatenotification");
        }
        $savemsg = get_std_save_message($retval);
        if ($retval == 0) {
            updatenotify_delete("raid_gvinum");
        }
        header("Location: disks_raid_gvinum.php");
        exit;
    }
}
if (!is_array($config['gvinum']['vdisk'])) {
    $config['gvinum']['vdisk'] = array();
}
array_sort_key($config['gvinum']['vdisk'], "name");
$a_raid =& $config['gvinum']['vdisk'];
if ($_GET['act'] === "del") {
    unset($errormsg);
    if ($a_raid[$_GET['id']]) {
        // Check if disk is mounted.
        if (0 == disks_ismounted_ex($a_raid[$_GET['id']]['devicespecialfile'], "devicespecialfile")) {
            updatenotify_set("raid_gvinum", UPDATENOTIFY_MODE_DIRTY, $a_raid[$_GET['id']]['uuid']);
            header("Location: disks_raid_gvinum.php");
            exit;
        } else {
            $errormsg = sprintf(gettext("The RAID volume is currently mounted! Remove the <a href='%s'>mount point</a> first before proceeding."), "disks_mount.php");
        }
    }
}
function gvinum_process_updatenotification($mode, $data)
示例#5
0
	LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
	ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
	(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
	SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

	The views and conclusions contained in the software and documentation are those
	of the authors and should not be interpreted as representing official policies,
	either expressed or implied, of the NAS4Free Project.
*/
require "auth.inc";
require "guiconfig.inc";
$pgtitle = array(gettext("Services"), gettext("NFS"));
if (!isset($config['nfsd']['share']) || !is_array($config['nfsd']['share'])) {
    $config['nfsd']['share'] = array();
}
array_sort_key($config['nfsd']['share'], "path");
$a_share =& $config['nfsd']['share'];
$pconfig['enable'] = isset($config['nfsd']['enable']);
$pconfig['v4enable'] = isset($config['nfsd']['v4enable']);
$pconfig['numproc'] = $config['nfsd']['numproc'];
if ($_POST) {
    unset($input_errors);
    $pconfig = $_POST;
    if (isset($_POST['enable']) && $_POST['enable']) {
        $reqdfields = explode(" ", "numproc");
        $reqdfieldsn = array(gettext("Number of servers"));
        $reqdfieldst = explode(" ", "numeric");
        do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
        do_input_validation_type($_POST, $reqdfields, $reqdfieldsn, $reqdfieldst, $input_errors);
    }
    if (empty($input_errors)) {
            config_unlock();
        }
        $savemsg = get_std_save_message($retval);
        if ($retval == 0) {
            if (get_hast_role() != 'secondary') {
                $savemsg .= "<br>";
                $savemsg .= sprintf(gettext("The reloading request has been sent to the daemon. You can see the result by <a href=\"%s\">Log</a>."), "diag_log.php?log=2");
            }
            updatenotify_delete("iscsitarget_ig");
        }
    }
}
if (!isset($config['iscsitarget']['initiatorgroup']) || !is_array($config['iscsitarget']['initiatorgroup'])) {
    $config['iscsitarget']['initiatorgroup'] = array();
}
array_sort_key($config['iscsitarget']['initiatorgroup'], "tag");
$a_iscsitarget_ig =& $config['iscsitarget']['initiatorgroup'];
if (!isset($config['iscsitarget']['target']) || !is_array($config['iscsitarget']['target'])) {
    $config['iscsitarget']['target'] = array();
}
if (isset($_GET['act']) && $_GET['act'] === "del") {
    $index = array_search_ex($_GET['uuid'], $config['iscsitarget']['initiatorgroup'], "uuid");
    if ($index !== false) {
        $ig = $config['iscsitarget']['initiatorgroup'][$index];
        foreach ($config['iscsitarget']['target'] as $target) {
            if (isset($target['pgigmap'])) {
                foreach ($target['pgigmap'] as $pgigmap) {
                    if ($pgigmap['igtag'] == $ig['tag']) {
                        $input_errors[] = gettext("This tag is used.");
                    }
                }
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
	POSSIBILITY OF SUCH DAMAGE.
*/
require "auth.inc";
require "guiconfig.inc";
$uuid = $_GET['uuid'];
if (isset($_POST['uuid'])) {
    $uuid = $_POST['uuid'];
}
$pgtitle = array(gettext("Network"), gettext("Static routes"), isset($uuid) ? gettext("Edit") : gettext("Add"));
if (!is_array($config['staticroutes']['route'])) {
    $config['staticroutes']['route'] = array();
}
array_sort_key($config['staticroutes']['route'], "network");
$a_routes =& $config['staticroutes']['route'];
if (isset($uuid) && FALSE !== ($cnid = array_search_ex($uuid, $a_routes, "uuid"))) {
    $pconfig['uuid'] = $a_routes[$cnid]['uuid'];
    $pconfig['interface'] = $a_routes[$cnid]['interface'];
    list($pconfig['network'], $pconfig['network_subnet']) = explode('/', $a_routes[$cnid]['network']);
    $pconfig['gateway'] = $a_routes[$cnid]['gateway'];
    $pconfig['descr'] = $a_routes[$cnid]['descr'];
} else {
    $pconfig['uuid'] = uuid();
    $pconfig['gateway'] = "";
    $pconfig['descr'] = "";
}
if ($_POST) {
    unset($input_errors);
    $pconfig = $_POST;
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
	POSSIBILITY OF SUCH DAMAGE.
*/
require "auth.inc";
require "guiconfig.inc";
$id = $_GET['id'];
if (isset($_POST['id'])) {
    $id = $_POST['id'];
}
$pgtitle = array(gettext("Disks"), gettext("Software RAID"), gettext("RAID1"), isset($id) ? gettext("Edit") : gettext("Add"));
if (!is_array($config['gmirror']['vdisk'])) {
    $config['gmirror']['vdisk'] = array();
}
array_sort_key($config['gmirror']['vdisk'], "name");
$a_raid =& $config['gmirror']['vdisk'];
$all_raid = get_conf_sraid_disks_list();
$a_disk = get_conf_disks_filtered_ex("fstype", "softraid");
if (!sizeof($a_disk)) {
    $nodisk_errors[] = gettext("You must add disks first.");
}
if (isset($id) && $a_raid[$id]) {
    $pconfig['uuid'] = $a_raid[$id]['uuid'];
    $pconfig['name'] = $a_raid[$id]['name'];
    $pconfig['devicespecialfile'] = $a_raid[$id]['devicespecialfile'];
    $pconfig['type'] = $a_raid[$id]['type'];
    $pconfig['balance'] = $a_raid[$id]['balance'];
    $pconfig['device'] = $a_raid[$id]['device'];
}
if ($_POST) {
示例#9
0
	ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
	(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
	SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

	The views and conclusions contained in the software and documentation are those
	of the authors and should not be interpreted as representing official policies,
	either expressed or implied, of the NAS4Free Project.
*/
require "auth.inc";
require "guiconfig.inc";
require "zfs.inc";
$pgtitle = array(gettext("Disks"), gettext("ZFS"), gettext("Datasets"), gettext("Dataset"));
if (!isset($config['zfs']['datasets']['dataset']) || !is_array($config['zfs']['datasets']['dataset'])) {
    $config['zfs']['datasets']['dataset'] = array();
}
array_sort_key($config['zfs']['datasets']['dataset'], "name");
$a_dataset =& $config['zfs']['datasets']['dataset'];
if ($_POST) {
    $pconfig = $_POST;
    if (isset($_POST['apply']) && $_POST['apply']) {
        $retval = 0;
        if (!file_exists($d_sysrebootreqd_path)) {
            // Process notifications
            $retval |= updatenotify_process("zfsdataset", "zfsdataset_process_updatenotification");
        }
        $savemsg = get_std_save_message($retval);
        if ($retval == 0) {
            updatenotify_delete("zfsdataset");
        }
        header("Location: disks_zfs_dataset.php");
        exit;
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
	POSSIBILITY OF SUCH DAMAGE.
*/
require "auth.inc";
require "guiconfig.inc";
$pgtitle = array(gettext("Disks"), gettext("Mount Point"), gettext("Fsck"));
if (!is_array($config['mounts']['mount'])) {
    $config['mounts']['mount'] = array();
}
array_sort_key($config['mounts']['mount'], "devicespecialfile");
$a_mount = $config['mounts']['mount'];
if ($_POST) {
    unset($input_errors);
    unset($errormsg);
    unset($do_action);
    // Input validation
    $reqdfields = explode(" ", "disk");
    $reqdfieldsn = array(gettext("Disk"));
    do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
    if (!$input_errors) {
        $do_action = true;
        $disk = $_POST['disk'];
        $umount = $_POST['umount'] ? true : false;
    }
}
$MAX_AUTHUSERS = 4;
$GROW_AUTHUSERS = 4;
if (!isset($config['iscsitarget']['authgroup']) || !is_array($config['iscsitarget']['authgroup'])) {
    $config['iscsitarget']['authgroup'] = array();
}
array_sort_key($config['iscsitarget']['authgroup'], "tag");
$a_iscsitarget_ag =& $config['iscsitarget']['authgroup'];
if (isset($uuid) && FALSE !== ($cnid = array_search_ex($uuid, $a_iscsitarget_ag, "uuid"))) {
    $pconfig['uuid'] = $a_iscsitarget_ag[$cnid]['uuid'];
    $pconfig['tag'] = $a_iscsitarget_ag[$cnid]['tag'];
    $pconfig['comment'] = $a_iscsitarget_ag[$cnid]['comment'];
    $i = 1;
    if (!isset($a_iscsitarget_ag[$cnid]['agauth']) || !is_array($a_iscsitarget_ag[$cnid]['agauth'])) {
        $a_iscsitarget_ag[$cnid]['agauth'] = array();
    }
    array_sort_key($a_iscsitarget_ag[$cnid]['agauth'], "authuser");
    foreach ($a_iscsitarget_ag[$cnid]['agauth'] as $agauth) {
        $pconfig["user{$i}"] = $agauth['authuser'];
        $pconfig["secret{$i}"] = $agauth['authsecret'];
        $pconfig["secret2{$i}"] = $pconfig["secret{$i}"];
        $pconfig["muser{$i}"] = $agauth['authmuser'];
        $pconfig["msecret{$i}"] = $agauth['authmsecret'];
        $pconfig["msecret2{$i}"] = $pconfig["msecret{$i}"];
        $i++;
    }
    while ($i > $MAX_AUTHUSERS) {
        $MAX_AUTHUSERS += $GROW_AUTHUSERS;
    }
} else {
    // Find next unused tag.
    $tag = 1;
            config_unlock();
        }
        $savemsg = get_std_save_message($retval);
        if ($retval == 0) {
            if (get_hast_role() != 'secondary') {
                $savemsg .= "<br>";
                $savemsg .= sprintf(gettext("The reloading request has been sent to the daemon. You can see the result by <a href=\"%s\">Log</a>."), "diag_log.php?log=2");
            }
            updatenotify_delete("iscsitarget_pg");
        }
    }
}
if (!isset($config['iscsitarget']['portalgroup']) || !is_array($config['iscsitarget']['portalgroup'])) {
    $config['iscsitarget']['portalgroup'] = array();
}
array_sort_key($config['iscsitarget']['portalgroup'], "tag");
$a_iscsitarget_pg =& $config['iscsitarget']['portalgroup'];
if (!isset($config['iscsitarget']['target']) || !is_array($config['iscsitarget']['target'])) {
    $config['iscsitarget']['target'] = array();
}
if (isset($_GET['act']) && $_GET['act'] === "del") {
    $index = array_search_ex($_GET['uuid'], $config['iscsitarget']['portalgroup'], "uuid");
    if ($index !== false) {
        $pg = $config['iscsitarget']['portalgroup'][$index];
        foreach ($config['iscsitarget']['target'] as $target) {
            if (isset($target['pgigmap'])) {
                foreach ($target['pgigmap'] as $pgigmap) {
                    if ($pgigmap['pgtag'] == $pg['tag']) {
                        $input_errors[] = gettext("This tag is used.");
                    }
                }
?>
</td>
          <td width="25%" class="listhdrr"><?php 
echo gettext("Comment");
?>
</td>
          <td width="10%" class="list"></td>
        </tr>
        <?php 
foreach ($config['iscsitarget']['authgroup'] as $ag) {
    ?>
        <?php 
    if (!isset($ag['agauth']) || !is_array($ag['agauth'])) {
        $ag['agauth'] = array();
    }
    array_sort_key($ag['agauth'], "authuser");
    ?>
        <?php 
    $notificationmode = updatenotify_get_mode("iscsitarget_ag", $ag['uuid']);
    ?>
        <tr>
          <td class="listlr"><?php 
    echo htmlspecialchars($ag['tag']);
    ?>
&nbsp;</td>
          <td class="listr">
          <?php 
    if (count($ag['agauth']) == 0) {
        echo "&nbsp;";
    }
    ?>
	LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
	ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
	(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
	SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

	The views and conclusions contained in the software and documentation are those
	of the authors and should not be interpreted as representing official policies,
	either expressed or implied, of the NAS4Free Project.
*/
require "auth.inc";
require "guiconfig.inc";
$pgtitle = array(gettext("Disks"), gettext("Software RAID"), gettext("RAID5"), gettext("Tools"));
if (!isset($config['graid5']['vdisk']) || !is_array($config['graid5']['vdisk'])) {
    $config['graid5']['vdisk'] = array();
}
array_sort_key($config['graid5']['vdisk'], "name");
$a_raid =& $config['graid5']['vdisk'];
if ($_POST) {
    unset($input_errors);
    unset($do_action);
    /* input validation */
    $reqdfields = explode(" ", "action raid disk");
    $reqdfieldsn = array(gettext("Command"), gettext("Volume Name"), gettext("Disk"));
    do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
    if (empty($input_errors)) {
        $do_action = true;
        $action = $_POST['action'];
        $raid = $_POST['raid'];
        $disk = $_POST['disk'];
    }
}
    echo $pool['name'];
    ?>
": {
			<?php 
    $result = array();
    foreach ($pool['vdevice'] as $vdevicev) {
        $index = array_search_ex($vdevicev, $a_vdevice, "name");
        $vdevice = $a_vdevice[$index];
        foreach ($vdevice['device'] as $devicev) {
            $a_disk = get_conf_disks_filtered_ex("fstype", "zfs");
            $index = array_search_ex($devicev, $a_disk, "devicespecialfile");
            $result[] = $a_disk[$index];
        }
    }
    $i = 0;
    array_sort_key($result, "name");
    foreach ($result as $disk) {
        $checked = "";
        if (is_array($pconfig['device'])) {
            foreach ($pconfig['device'] as $devicev) {
                if ($devicev === $disk['name']) {
                    $checked = " checked=\"checked\"";
                    break;
                }
            }
        } else {
            if ($pconfig['device'] === $disk['name']) {
                $checked = " checked=\"checked\"";
            }
        }
        ?>
示例#16
0
require "zfs.inc";
if (isset($_GET['uuid'])) {
    $uuid = $_GET['uuid'];
}
if (isset($_POST['uuid'])) {
    $uuid = $_POST['uuid'];
}
$pgtitle = array(gettext("Disks"), gettext("ZFS"), gettext("Pools"), gettext("Management"), isset($uuid) ? gettext("Edit") : gettext("Add"));
if (!isset($config['zfs']['pools']['pool']) || !is_array($config['zfs']['pools']['pool'])) {
    $config['zfs']['pools']['pool'] = array();
}
if (!isset($config['zfs']['vdevices']['vdevice']) || !is_array($config['zfs']['vdevices']['vdevice'])) {
    $config['zfs']['vdevices']['vdevice'] = array();
}
array_sort_key($config['zfs']['pools']['pool'], "name");
array_sort_key($config['zfs']['vdevices']['vdevice'], "name");
$a_pool =& $config['zfs']['pools']['pool'];
$a_vdevice =& $config['zfs']['vdevices']['vdevice'];
if (!isset($uuid) && !sizeof($a_vdevice)) {
    $errormsg = sprintf(gettext("No configured virtual devices. Please add new <a href='%s'>virtual device</a> first."), "disks_zfs_zpool_vdevice.php");
}
if (isset($uuid) && FALSE !== ($cnid = array_search_ex($uuid, $a_pool, "uuid"))) {
    $pconfig['uuid'] = $a_pool[$cnid]['uuid'];
    $pconfig['name'] = $a_pool[$cnid]['name'];
    $pconfig['vdevice'] = $a_pool[$cnid]['vdevice'];
    $pconfig['root'] = $a_pool[$cnid]['root'];
    $pconfig['mountpoint'] = $a_pool[$cnid]['mountpoint'];
    $pconfig['force'] = isset($a_dataset[$cnid]['force']);
    $pconfig['desc'] = $a_pool[$cnid]['desc'];
} else {
    $pconfig['uuid'] = uuid();
function sysctl_tune($mode)
{
    global $config;
    if (!is_array($config['system']['sysctl']['param'])) {
        $config['system']['sysctl']['param'] = array();
    }
    array_sort_key($config['system']['sysctl']['param'], "name");
    $a_sysctlvar =& $config['system']['sysctl']['param'];
    $a_mib = array("net.inet.tcp.delayed_ack" => 0, "net.inet.tcp.rfc1323" => 1, "net.inet.tcp.sendspace" => 262144, "net.inet.tcp.recvspace" => 262144, "net.inet.udp.recvspace" => 65536, "net.inet.udp.maxdgram" => 57344, "net.local.stream.recvspace" => 65536, "net.local.stream.sendspace" => 65536, "kern.ipc.maxsockbuf" => 2097152, "kern.ipc.somaxconn" => 8192, "kern.ipc.nmbclusters" => 32768, "kern.maxfiles" => 65536, "kern.maxfilesperproc" => 32768, "net.inet.icmp.icmplim" => 300, "net.inet.icmp.icmplim_output" => 1, "net.inet.tcp.inflight.enable" => 0, "net.inet.tcp.path_mtu_discovery" => 0);
    switch ($mode) {
        case 0:
            // Remove system tune MIB's.
            while (list($name, $value) = each($a_mib)) {
                $id = array_search_ex($name, $a_sysctlvar, "name");
                if (false === $id) {
                    continue;
                }
                unset($a_sysctlvar[$id]);
            }
            break;
        case 1:
            // Add system tune MIB's.
            while (list($name, $value) = each($a_mib)) {
                $id = array_search_ex($name, $a_sysctlvar, "name");
                if (false !== $id) {
                    continue;
                }
                $param = array();
                $param['uuid'] = uuid();
                $param['name'] = $name;
                $param['value'] = $value;
                $param['comment'] = gettext("System tuning");
                $param['enable'] = true;
                $a_sysctlvar[] = $param;
            }
            break;
    }
}
示例#18
0
	of the authors and should not be interpreted as representing official policies,
	either expressed or implied, of the NAS4Free Project.
*/
require "auth.inc";
require "guiconfig.inc";
if (isset($_GET['uuid'])) {
    $uuid = $_GET['uuid'];
}
if (isset($_POST['uuid'])) {
    $uuid = $_POST['uuid'];
}
$pgtitle = array(gettext("System"), gettext("Advanced"), gettext("rc.conf"), isset($uuid) ? gettext("Edit") : gettext("Add"));
if (!isset($config['system']['rcconf']['param']) || !is_array($config['system']['rcconf']['param'])) {
    $config['system']['rcconf']['param'] = array();
}
array_sort_key($config['system']['rcconf']['param'], "name");
$a_rcvar =& $config['system']['rcconf']['param'];
if (isset($uuid) && FALSE !== ($cnid = array_search_ex($uuid, $a_rcvar, "uuid"))) {
    $pconfig['enable'] = isset($a_rcvar[$cnid]['enable']);
    $pconfig['uuid'] = $a_rcvar[$cnid]['uuid'];
    $pconfig['name'] = $a_rcvar[$cnid]['name'];
    $pconfig['value'] = $a_rcvar[$cnid]['value'];
    $pconfig['comment'] = $a_rcvar[$cnid]['comment'];
} else {
    $pconfig['enable'] = true;
    $pconfig['uuid'] = uuid();
    $pconfig['name'] = "";
    $pconfig['value'] = "";
    $pconfig['comment'] = "";
}
if ($_POST) {
示例#19
0
*/
require "auth.inc";
require "guiconfig.inc";
if (isset($_GET['uuid'])) {
    $uuid = $_GET['uuid'];
}
if (isset($_POST['uuid'])) {
    $uuid = $_POST['uuid'];
}
$pgtitle = array(gettext("Disks"), gettext("Management"), gettext("Disk"), isset($uuid) ? gettext("Edit") : gettext("Add"));
// Get all physical disks including CDROM.
$a_phy_disk = array_merge((array) get_physical_disks_list(), (array) get_cdrom_list());
if (!isset($config['disks']['disk']) || !is_array($config['disks']['disk'])) {
    $config['disks']['disk'] = array();
}
array_sort_key($config['disks']['disk'], "name");
$a_disk =& $config['disks']['disk'];
if (isset($uuid) && FALSE !== ($cnid = array_search_ex($uuid, $a_disk, "uuid"))) {
    $pconfig['uuid'] = $a_disk[$cnid]['uuid'];
    $pconfig['name'] = $a_disk[$cnid]['name'];
    $pconfig['id'] = $a_disk[$cnid]['id'];
    $pconfig['devicespecialfile'] = $a_disk[$cnid]['devicespecialfile'];
    $pconfig['model'] = $a_disk[$cnid]['model'];
    $pconfig['desc'] = $a_disk[$cnid]['desc'];
    $pconfig['serial'] = $a_disk[$cnid]['serial'];
    $pconfig['harddiskstandby'] = $a_disk[$cnid]['harddiskstandby'];
    $pconfig['acoustic'] = $a_disk[$cnid]['acoustic'];
    $pconfig['apm'] = $a_disk[$cnid]['apm'];
    $pconfig['transfermode'] = $a_disk[$cnid]['transfermode'];
    $pconfig['fstype'] = $a_disk[$cnid]['fstype'];
    $pconfig['controller'] = $a_disk[$cnid]['controller'];
示例#20
0
            $retval |= updatenotify_process("rsyncd", "rsyncd_process_updatenotification");
            config_lock();
            $retval |= rc_update_service("rsyncd");
            $retval |= rc_update_service("mdnsresponder");
            config_unlock();
        }
        $savemsg = get_std_save_message($retval);
        if ($retval == 0) {
            updatenotify_delete("rsyncd");
        }
    }
}
if (!isset($config['rsyncd']['module']) || !is_array($config['rsyncd']['module'])) {
    $config['rsyncd']['module'] = array();
}
array_sort_key($config['rsyncd']['module'], "name");
$a_module =& $config['rsyncd']['module'];
if (isset($_GET['act']) && $_GET['act'] === "del") {
    updatenotify_set("rsyncd", UPDATENOTIFY_MODE_DIRTY, $_GET['uuid']);
    header("Location: services_rsyncd_module.php");
    exit;
}
function rsyncd_process_updatenotification($mode, $data)
{
    global $config;
    $retval = 0;
    switch ($mode) {
        case UPDATENOTIFY_MODE_NEW:
        case UPDATENOTIFY_MODE_MODIFIED:
            break;
        case UPDATENOTIFY_MODE_DIRTY:
示例#21
0
            $retval |= updatenotify_process("afpshare", "afpshare_process_updatenotification");
            config_lock();
            $retval |= rc_update_service("afpd");
            $retval |= rc_update_service("mdnsresponder");
            config_unlock();
        }
        $savemsg = get_std_save_message($retval);
        if ($retval == 0) {
            updatenotify_delete("afpshare");
        }
    }
}
if (!isset($config['afp']['share']) || !is_array($config['afp']['share'])) {
    $config['afp']['share'] = array();
}
array_sort_key($config['afp']['share'], "name");
$a_share =& $config['afp']['share'];
if (isset($_GET['act']) && $_GET['act'] === "del") {
    updatenotify_set("afpshare", UPDATENOTIFY_MODE_DIRTY, $_GET['uuid']);
    header("Location: services_afp_share.php");
    exit;
}
function afpshare_process_updatenotification($mode, $data)
{
    global $config;
    $retval = 0;
    switch ($mode) {
        case UPDATENOTIFY_MODE_NEW:
        case UPDATENOTIFY_MODE_MODIFIED:
            break;
        case UPDATENOTIFY_MODE_DIRTY:
示例#22
0
	of the authors and should not be interpreted as representing official policies,
	either expressed or implied, of the NAS4Free Project.
*/
require "auth.inc";
require "guiconfig.inc";
if (isset($_GET['uuid'])) {
    $uuid = $_GET['uuid'];
}
if (isset($_POST['uuid'])) {
    $uuid = $_POST['uuid'];
}
$pgtitle = array(gettext("Network"), gettext("Firewall"), gettext("Rule"), isset($uuid) ? gettext("Edit") : gettext("Add"));
if (!isset($config['system']['firewall']['rule']) || !is_array($config['system']['firewall']['rule'])) {
    $config['system']['firewall']['rule'] = array();
}
array_sort_key($config['system']['firewall']['rule'], "ruleno");
$a_rule =& $config['system']['firewall']['rule'];
if (isset($uuid) && FALSE !== ($cnid = array_search_ex($uuid, $a_rule, "uuid"))) {
    $pconfig['uuid'] = $a_rule[$cnid]['uuid'];
    $pconfig['enable'] = isset($a_rule[$cnid]['enable']);
    $pconfig['ruleno'] = $a_rule[$cnid]['ruleno'];
    $pconfig['action'] = $a_rule[$cnid]['action'];
    $pconfig['log'] = isset($a_rule[$cnid]['log']);
    $pconfig['protocol'] = $a_rule[$cnid]['protocol'];
    $pconfig['src'] = $a_rule[$cnid]['src'];
    $pconfig['srcport'] = $a_rule[$cnid]['srcport'];
    $pconfig['dst'] = $a_rule[$cnid]['dst'];
    $pconfig['dstport'] = $a_rule[$cnid]['dstport'];
    $pconfig['direction'] = $a_rule[$cnid]['direction'];
    $pconfig['if'] = $a_rule[$cnid]['if'];
    $pconfig['extraoptions'] = $a_rule[$cnid]['extraoptions'];
示例#23
0
	of the authors and should not be interpreted as representing official policies,
	either expressed or implied, of the NAS4Free Project.
*/
require "auth.inc";
require "guiconfig.inc";
if (isset($_GET['uuid'])) {
    $uuid = $_GET['uuid'];
}
if (isset($_POST['uuid'])) {
    $uuid = $_POST['uuid'];
}
$pgtitle = array(gettext("Network"), gettext("Hosts"), isset($uuid) ? gettext("Edit") : gettext("Add"));
if (!isset($config['system']['hosts']) || !is_array($config['system']['hosts'])) {
    $config['system']['hosts'] = array();
}
array_sort_key($config['system']['hosts'], "name");
$a_hosts =& $config['system']['hosts'];
if (isset($uuid) && FALSE !== ($cnid = array_search_ex($uuid, $a_hosts, "uuid"))) {
    $pconfig['uuid'] = $a_hosts[$cnid]['uuid'];
    $pconfig['name'] = $a_hosts[$cnid]['name'];
    $pconfig['address'] = $a_hosts[$cnid]['address'];
    $pconfig['descr'] = $a_hosts[$cnid]['descr'];
} else {
    $pconfig['uuid'] = uuid();
    $pconfig['name'] = "";
    $pconfig['address'] = "";
    $pconfig['descr'] = "";
}
if ($_POST) {
    unset($input_errors);
    $pconfig = $_POST;
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
	POSSIBILITY OF SUCH DAMAGE.
*/
require "auth.inc";
require "guiconfig.inc";
require "zfs.inc";
$pgtitle = array(gettext("Disks"), gettext("ZFS"), gettext("Pools"), gettext("Management"));
if (!isset($config['zfs']['pools']) || !is_array($config['zfs']['pools']['pool'])) {
    $config['zfs']['pools']['pool'] = array();
}
array_sort_key($config['zfs']['pools']['pool'], "name");
$a_pool =& $config['zfs']['pools']['pool'];
if ($_POST) {
    $pconfig = $_POST;
    if ($_POST['apply']) {
        $retval = 0;
        if (!file_exists($d_sysrebootreqd_path)) {
            // Process notifications
            updatenotify_process("zfszpool", "zfszpool_process_updatenotification");
        }
        $savemsg = get_std_save_message($retval);
        if ($retval == 0) {
            updatenotify_delete("zfszpool");
        }
        header("Location: disks_zfs_zpool.php");
        exit;
	of the authors and should not be interpreted as representing official policies,
	either expressed or implied, of the NAS4Free Project.
*/
require "auth.inc";
require "guiconfig.inc";
if (isset($_GET['uuid'])) {
    $uuid = $_GET['uuid'];
}
if (isset($_POST['uuid'])) {
    $uuid = $_POST['uuid'];
}
$pgtitle = array(gettext("Access"), gettext("Groups"), isset($uuid) ? gettext("Edit") : gettext("Add"));
if (!isset($config['access']['group']) || !is_array($config['access']['group'])) {
    $config['access']['group'] = array();
}
array_sort_key($config['access']['group'], "name");
$a_group =& $config['access']['group'];
$a_group_system = system_get_group_list();
if (isset($uuid) && FALSE !== ($cnid = array_search_ex($uuid, $a_group, "uuid"))) {
    $pconfig['uuid'] = $a_group[$cnid]['uuid'];
    $pconfig['groupid'] = $a_group[$cnid]['id'];
    $pconfig['name'] = $a_group[$cnid]['name'];
    $pconfig['desc'] = $a_group[$cnid]['desc'];
} else {
    $pconfig['uuid'] = uuid();
    $pconfig['groupid'] = get_nextgroup_id();
    $pconfig['name'] = "";
    $pconfig['desc'] = "";
}
if ($_POST) {
    unset($input_errors);
示例#26
0
}
$pconfig['enable'] = isset($config['hast']['enable']);
//$pconfig['role'] = $config['hast']['role'];
$pconfig['auxparam'] = implode("\n", $config['hast']['auxparam']);
$pconfig['alertemail'] = $config['hast']['alertemail'];
$pconfig['alertemailto'] = $config['hast']['alertemailto'];
$nodeid = @exec("/sbin/sysctl -q -n kern.hostuuid");
if (empty($nodeid)) {
    $nodeid = "unknown";
}
$nodename = system_get_hostname();
if (empty($nodename)) {
    $nodename = "unknown";
}
$a_carp =& $config['vinterfaces']['carp'];
array_sort_key($a_carp, "if");
$a_cronjob =& $config['cron']['job'];
$alert_script = '/etc/inc/hast_alerts.php';
$cnid = isset($config['hast']['alertemailcronuuid']) ? array_search_ex($config['hast']['alertemailcronuuid'], $a_cronjob, "uuid") : false;
if (!sizeof($a_carp)) {
    $errormsg = sprintf(gettext("No configured CARP interfaces. Please add new <a href='%s'>CARP interface</a> first."), "interfaces_carp.php");
}
if ($_POST) {
    unset($input_errors);
    unset($errormsg);
    $pconfig = $_POST;
    $preempt = @exec("/sbin/sysctl -q -n net.inet.carp.preempt");
    if (isset($_POST['switch_backup']) && $_POST['switch_backup']) {
        // down all carp
        foreach ($a_carp as $carp) {
            //system("/sbin/ifconfig {$carp['if']} down");
示例#27
0
	ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
	(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
	SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

	The views and conclusions contained in the software and documentation are those
	of the authors and should not be interpreted as representing official policies,
	either expressed or implied, of the NAS4Free Project.
*/
require "auth.inc";
require "guiconfig.inc";
$pgtitle = array(gettext("Network"), gettext("Interface Management"), gettext("VLAN"));
if (!isset($config['vinterfaces']['vlan']) || !is_array($config['vinterfaces']['vlan'])) {
    $config['vinterfaces']['vlan'] = array();
}
$a_vlan =& $config['vinterfaces']['vlan'];
array_sort_key($a_vlan, "if");
function vlan_inuse($ifn)
{
    global $config, $g;
    if ($config['interfaces']['lan']['if'] === $ifn) {
        return true;
    }
    if (isset($config['interfaces']['wan']) && $config['interfaces']['wan']['if'] === $ifn) {
        return true;
    }
    for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
        if ($config['interfaces']['opt' . $i]['if'] === $ifn) {
            return true;
        }
    }
    return false;
	of the authors and should not be interpreted as representing official policies,
	either expressed or implied, of the NAS4Free Project.
*/
require "auth.inc";
require "guiconfig.inc";
if (isset($_GET['id'])) {
    $id = $_GET['id'];
}
if (isset($_POST['id'])) {
    $id = $_POST['id'];
}
$pgtitle = array(gettext("Disks"), gettext("Software RAID"), gettext("RAID0"), isset($id) ? gettext("Edit") : gettext("Add"));
if (!isset($config['gstripe']['vdisk']) || !is_array($config['gstripe']['vdisk'])) {
    $config['gstripe']['vdisk'] = array();
}
array_sort_key($config['gstripe']['vdisk'], "name");
$a_raid =& $config['gstripe']['vdisk'];
$all_raid = get_conf_sraid_disks_list();
$a_disk = get_conf_disks_filtered_ex("fstype", "softraid");
if (!sizeof($a_disk)) {
    $nodisk_errors[] = gettext("You must add disks first.");
}
if (isset($id) && $a_raid[$id]) {
    $pconfig['uuid'] = $a_raid[$id]['uuid'];
    $pconfig['name'] = $a_raid[$id]['name'];
    $pconfig['devicespecialfile'] = $a_raid[$id]['devicespecialfile'];
    $pconfig['type'] = $a_raid[$id]['type'];
    $pconfig['device'] = $a_raid[$id]['device'];
} else {
    $pconfig['uuid'] = uuid();
    $pconfig['name'] = "";
	of the authors and should not be interpreted as representing official policies,
	either expressed or implied, of the NAS4Free Project.
*/
require "auth.inc";
require "guiconfig.inc";
if (isset($_GET['uuid'])) {
    $uuid = $_GET['uuid'];
}
if (isset($_POST['uuid'])) {
    $uuid = $_POST['uuid'];
}
$pgtitle = array(gettext("Services"), gettext("HAST"), isset($uuid) ? gettext("Edit") : gettext("Add"));
if (!isset($config['hast']['hastresource']) || !is_array($config['hast']['hastresource'])) {
    $config['hast']['hastresource'] = array();
}
array_sort_key($config['hast']['hastresource'], "name");
$a_resource =& $config['hast']['hastresource'];
if (isset($uuid) && FALSE !== ($cnid = array_search_ex($uuid, $a_resource, "uuid"))) {
    $pconfig['uuid'] = $a_resource[$cnid]['uuid'];
    $pconfig['name'] = $a_resource[$cnid]['name'];
    $pconfig['auxparam'] = "";
    if (isset($a_resource[$cnid]['auxparam']) && is_array($a_resource[$cnid]['auxparam'])) {
        $pconfig['auxparam'] = implode("\n", $a_resource[$cnid]['auxparam']);
    }
    $pconfig['aname'] = $a_resource[$cnid]['aname'];
    $pconfig['apath'] = $a_resource[$cnid]['apath'];
    $pconfig['aremoteaddr'] = $a_resource[$cnid]['aremoteaddr'];
    $pconfig['bname'] = $a_resource[$cnid]['bname'];
    $pconfig['bpath'] = $a_resource[$cnid]['bpath'];
    $pconfig['bremoteaddr'] = $a_resource[$cnid]['bremoteaddr'];
} else {
示例#30
0
	LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
	ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
	(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
	SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

	The views and conclusions contained in the software and documentation are those
	of the authors and should not be interpreted as representing official policies,
	either expressed or implied, of the NAS4Free Project.
*/
require "auth.inc";
require "guiconfig.inc";
$pgtitle = array(gettext("Disks"), gettext("Encryption"), gettext("Add"));
if (!isset($config['geli']['vdisk']) || !is_array($config['geli']['vdisk'])) {
    $config['geli']['vdisk'] = array();
}
array_sort_key($config['geli']['vdisk'], "devicespecialfile");
$a_geli =& $config['geli']['vdisk'];
// Get list of all configured disks (physical and virtual).
$a_alldisk = get_conf_all_disks_list_filtered();
// Check whether there are disks configured, othersie display a error message.
if (!count($a_alldisk)) {
    $nodisks_error = gettext("You must add disks first.");
}
// Check if protocol is HTTPS, otherwise display a warning message.
if ("http" === $config['system']['webgui']['protocol']) {
    $nohttps_error = gettext("You should use HTTPS as WebGUI protocol for sending passphrase.");
}
if ($_POST) {
    unset($input_errors);
    unset($errormsg);
    $pconfig = $_POST;