Просмотр исходного кода

- create acl for customers
- fixed perl library pasth in scripts
- draft 5.2.3 release

root 1 год назад
Родитель
Сommit
d1aabc537f

+ 35 - 2
docs/mysql/mysql.sql

@@ -203,14 +203,14 @@ CREATE TABLE `Customers` (
   `Login` varchar(20) DEFAULT 'NULL',
   `password` varchar(255) DEFAULT 'NULL',
   `api_key` varchar(255) DEFAULT NULL,
-  `readonly` tinyint(1) NOT NULL DEFAULT 0
+  `rights` tinyint(1) NOT NULL DEFAULT 3
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
 
 --
 -- Дамп данных таблицы `Customers`
 --
 
-INSERT INTO `Customers` (`id`, `Login`, `password`, `api_key`, `readonly`) VALUES(1, 'admin', '$2y$11$wohV8Tuqu0Yai9Shacei5OKfMxG5bnLxB5ACcZcJJ3pYEbIH0qLGG', 'c3284d0f94606de1fd2af172aba15bf31', 0);
+INSERT INTO `Customers` (`id`, `Login`, `password`, `api_key`, `rights`) VALUES(1, 'admin', '$2y$11$wohV8Tuqu0Yai9Shacei5OKfMxG5bnLxB5ACcZcJJ3pYEbIH0qLGG', 'c3284d0f94606de1fd2af172aba15bf31', 1);
 
 -- --------------------------------------------------------
 
@@ -1010,10 +1010,37 @@ INSERT INTO `vendors` (`id`, `name`) VALUES(66, 'Trassir');
 INSERT INTO `vendors` (`id`, `name`) VALUES(67, 'Testo');
 INSERT INTO `vendors` (`id`, `name`) VALUES(68, 'Hw-group');
 
+-- --------------------------------------------------------
+
+--
+-- Структура таблицы `acl`
+--
+
+CREATE TABLE `acl` (
+  `id` int(11) NOT NULL,
+  `name` varchar(30) NOT NULL,
+  `description.english` varchar(250) NOT NULL,
+  `description.russian` varchar(250) NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+
+--
+-- Дамп данных таблицы `acl`
+--
+
+INSERT INTO `acl` VALUES(1, 'Full access', 'Full access', 'Полный доступ');
+INSERT INTO `acl` VALUES(2, 'Operator', 'Editing parameters that are not related to access rights', 'Редактирование параметров, не связанных с правами доступа');
+INSERT INTO `acl` VALUES(3, 'View only', 'View only', 'Только просмотр');
+
 --
 -- Индексы сохранённых таблиц
 --
 
+--
+-- Индексы таблицы `acl`
+--
+ALTER TABLE `acl`
+  ADD PRIMARY KEY (`id`);
+
 --
 -- Индексы таблицы `version`
 --
@@ -1456,6 +1483,12 @@ ALTER TABLE `User_stats_full`
 ALTER TABLE `variables`
   MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
 
+--
+-- AUTO_INCREMENT для таблицы `acl`
+--
+ALTER TABLE `acl`
+  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
+
 --
 -- AUTO_INCREMENT для таблицы `vendors`
 --

+ 8 - 8
html/admin/customers/editcustom.php

@@ -14,7 +14,7 @@ if (isset($_POST["edituser"])) {
     if (isset($_POST["api_key"]) and (strlen(trim($_POST["api_key"])) > 20)) {
         $new['api_key'] = $_POST["api_key"];
 	}
-    $new['readonly'] = $_POST["f_ro"] * 1;
+    $new['rights'] = $_POST["f_acl"] * 1;
     update_record($db_link, "Customers", "id='$id'", $new);
     unset($_POST["pass"]);
     header("Location: " . $_SERVER["REQUEST_URI"]);
@@ -30,21 +30,21 @@ $customer=get_record($db_link,'Customers',"id=".$id);
 ?>
 
 <div id="cont">
-<br><b><?php echo WEB_custom_titles; ?></b><br>
+<br><b><?php echo WEB_customer_titles; ?></b><br>
 	<form name="def" action="editcustom.php?id=<?php echo $id; ?>" method="post">
 		<input type="hidden" name="id" value=<?php echo $id; ?>>
 		<table class="data">
 			<tr>
-				<td><?php echo WEB_custom_login; ?></td>
-				<td><?php echo WEB_custom_password; ?></td>
-				<td><?php echo WEB_custom_api_key; ?></td>
-				<td><?php echo WEB_custom_mode; ?></td>
+				<td><?php echo WEB_customer_login; ?></td>
+				<td><?php echo WEB_customer_password; ?></td>
+				<td><?php echo WEB_customer_api_key; ?></td>
+				<td><?php echo WEB_customer_mode; ?></td>
 			</tr>
 			<tr>
 				<td><input type="text" name="login" value="<?php print $customer['Login']; ?>" size=20></td>
-				<td><input type="text" name="pass" value="" size=20></td>
+				<td><input type="password" name="pass" value="" size=20></td>
 				<td><input type="text" name="api_key" value="<?php print $customer['api_key']; ?>" size=50></td>
-				<td><?php print_qa_select('f_ro',$customer['readonly']); ?></td>
+				<td><?php print_acl_select($db_link,'f_acl',$customer['rights']); ?></td>
 			</tr>
 			<td colspan=2><input type="submit" name="edituser" value="<?php echo WEB_btn_save; ?>"></td>
 		</table>

+ 5 - 1
html/admin/customers/index.php

@@ -15,6 +15,7 @@ if (isset($_POST["create"])) {
         } else {
             $new['Login'] = $login;
 	    $new['api_key'] = randomPassword(20);
+            $new['rights'] = 3;
             LOG_INFO($db_link, "Create new login: $login");
             $id = insert_record($db_link, "Customers", $new);
 	    if (!empty($id)) { header("Location: editcustom.php?id=$id"); exit; }
@@ -44,19 +45,22 @@ print_control_submenu($page_url);
 <div id="cont">
 <br>
 <form name="def" action="index.php" method="post">
-<b><?php echo WEB_custom_index_title; ?></b>
+<b><?php echo WEB_submenu_customers; ?></b>
 <table class="data">
 <tr align="center">
 <td width="30"><input type="checkbox" onClick="checkAll(this.checked);"></td>
 <td><b>Login</b></td>
+<td><b><?php echo WEB_customer_mode;?></b></td>
 </tr>
 <?php
 $users = get_records($db_link,'Customers','True ORDER BY Login');
 foreach ($users as $row) {
     $cl = "data";
+    $acl = get_record_sql($db_link,'SELECT * FROM acl WHERE id='.$row['rights']);
     print "<tr align=center>\n";
     print "<td class=\"$cl\" style='padding:0'><input type=checkbox name=fid[] value=".$row['id']."></td>\n";
     print "<td class=\"$cl\" align=left width=200><a href=editcustom.php?id=".$row['id'].">" . $row['Login'] . "</a></td>\n";
+    print "<td class=\"$cl\" >". $acl['name']. "</a></td>\n";
 }
 ?>
 </table>

+ 5 - 1
html/admin/users/editauth.php

@@ -108,7 +108,11 @@ if (isset($_POST["editauth"]) and !$old_auth_info['deleted']) {
             }
         if (is_auth_bind_changed($db_link, $id, $ip, $mac)) {
             $new_id = copy_auth($db_link, $id, $new);
-            header("Location: /admin/users/editauth.php?id=" . $new_id, TRUE, 302);
+            if (!empty($new_id)) {
+                header("Location: /admin/users/editauth.php?id=" . $new_id, TRUE, 302);
+                } else {
+                header("Location: " . $_SERVER["REQUEST_URI"]);
+                }
             exit;
             } else {
             update_record($db_link, "User_auth", "id='$id'", $new);

+ 3 - 0
html/inc/auth.utils.php

@@ -75,6 +75,7 @@ function login($db)
                 $_SESSION['IP'] = $auth_ip;
                 $_SESSION['user_id'] = $auth_record['id'];
                 $_SESSION['login'] = $auth_record['Login'];
+                $_SESSION['acl'] = $auth_record['rights'];
             } else {
                 unset($_COOKIE["Auth"]);
                 setcookie("Auth", null, -1);
@@ -148,6 +149,7 @@ function IsAuthenticated($db)
                 LOG_INFO($db, "login user [$login] from " . $_SESSION['IP'] . ": success.");
             }
             $_SESSION['user_id'] = $auth_record['id'];
+            $_SESSION['acl'] = $auth_record['rights'];
             $_SESSION['login'] = $login;
             $session['session_id'] = $_SESSION['session_id'];
             $session['session_key'] = bin2hex(random_bytes(20));
@@ -223,6 +225,7 @@ function IsSilentAuthenticated($db)
             LOG_INFO($db, "Api login user [$login] from " . $_SESSION['IP'] . ": success.");
         }
         $_SESSION['user_id'] = $auth_record['id'];
+        $_SESSION['acl'] = $auth_record['rights'];
         $_SESSION['login'] = $login;
         return true;
     }

+ 94 - 26
html/inc/common.php

@@ -520,6 +520,16 @@ function print_subnet_select($db, $subnet_name, $subnet_value)
     print "</select>\n";
 }
 
+function print_acl_select($db, $acl_name, $acl_value)
+{
+    print "<select name=\"$acl_name\" >\n";
+    $t_acl = mysqli_query($db, "SELECT id,name FROM acl ORDER BY id");
+    while (list($f_acl_id, $f_acl_name) = mysqli_fetch_array($t_acl)) {
+        print_select_item($f_acl_name, $f_acl_id, $acl_value);
+    }
+    print "</select>\n";
+}
+
 function print_device_ip_select($db, $ip_name, $ip, $user_id)
 {
     print "<select name=\"$ip_name\">\n";
@@ -651,7 +661,10 @@ function print_control_submenu($current_page)
     print_submenu_url(WEB_submenu_network, '/admin/customers/index-subnets.php', $current_page, 0);
     print_submenu_url(WEB_submenu_network_stats, '/admin/customers/control-subnets-usage.php', $current_page, 0);
     print_submenu_url(WEB_submenu_options, '/admin/customers/control-options.php', $current_page, 0);
-    print_submenu_url(WEB_submenu_customers, '/admin/customers/index.php', $current_page, 1);
+    print_submenu_url(WEB_submenu_customers, '/admin/customers/index.php', $current_page, 0);
+    print_submenu_url(WEB_submenu_buildings, '/admin/customers/building.php', $current_page, 0);
+    print_submenu_url(WEB_submenu_device_models, '/admin/customers/devmodels.php', $current_page, 0);
+    print_submenu_url(WEB_submenu_vendors, '/admin/customers/devvendors.php', $current_page, 1);
     print "</div>\n";
 }
 
@@ -685,10 +698,7 @@ function print_device_submenu($current_page)
     print "<div id='submenu'>\n";
     print_submenu_url(WEB_submenu_net_devices, '/admin/devices/index.php', $current_page, 0);
     print_submenu_url(WEB_submenu_passive_net_devices, '/admin/devices/index-passive.php', $current_page, 0);
-    print_submenu_url(WEB_submenu_buildings, '/admin/devices/building.php', $current_page, 0);
     print_submenu_url(WEB_submenu_hierarchy, '/admin/devices/index-tree.php', $current_page, 0);
-    print_submenu_url(WEB_submenu_device_models, '/admin/devices/devmodels.php', $current_page, 0);
-    print_submenu_url(WEB_submenu_vendors, '/admin/devices/devvendors.php', $current_page, 0);
     print_submenu_url(WEB_submenu_ports_vlan, '/admin/devices/portsbyvlan.php', $current_page, 1);
     print "</div>\n";
 }
@@ -1539,6 +1549,33 @@ function print_option_select($db, $option_name)
 
 function run_sql($db, $query)
 {
+    if (preg_match('/^\s*(UPDATE|DELETE)/i', $query)) {
+        unset($matches);
+        preg_match('/FROM\s+(.*)\s+/i', $query, $matches);
+        if (!empty($matches[1])) {
+            if (!allow_update($matches[1],'del')) {
+                LOG_DEBUG($db, "Access denied: $query ");
+                return;
+                }
+            }
+        unset($matches);
+        preg_match('/INSERT\s+INTO\s+(.*)\s+/i', $query, $matches);
+        if (!empty($matches[1])) {
+            if (!allow_update($matches[1],'add')) {
+                LOG_DEBUG($db, "Access denied: $query ");
+                return;
+                }
+            }
+        unset($matches);
+        preg_match('/UPDATE\s+(.*)\s+/i', $query, $matches);
+        if (!empty($matches[1])) {
+            if (!allow_update($matches[1],'update')) {
+                LOG_DEBUG($db, "Access denied: $query ");
+                return;
+                }
+            }
+        unset($matches);
+        }
     $sql_result = mysqli_query($db, $query);
     if (!$sql_result) {
         LOG_ERROR($db, "At simple SQL: $query :" . mysqli_error($db));
@@ -2049,27 +2086,54 @@ if (empty($auth_rules)) {
 return $rule_id;
 }
 
-function isRO($db, $table)
+//action: add,update,del
+function allow_update($table, $action = 'update', $field = '')
 {
-    $result = 1;
+//always allow modification for tables
+    if (preg_match('/(variables|dns_cache|syslog|sessions|dns_queue|User_auth_alias)/i', $table)) { return 1; }
+
     if (isset($_SESSION['login'])) {
         $work_user = $_SESSION['login'];
     }
     if (isset($_SESSION['user_id'])) {
         $work_id = $_SESSION['user_id'];
     }
-    if (!isset($work_user) or !isset($work_id)) {
-        return $result;
-    }
-    if (preg_match('/^(variables|dns_cache|syslog)$/', $table)) {
-        return $result;
-    }
-    $t_login = mysqli_query($db, "SELECT readonly FROM Customers WHERE Login='" . $work_user . "' and id='" . $work_id . "'");
-    list($f_ro) = mysqli_fetch_array($t_login);
-    if (!isset($f_ro)) {
-        return $result;
-    }
-    return $f_ro;
+    if (isset($_SESSION['acl'])) {
+        $user_level = $_SESSION['acl'];
+    }
+    if (!isset($work_user) or !isset($work_id) or empty($user_level)) { return 0; }
+
+//always allow Administrator
+    if ($user_level == 1) { return 1; }
+
+//always forbid ViewOnly
+    if ($user_level == 3) { return 0; }
+
+//allow tables for Operator
+    if ($action == 'update') {
+        $operator_acl = [
+            'User_auth'=> [
+                'comments'=>'1',
+                'dns_name'=>'1',
+                'firmware'=>'1',
+                'link_check'=>'1',
+                'nagios'=>'1',
+                'nagios_handler'=>'1',
+                'Wikiname'=>'1'
+            ],
+            'User_list'=> [
+                'fio'=>'1',
+                'login'=>'1',
+            ],
+        ];
+        if (!isset($operator_acl[$table])) { return 0; }
+        if (isset($operator_acl[$table]) and empty($field)) { return 1; }
+        if (!isset($operator_acl[$table][$field])) { return 0; }
+        if (empty($operator_acl[$table][$field]) or $operator_acl[$table][$field]=='0') { return 0; }
+        return 1;
+        }
+
+    return 0;
 }
 
 function LOG_INFO($db, $msg, $auth_id = 0)
@@ -4197,10 +4261,6 @@ function get_dns_name($db,$id)
 
 function update_record($db, $table, $filter, $newvalue)
 {
-    if (isRO($db, $table)) {
-        LOG_WARNING($db, "User does not have write permission");
-        return;
-    }
     if (!isset($table)) {
         LOG_WARNING($db, "Change record for unknown table! Skip command.");
         return;
@@ -4218,6 +4278,11 @@ function update_record($db, $table, $filter, $newvalue)
         return;
     }
 
+    if (!allow_update($table,'update')) { 
+        LOG_WARNING($db,"Access denied: $table [ $filter ]");
+        return 1;
+    }
+
     $old_sql = "SELECT * FROM $table WHERE $filter";
     $old_record = mysqli_query($db, $old_sql) or LOG_ERROR($db, "SQL: $old_sql :" . mysqli_error($db));
     $old = mysqli_fetch_array($old_record, MYSQLI_ASSOC);
@@ -4258,6 +4323,9 @@ function update_record($db, $table, $filter, $newvalue)
     ];
 
     foreach ($newvalue as $key => $value) {
+
+        if (!allow_update($table,'update',$key)) { continue; }
+
         if (!isset($value)) {
             $value = '';
         }
@@ -4332,7 +4400,7 @@ function update_record($db, $table, $filter, $newvalue)
     }
 
     if (empty($run_sql)) {
-        return;
+        return 1;
     }
 
     if ($network_changed) {
@@ -4366,7 +4434,7 @@ function update_record($db, $table, $filter, $newvalue)
 
 function delete_record($db, $table, $filter)
 {
-    if (isRO($db, $table)) {
+    if (!allow_update($table,'del')) {
         LOG_WARNING($db, "User does not have write permission");
         return;
     }
@@ -4458,7 +4526,7 @@ function delete_record($db, $table, $filter)
 
 function insert_record($db, $table, $newvalue)
 {
-    if (isRO($db, $table)) {
+    if (!allow_update($table,'add')) {
         LOG_WARNING($db, "User does not have write permission");
         return;
     }
@@ -4990,7 +5058,7 @@ if (empty($ou)) {
 $config["init"] = 1;
 
 clean_dns_cache($db_link);
-clean_unreferensed_rules($db_link);
+//clean_unreferensed_rules($db_link);
 
 snmp_set_valueretrieval(SNMP_VALUE_LIBRARY);
 snmp_set_enum_print(1);

+ 6 - 6
html/inc/languages/english.php

@@ -305,14 +305,14 @@ define("WEB_control_port_off","Port Control");
 define("WEB_control_edit_mode","Configuration Mode");
 
 /* editcustom */
-define("WEB_custom_titles","Administrator");
-define("WEB_custom_login","Login");
-define("WEB_custom_password","Password");
-define("WEB_custom_mode","View only");
-define("WEB_custom_api_key","API Key");
+define("WEB_customer_titles","Administrator");
+define("WEB_customer_login","Login");
+define("WEB_customer_password","Password");
+define("WEB_customer_mode","Access rights");
+define("WEB_customer_api_key","API Key");
 
 /* custom index */
-define("WEB_custom_index_title","Administrators");
+define("WEB_customer_index_title","Administrators");
 
 /* ipcam */
 define("WEB_control_group","For group");

+ 6 - 6
html/inc/languages/russian.php

@@ -305,14 +305,14 @@ define("WEB_control_port_off","Управление портами");
 define("WEB_control_edit_mode","Режим конфигурирования");
 
 /* editcustom */
-define("WEB_custom_titles","Администратор");
-define("WEB_custom_login","Логин");
-define("WEB_custom_password","Пароль");
-define("WEB_custom_mode","Только просмотр");
-define("WEB_custom_api_key","Ключ API");
+define("WEB_customer_titles","Администратор");
+define("WEB_customer_login","Логин");
+define("WEB_customer_password","Пароль");
+define("WEB_customer_mode","Права доступа");
+define("WEB_customer_api_key","Ключ API");
 
 /* custom index */
-define("WEB_custom_index_title","Администраторы");
+define("WEB_customer_index_title","Администраторы");
 
 /* ipcam */
 define("WEB_control_group","Для группы");

+ 2 - 1
scripts/check_dhcp_pool.pl

@@ -5,10 +5,11 @@
 #
 
 use utf8;
+use open ":encoding(utf8)";
 use English;
 use base;
 use FindBin '$Bin';
-use lib "$Bin/";
+use lib "/opt/Eye/scripts";
 use strict;
 use DBI;
 use Time::Local;

+ 2 - 1
scripts/dhcp-log.pl

@@ -5,10 +5,11 @@
 #
 
 use utf8;
+use open ":encoding(utf8)";
 use English;
 use base;
 use FindBin '$Bin';
-use lib "$Bin/";
+use lib "/opt/Eye/scripts";
 use Data::Dumper;
 use eyelib::config;
 use eyelib::main;

+ 2 - 1
scripts/eyelib/cmd.pm

@@ -5,10 +5,11 @@ package eyelib::cmd;
 #
 
 use utf8;
+use open ":encoding(utf8)";
 use strict;
 use English;
 use FindBin '$Bin';
-use lib "$Bin";
+use lib "/opt/Eye/scripts";
 use base 'Exporter';
 use vars qw(@EXPORT @ISA);
 use Data::Dumper;

+ 2 - 1
scripts/eyelib/config.pm

@@ -5,10 +5,11 @@ package eyelib::config;
 #
 
 use utf8;
+use open ":encoding(utf8)";
 use strict;
 use English;
 use FindBin '$Bin';
-use lib "$Bin";
+use lib "/opt/Eye/scripts";
 use base 'Exporter';
 use vars qw(@EXPORT @ISA);
 use Config::Tiny;

+ 2 - 1
scripts/eyelib/main.pm

@@ -5,10 +5,11 @@ package eyelib::main;
 #
 
 use utf8;
+use open ":encoding(utf8)";
 use strict;
 use English;
 use FindBin '$Bin';
-use lib "$Bin";
+use lib "/opt/Eye/scripts";
 use base 'Exporter';
 use vars qw(@EXPORT @ISA);
 use eyelib::config;

+ 3 - 2
scripts/eyelib/mysql.pm

@@ -5,10 +5,11 @@ package eyelib::mysql;
 #
 
 use utf8;
+use open ":encoding(utf8)";
 use strict;
 use English;
 use FindBin '$Bin';
-use lib "$Bin";
+use lib "/opt/Eye/scripts";
 use base 'Exporter';
 use vars qw(@EXPORT @ISA);
 use eyelib::config;
@@ -994,7 +995,7 @@ if ($fqdn ne '' and !$dynamic_ok) {
     if (!$another_hostname_exists) {
             if ($fqdn_static and $fqdn_static ne '') {
                     if ($fqdn_static!~/$fqdn/) {
-                        db_log_info($hdb,"Hostname from dhcp request $fqdn differs from static dns hostanme $fqdn_static. Ignore dynamic binding!");
+                        db_log_info($hdb,"Hostname from dhcp request $fqdn differs from static dns hostname $fqdn_static. Ignore dynamic binding!");
 #                        delete_dns_hostname($fqdn,$dhcp_record->{ip},$ad_zone,$ad_dns,$hdb);
 #                        create_dns_hostname($fqdn,$dhcp_record->{ip},$ad_zone,$ad_dns,$hdb);
                         }

+ 2 - 1
scripts/eyelib/net_utils.pm

@@ -5,10 +5,11 @@ package eyelib::net_utils;
 #
 
 use utf8;
+use open ":encoding(utf8)";
 use strict;
 use English;
 use FindBin qw($Bin);
-use lib "$Bin";
+use lib "/opt/Eye/scripts";
 use base 'Exporter';
 use vars qw(@EXPORT @ISA);
 use FileHandle;

+ 2 - 1
scripts/eyelib/rest_api.pm

@@ -5,10 +5,11 @@ package eyelib::rest_api;
 #
 
 use utf8;
+use open ":encoding(utf8)";
 use strict;
 use English;
 use FindBin qw($Bin);
-use lib "$Bin";
+use lib "/opt/Eye/scripts";
 use base 'Exporter';
 use vars qw(@EXPORT @ISA);
 use HTTP::Request::Common;

+ 2 - 1
scripts/eyelib/snmp.pm

@@ -5,10 +5,11 @@ package eyelib::snmp;
 #
 
 use utf8;
+use open ":encoding(utf8)";
 use strict;
 use English;
 use FindBin '$Bin';
-use lib "$Bin";
+use lib "/opt/Eye/scripts";
 use base 'Exporter';
 use vars qw(@EXPORT @ISA);
 use Data::Dumper;

+ 2 - 1
scripts/fetch_new_arp.pl

@@ -5,10 +5,11 @@
 #
 
 use utf8;
+use open ":encoding(utf8)";
 use English;
 use base;
 use FindBin '$Bin';
-use lib "$Bin/";
+use lib "/opt/Eye/scripts";
 use strict;
 use DBI;
 use Time::Local;

+ 2 - 1
scripts/garbage.pl

@@ -5,10 +5,11 @@
 #
 
 use utf8;
+use open ":encoding(utf8)";
 use English;
 use base;
 use FindBin '$Bin';
-use lib "$Bin/";
+use lib "/opt/Eye/scripts";
 use strict;
 use DBI;
 use Date::Parse;

+ 2 - 1
scripts/parse_flow.pl

@@ -5,10 +5,11 @@
 #
 
 use utf8;
+use open ":encoding(utf8)";
 use English;
 use base;
 use FindBin '$Bin';
-use lib "$Bin/";
+use lib "/opt/Eye/scripts";
 use strict;
 use DBI;
 use Time::Local;

+ 2 - 1
scripts/print-dnsmasq.pl

@@ -5,10 +5,11 @@
 #
 
 use utf8;
+use open ":encoding(utf8)";
 use English;
 use base;
 use FindBin '$Bin';
-use lib "$Bin/";
+use lib "/opt/Eye/scripts";
 use strict;
 use DBI;
 use Time::Local;

+ 2 - 1
scripts/stat-sync.pl

@@ -5,10 +5,11 @@
 #
 
 use utf8;
+use open ":encoding(utf8)";
 use English;
 use base;
 use FindBin '$Bin';
-use lib "$Bin/";
+use lib "/opt/Eye/scripts";
 use Data::Dumper;
 use eyelib::config;
 use eyelib::main;

+ 2 - 1
scripts/sync_mikrotik.pl

@@ -5,10 +5,11 @@
 #
 
 use utf8;
+use open ":encoding(utf8)";
 use English;
 use base;
 use FindBin '$Bin';
-use lib "$Bin/";
+use lib "/opt/Eye/scripts";
 use strict;
 use Time::Local;
 use FileHandle;

+ 2 - 1
scripts/syslog-stat.pl

@@ -5,10 +5,11 @@
 #
 
 use utf8;
+use open ":encoding(utf8)";
 use English;
 use base;
 use FindBin '$Bin';
-use lib "$Bin";
+use lib "/opt/Eye/scripts";
 use strict;
 use Time::Local;
 use FileHandle;

+ 2 - 1
scripts/updates/upgrade.pl

@@ -31,12 +31,13 @@ my @old_releases = (
 '2.4.14',
 '2.5.1',
 '2.5.2',
+'2.5.3',
 );
 
 my $r_index = 0;
 my %old_releases_h = map {$_ => $r_index++ } @old_releases;
 
-my $eye_release = '2.5.2';
+my $eye_release = '2.5.3';
 
 if (!$config_ref{version}) { $config_ref{version}='2.4.12'; }
 

+ 1 - 0
scripts/utils/backupcfg.pl

@@ -5,6 +5,7 @@
 #
 
 use utf8;
+use open ":encoding(utf8)";
 use English;
 use base;
 use FindBin '$Bin';

+ 2 - 0
scripts/utils/print_devices.pl

@@ -2,6 +2,8 @@
 #
 # Copyright (C) Roman Dmitiriev, rnd@rajven.ru
 #
+use utf8;
+use open ":encoding(utf8)";
 use FindBin '$Bin';
 use lib "/opt/Eye/scripts";
 use strict;

+ 1 - 0
scripts/utils/reaply_rules.pl

@@ -7,6 +7,7 @@
 #
 
 use utf8;
+use open ":encoding(utf8)";
 use English;
 use base;
 use FindBin '$Bin';

+ 2 - 0
scripts/utils/scan_ipcam.pl

@@ -1,5 +1,7 @@
 #!/usr/bin/perl
 
+use utf8;
+use open ":encoding(utf8)";
 use FindBin '$Bin';
 use lib "/opt/Eye/scripts";
 use DBI;

+ 2 - 1
scripts/utils/set_dns_record.pl

@@ -5,6 +5,7 @@
 #
 
 use utf8;
+use open ":encoding(utf8)";
 use English;
 use base;
 use FindBin '$Bin';
@@ -25,6 +26,6 @@ use File::Path;
 exit if (!$ARGV[0]);
 
 my $auth_id = $ARGV[0];
-update_dns_record($dbh,$auth->{auth_id});
+update_dns_record($dbh,$auth_id);
 
 exit;

+ 1 - 0
scripts/utils/set_port_descr.pl

@@ -5,6 +5,7 @@
 #
 
 use utf8;
+use open ":encoding(utf8)";
 use English;
 use base;
 use FindBin '$Bin';