Friday, 15 March 2013

php - ec2auth is not working when called from another script -



php - ec2auth is not working when called from another script -

i trying automate white list of ip in aws firewall using ec2auth making link on clicks obtains ip php file , calls on bash script. bash script checks if person suppose have access calls bash script firewall ip update.

bash1

if [ "$access" = "allowed" ] echo -n "updating access... " bash2 "$newip" fi

bash2

ip="$1" echo -n "adding new ip... " addresult="$(ec2auth grouping -p tcp -p 3389 -s "$ip"/32)"

but doing getting error

addresult is: +-------------+--------------------------------------------------------------+ | code | message | +-------------+--------------------------------------------------------------+ | authfailure | aws not able validate provided access credentials | +-------------+--------------------------------------------------------------+

but if run bash2 terminal works fine. 1 know wrong.

i found work

bash1

if [ "$access" = "allowed" ] echo -n "updating access... " sudo /fullpath/bash2 "$newip" fi

and part of sudoers file

# user privilege specification www-data all=(all) nopasswd: /fullpath/bash1, /fullpath/bash2

hope helps 1 else. if why works please allow me know.

php bash amazon-web-services amazon-ec2

No comments:

Post a Comment