0

Is there a way to enable the module 'mod_exec' only with a certain proftdp user?

I've compiled proftp with --with-modules=mod_exec:mod_ifsession and then configured in this way...

<IfModule mod_exec.c>
    <IfUser stefano>
        ExecEngine              on
        ExecLog                 /opt/proftpd-master/logs/proftpd.semics.mod_exec.log
        ExecOptions             logStderr logStdout
        ExecBeforeCommand       STOR,RETR       /path/to/handler.sh EVENT=BeforeCommand FILE='%f'
        ExecOnCommand           STOR,RETR       /path/to/handler.sh EVENT=OnCommand     FILE='%f'
    </IfUser>
</IfModule>

or this:

<IfUser stefano>
    <IfModule mod_exec.c>
        ExecEngine              on
        ExecLog                 /opt/proftpd-master/logs/proftpd.semics.mod_exec.log
        ExecOptions             logStderr logStdout
        ExecBeforeCommand       STOR,RETR       /path/to/handler.sh EVENT=BeforeCommand FILE='%f'
        ExecOnCommand           STOR,RETR       /path/to/handler.sh EVENT=OnCommand     FILE='%f'
    </IfModule>
</IfUser>

without success. Seems that mod_exec works only if configured outside the conditional statement.

My goal is to enable mod_exec only for user 'stefano' and/or to have several mod_exec configuration accordingly with each user configured.

Any suggestion?

4

1 回答 1

0

mod_exec.c 必须默认启用,然后在里面可以为不同的用户配置不同的操作:

<IfModule mod_exec.c>
    ExecEngine on
    ExecLog /opt/proftpd-master/logs/proftpd_mod_exec.log
    ExecOptions logStderr logStdout

    <IfUser stefano>
        ExecBeforeCommand STOR,RETR /path/to/script.sh EVENT=BeforeCommand FILE='%f'
        ExecOnCommand STOR,RETR /path/to/script.sh EVENT=OnCommand FILE='%f'
    </IfUser>
</IfModule>

感谢 TJ 桑德斯。我希望这有帮助。

于 2015-02-19T08:17:35.223 回答