Скрипт для мопеда для разрыва соединения.
Скрипт для мопеда для разрыва соединения.
Добрый день.Пробую прикрутить скрипт на разрыв сессии но он ругаеться mpd 5.1
взял скрипт с форума. Подскажите плиз что не так может быть. Большое спасибо.
#!/bin/sh
MHOST="ip на котором консоль"
MPORTS=порт консоли
IP="$1";
test -z "$IP" && exit 1
bundle=`printf "пользователь на консоль[/b]\rпароль на консоль\rshow session\r" | /usr/bin/nc $MHOST $MPORT | grep $IP | awk '{print $3}'`;
if [ "$bundle" != '' ] ; then
printf "пользователь на консоль \rпароль на консоль \rbundle $bundle\rclose\r" | /usr/bin/nc $MHOST $MPORT 1> /dev/null
fi
exit 0
После запуска выдает ошибку
MHOST=10.0.0.3: Command not found.
MPORTS=5005: Command not found.
IP=: Command not found.
IP: Undefined variable.
взял скрипт с форума. Подскажите плиз что не так может быть. Большое спасибо.
#!/bin/sh
MHOST="ip на котором консоль"
MPORTS=порт консоли
IP="$1";
test -z "$IP" && exit 1
bundle=`printf "пользователь на консоль[/b]\rпароль на консоль\rshow session\r" | /usr/bin/nc $MHOST $MPORT | grep $IP | awk '{print $3}'`;
if [ "$bundle" != '' ] ; then
printf "пользователь на консоль \rпароль на консоль \rbundle $bundle\rclose\r" | /usr/bin/nc $MHOST $MPORT 1> /dev/null
fi
exit 0
После запуска выдает ошибку
MHOST=10.0.0.3: Command not found.
MPORTS=5005: Command not found.
IP=: Command not found.
IP: Undefined variable.
Разобрался. С разрешениями на скрипт перемудрил.
Но теперь появилась другая проблема =).
Теперь вот что пишет. rfw.log
?Debug : Oct 28 17:05:15 FWCntl: Executing FW rule: /sc/mpd_stop2.sh 172.16.1.17 is done.
?Debug : Oct 28 17:05:15 FWCntl: Executing command </sc/>
ERROR : Oct 28 17:05:15 FWCntl: Error executing FW rule, errno <13> error <Permission denied>
ERROR : Oct 28 17:05:15 FWCntl: Error executing FW rule, errno <13> error <Permission denied>
В правилах фаера выключение: /sc/mpd_stop2.sh UIP
Помогите админы добрые.
Но теперь появилась другая проблема =).
Теперь вот что пишет. rfw.log
?Debug : Oct 28 17:05:15 FWCntl: Executing FW rule: /sc/mpd_stop2.sh 172.16.1.17 is done.
?Debug : Oct 28 17:05:15 FWCntl: Executing command </sc/>
ERROR : Oct 28 17:05:15 FWCntl: Error executing FW rule, errno <13> error <Permission denied>
ERROR : Oct 28 17:05:15 FWCntl: Error executing FW rule, errno <13> error <Permission denied>
В правилах фаера выключение: /sc/mpd_stop2.sh UIP
Помогите админы добрые.
gil писал(а):а в rfw.conf?
Код: Выделить всё
##
## /netup/utm5/rfw5.cfg
## UTM5 RFW configuration file
##
## =============================================================================
## MAIN PARAMETERS
## =============================================================================
## rfw_name
## Description: Name of UTM5 rfw by which it is identified when connecting to
## the UTM5 core. The same value must be set in the 'Name' field in the list
## of firewalls in UTM_Admin.
## Possible values: <string>
## Required field
rfw_name=127.0.0.1
## core_host
## Description: IP address of the host running UTM5 core.
## Possible values: <IP address>
## Required field
core_host=127.0.0.1
## core_port
## Description: Port where UTM5 core is listening to Stream.
## Possible values: an integer from 1 to 65534
## Required field
core_port=12758
## rfw_login
## Description: Login used to access to the UTM5 core.
## Required field.
rfw_login=***
## rfw_password
## Description: Password used to access to the UTM5 core.
## Required field.
rfw_password=***
## firewall_type
## Description: Firewall type. Must conform with the 'Type' parameter of the
## firewall with the corresponding name.
## Possible values: local, cisco
## Default value: local
#firewall_type=cisco
## rfw_ssl_type
## Description: SSL connection type. If 'none' is set, the connection is
## unencrypted.
## Possible values: tls1, ssl3, none
## Default value: none
#rfw_ssl_type=none
## =============================================================================
## PARAMETERS THAT ARE VALID WHEN firewall_type=local
## =============================================================================
### firewall_path
## Description: Path to the executable file that performs firewall management.
## Possible values: <name of an executable file>
## Required field
firewall_path=/sc/
# sudo_path
## Description: Sudo program path.
## Possible values: <path to an executable file>
## Default value: <unset>
#sudo_path=/usr/bin/sudo
## dont_fork
## Description: If set, firewall rules are applied one-by-one. Recommended when
## using iptables.
## Possible values: yes, enable, true
## Default value: <commands are executed serially>
#dont_fork=yes
## =============================================================================
## PARAMETERS THAT ARE VALID WHEN firewall_type=cisco
## =============================================================================
## cisco_ip
## Description: IP address the commands are sent to via rsh protocol.
## Possible values: <IP address>
## Required field
#cisco_ip=10.0.0.1
## =============================================================================
## LOGGING
## =============================================================================
## log_level
## Description: Logging level.
## Possible values: 0, 1, 2, 3
## Default value: 1
log_level=3
## log_file_main
## Description: Main logfile path.
## Possible values: <filename>
## Default value: STDERR
log_file_main=/netup/utm5/log/rfw.log
## log_file_debug
## Description: Debug logfile path.
## Possible values: <filename>
## Default value: STDERR
log_file_debug=/netup/utm5/log/rfw.log
## log_file_critical
## Description: Critical logfile path.
## Possible values: <filename>
## Default value: STDERR
log_file_critical=/netup/utm5/log/rfw.log
## rotate_logs
## Description: Enables logfile rotation.
## Possible values: yes, on, enable
## Default value: disabled
## max_logfile_count
## Description: Maximum number of logfiles to retain. Valid if logfile rotation
## is on.
## Possible values: a positive integer
## Default value: not limited
## max_logfile_size
## Description: Maximum logfile size. When logfile size reaches this limit, a
## rotation is performed. Valid if logfile rotation is on.
## Possible values: <size in bytes>
## Default value: 10485760
## pid_file
## Description: PID file path.
## Possible values: <filename>
## Default value: /var/run/utm5_rfw.pid
## =============================================================================
## MISCELLANEOUS
## =============================================================================
## OBSOLETE. NOT RECOMMENDED TO USE
## OBSOLETE. NOT RECOMMENDED TO USE
## Description and default values for these parameters are not provided.
## firewall_flush_cmd
## Possible values: <filename>
#firewall_flush_cmd=/usr/sbin/iptables -F
## core_timeout
## Possible values: 5