Ticket #2946 (closed Bugs: fixed)

Opened 4 months ago

Last modified 4 months ago

Fop cannot start if asterisk user has no shell

Reported by: dani Assigned to:
Priority: minor Milestone: 2.5
Component: FreePBX Framework Version: 2.4-branch
Keywords: Cc:
Confirmation: Need Feedback SVN Revision (if applicable):
Backend Engine: All Backend Engine Version:

Description

I think it's quite usual to have asterisk user without any valid shell (/bin/false). If it's the case, freepbx_engine won't be able to start fop. Attached is a patch I've made to correct that (it just select /bin/bash with su)

Attachments

run_fop.bash.patch (0.6 kB) - added by dani on 07/25/08 10:42:47.

Change History

07/24/08 06:58:14 changed by p_lindheimer

  • owner deleted.
  • confirmation changed from Unreviewed to Need Feedback.
  • component changed from Flash Operator Panel to FreePBX Framework.
  • milestone changed from Cut Line to 2.5.

sounds reasonable. I'd like to solicit feedback from others if there is any concern forcing it to /bin/bash? Is there a more restricted shell to use? Does this create issues on any distros? Are there any other concerns?

07/24/08 16:37:12 changed by dani

Forgot to say: I've tested this on Centos 4 based distrib (SME Server), works well. I cannot say for other distros.

07/25/08 00:25:19 changed by lazytt

it definitely shouldn't be hard coded

07/25/08 08:37:41 changed by p_lindheimer

lazytt - a reason would be helpful

dani - any chance of modifying and testing that patch where you try it the old way first and if the su fails, then try it your way? That way you don't override a different shell someone may have chosen for asterisk but have a fallback if su fails because of the lack of a shell.

07/25/08 09:32:48 changed by dani

I've just attached a new patch, basically, it first try to start fop the old way (redirecting standard and error output to /dev/null, this way, if asterisk has no shell, we don't have an error message). then, it count the number of safe_opserver process, if this number is 0, it tries to start it with bash. It's working on my test server.

07/25/08 10:31:42 changed by p_lindheimer

that looks a little excessive plus seems like you could run into a race condition since the commands are being started in the background. Have you tried (or can you) something like this:

su - asterisk -c "cd $FOPWEBROOT && $FOPWEBROOT/safe_opserver &" > /dev/null 2>&1

# Check if su was successful, if not add a shell
[ "$?" -eq "0" ] || su -s /bin/bash asterisk -c "cd $FOPWEBROOT && $FOPWEBROOT/safe_opserver &" 

07/25/08 10:42:47 changed by dani

  • attachment run_fop.bash.patch added.

07/25/08 10:43:37 changed by dani

You're right, your solution is much more elegant, and it's also working fine.

07/25/08 11:56:55 changed by p_lindheimer

  • status changed from new to closed.
  • resolution set to fixed.

(In [6183]) fixes #2946 and adds a few more missing changes re #2606

Donate



Support
Download
Develop
Forums
News
Documentation
Paid Support
About

Paid Ads