The OpenNET Project / Index page

[ новости /+++ | форум | теги | ]

форумы  помощь  поиск  регистрация  майллист  ВХОД  слежка  RSS
"Как в Exim выполнить внешнюю команду?"
Вариант для распечатки  
Пред. тема | След. тема 
Форумы OpenNET: Виртуальная конференция (Public)
Изначальное сообщение [Проследить за развитием треда]

"Как в Exim выполнить внешнюю команду?"  
Сообщение от ws email(ok) on 19-Дек-06, 17:08 
Нужно выполнить внешнюю команду в процессе обработки входящего сообщения в ACL.
Хочу сделать добавление IP спамерского хоста в блокирующее правила файрвола.
Высказать мнение | Ответить | Правка | Наверх | Cообщить модератору

 Оглавление

Сообщения по теме [Сортировка по времени, UBB]


1. "Как в Exim выполнить внешнюю команду?"  
Сообщение от gibbon (??) on 19-Дек-06, 19:24 
>Нужно выполнить внешнюю команду в процессе обработки входящего сообщения в ACL.
>Хочу сделать добавление IP спамерского хоста в блокирующее правила файрвола.


${run{<command> <args>}{<string1>}{<string2>}}

The command and its arguments are first expanded separately, and then the command is run in a separate process, but under the same uid and gid. As in other command executions from Exim, a shell is not used by default. If you want a shell, you must explicitly code it.
If the command succeeds (gives a zero return code) <string1> is expanded and replaces the entire item; during this expansion, the standard output from the command is in the variable $value. If the command fails, <string2>, if present, is expanded and used. Once again, during the expansion, the standard output from the command is in the variable $value. If <string2> is absent, the result is empty. Alternatively, <string2> can be the word “fail” (not in braces) to force expansion failure if the command does not succeed. If both strings are omitted, the result is contents of the standard output on success, and nothing on failure.

The return code from the command is put in the variable $runrc, and this remains set afterwards, so in a filter file you can do things like this:
if "${run{x y z}{}}$runrc" is 1 then ...
  elif $runrc is 2 then ...
  ...
endif

If execution of the command fails (for example, the command does not exist), the return code is 127 – the same code that shells use for non-existent commands.

Warning: In a router or transport, you cannot assume the order in which option values are expanded, except for those preconditions whose order of testing is documented. Therefore, you cannot reliably expect to set $runrc by the expansion of one option, and use it in another.

The redirect router has an option called forbid_filter_run which locks out the use of this expansion item in filter files.

Высказать мнение | Ответить | Правка | Наверх | Cообщить модератору

2. "Как в Exim выполнить внешнюю команду?"  
Сообщение от ws email(ok) on 20-Дек-06, 10:28 
>>Нужно выполнить внешнюю команду в процессе обработки входящего сообщения в ACL.
>>Хочу сделать добавление IP спамерского хоста в блокирующее правила файрвола.
>
>
>${run{<command> <args>}{<string1>}{<string2>}}
>

Спасибо! Все заработало.

Высказать мнение | Ответить | Правка | Наверх | Cообщить модератору

Архив | Удалить

Индекс форумов | Темы | Пред. тема | След. тема
Оцените тред (1=ужас, 5=супер)? [ 1 | 2 | 3 | 4 | 5 ] [Рекомендовать для помещения в FAQ]




Партнёры:
PostgresPro
Inferno Solutions
Hosting by Hoster.ru
Хостинг:

Закладки на сайте
Проследить за страницей
Created 1996-2025 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру