AWS魔豆 - 不能使用配置文件运行命令 [英] AWS Beanstalk - could not run commands using config file

查看:213
本文介绍了AWS魔豆 - 不能使用配置文件运行命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有Tomcat 7的安装使用豆茎。我试图通过将命令中的.config(YAML)文件运行在该环境下的命令,如下所示:

 的iptables -I INPUT -p ICMP --icmp型回声请求-m最近--set
iptables的-I INPUT -p ICMP --icmp型回声请求-m最近--update --seconds 20 --hitcount 5 -j DROP
 

配置文件 命令:

  sudodisable:
命令:echo默认值:ROOT \ requiretty
ipbasedthrotllingcommand1:
命令:命令iptables的-I INPUT -p ICMP --icmp型回声请求-m最近--set
ipbasedthrotllingcommand2:
命令:命令iptables的-I INPUT -p ICMP --icmp型回声请求-m最近--update --seconds 20 --hitcount 5 -j DROP
 

下面是我的推论:

1)我在这里跟着我们在这方面话题 - > 的https:/ /forums.aws.amazon.com/message.jspa?messageID=395894 并把上面的内容显示在我的config文件,并上传了我的.war只拿到了以下错误

  2013年3月3日20:52:39165 DEBUG不设置重启触发调度支持不可用
2013年3月3日20:52:39185信息运行configSets:双端队列()
2013年3月3日20:52:39187信息运行configSet红外线嵌入式preBuild
2013年3月3日20:52:39187信息运行配置prebuild_0_My_First_Elastic_Beanstalk_Application_sudofix__ebextensions_testit_config
2013年3月3日20:52:39187 DEBUG没有指定的包
2013年3月3日20:52:39188 DEBUG没有指定的组
2013年3月3日20:52:39188 DEBUG没有指定的用户
2013年3月3日20:52:39188 DEBUG没有指定源
2013年3月3日20:52:39188 DEBUG没有指定的文件
2013年3月3日20:52:39188 DEBUG运行命令ipbasedthrotllingcommand1
2013年3月3日20:52:39188 DEBUG没有测试命令ipbasedthrotllingcommand1
2013年3月3日20:52:39204错误命令ipbasedthrotllingcommand1(须藤的iptables -I INPUT -p ICMP --icmp型回声请求-m最近--set)失败
2013年3月3日20:52:39205 debug命令ipbasedthrotllingcommand1输出:须藤:对不起,你必须有一个tty运行sudo的
2013年3月3日20:52:构建prebuild_0_My_First_Elastic_Beanstalk_Application_sudofix__ebextensions_testit_config期间39205错误时遇到错误:命令ipbasedthrotllingcommand1失败
回溯(最近通话最后一个):
文件/usr/lib/python2.6/site-packages/cfnbootstrap/construction.py,线路505,在run_config
CloudFormationCarpenter(配置,self._auth_config).build(工作日志)
文件/usr/lib/python2.6/site-packages/cfnbootstrap/construction.py,241线,在建
变化=命令工具()。申请(self._config.commands)
文件/usr/lib/python2.6/site-packages/cfnbootstrap/command_tool.py,线路103,在申请
提高ToolError(命令%s失败%名称)
ToolError:命令ipbasedthrotllingcommand1失败
2013年3月3日20:52:39206错误未处理的构建过程中的异常:命令ipbasedthrotllingcommand1失败
回溯(最近通话最后一个):
文件/选择/ AWS /斌/ CFN-初始化,第135行,与<模块>
worklog.build(detail.metadata,configSets)
文件/usr/lib/python2.6/site-packages/cfnbootstrap/construction.py,117线,在建
承包商(元数据).build(configSets,个体经营)
文件/usr/lib/python2.6/site-packages/cfnbootstrap/construction.py,496线,在建
self.run_config(配置,工作日志)
文件/usr/lib/python2.6/site-packages/cfnbootstrap/construction.py,线路505,在run_config
CloudFormationCarpenter(配置,self._auth_config).build(工作日志)
文件/usr/lib/python2.6/site-packages/cfnbootstrap/construction.py,241线,在建
变化=命令工具()。申请(self._config.commands)
文件/usr/lib/python2.6/site-packages/cfnbootstrap/command_tool.py,线路103,在申请
提高ToolError(命令%s失败%名称)
ToolError:命令ipbasedthrotllingcommand1失败
2013年3月3日20:53:26362 DEBUG CloudFormation客户端与终端初始化https://cloudformation.us-west-1.amazonaws.com
2013年3月3日20:53:26362 DEBUG描述资源AWSEBAutoScalingGroup堆叠arn:aws:cloudformation:us-west-1:726941363581:stack/awseb-e-jiipcgeknm-stack/3bb8eac0-842f-11e2-b50d-50690881bc86
2013年3月3日20:53:26577 DEBUG不设置重启触发调度支持不可用
2013年3月3日20:53:26593信息运行configSets:双端队列()
2013年3月3日20:53:26595信息运行configSet InfoTask,TailLogs
2013年3月3日20:53:26596信息运行配置InfoTask,TailLogs
2013年3月3日20:53:26596 DEBUG没有指定的包
2013年3月3日20:53:26596 DEBUG没有指定的组
2013年3月3日20:53:26596 DEBUG没有指定的用户
2013年3月3日20:53:26596 DEBUG没有指定源
2013年3月3日20:53:26596 DEBUG没有指定的文件
2013年3月3日20:53:26597 DEBUG运行命令taillogs
2013年3月3日20:53:26597 DEBUG没有测试命令taillogs
 

2)如果我运行iptables的命令没有sudo,我没有看到他们得到执行。基本上我不看,即使在我的日志文件中提及的config文件,这使我怀疑,如果配置文件甚至有所回升。

我真的AP preciate任何帮助解决这个问题。

解决方案

 命令:echo默认值:ROOT \ requiretty
 

是错误的。根据您链接到文档,它应该是:

 回音默认值:ROOT \ requiretty>>在/ etc / sudoers文件
 

I have Tomcat 7 setup using beanstalk. I am trying to run the following commands on that environment by placing the commands in .config(yaml) file as shown below:

iptables -I INPUT -p icmp --icmp-type echo-request -m recent --set
iptables -I INPUT -p icmp --icmp-type echo-request -m recent --update --seconds 20 --hitcount 5 -j DROP

config file commands:

sudodisable:
command: echo Defaults:root \!requiretty
ipbasedthrotllingcommand1:
command: sudo iptables -I INPUT -p icmp --icmp-type echo-request -m recent --set
ipbasedthrotllingcommand2:
command: sudo iptables -I INPUT -p icmp --icmp-type echo-request -m recent --update --seconds 20 --hitcount 5 -j DROP

Here are my inferences:

1) I followed the advice here in this thread --> https://forums.aws.amazon.com/message.jspa?messageID=395894 and put the above shown content in my .config file and uploaded my .war only to get the following error

2013-03-03 20:52:39,165 DEBUG Not setting a reboot trigger as scheduling support is not available
2013-03-03 20:52:39,185 INFO Running configSets: deque()
2013-03-03 20:52:39,187 INFO Running configSet Infra-EmbeddedPreBuild
2013-03-03 20:52:39,187 INFO Running config prebuild_0_My_First_Elastic_Beanstalk_Application_sudofix__ebextensions_testit_config
2013-03-03 20:52:39,187 DEBUG No packages specified
2013-03-03 20:52:39,188 DEBUG No groups specified
2013-03-03 20:52:39,188 DEBUG No users specified
2013-03-03 20:52:39,188 DEBUG No sources specified
2013-03-03 20:52:39,188 DEBUG No files specified
2013-03-03 20:52:39,188 DEBUG Running command ipbasedthrotllingcommand1
2013-03-03 20:52:39,188 DEBUG No test for command ipbasedthrotllingcommand1
2013-03-03 20:52:39,204 ERROR Command ipbasedthrotllingcommand1 (sudo iptables -I INPUT -p icmp --icmp-type echo-request -m recent --set) failed
2013-03-03 20:52:39,205 DEBUG Command ipbasedthrotllingcommand1 output: sudo: sorry, you must have a tty to run sudo
2013-03-03 20:52:39,205 ERROR Error encountered during build of prebuild_0_My_First_Elastic_Beanstalk_Application_sudofix__ebextensions_testit_config: Command ipbasedthrotllingcommand1 failed
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/cfnbootstrap/construction.py", line 505, in run_config
CloudFormationCarpenter(config, self._auth_config).build(worklog)
File "/usr/lib/python2.6/site-packages/cfnbootstrap/construction.py", line 241, in build
changes = CommandTool().apply(self._config.commands)
File "/usr/lib/python2.6/site-packages/cfnbootstrap/command_tool.py", line 103, in apply
raise ToolError("Command %s failed" % name)
ToolError: Command ipbasedthrotllingcommand1 failed
2013-03-03 20:52:39,206 ERROR Unhandled exception during build: Command ipbasedthrotllingcommand1 failed
Traceback (most recent call last):
File "/opt/aws/bin/cfn-init", line 135, in <module>
worklog.build(detail.metadata, configSets)
File "/usr/lib/python2.6/site-packages/cfnbootstrap/construction.py", line 117, in build
Contractor(metadata).build(configSets, self)
File "/usr/lib/python2.6/site-packages/cfnbootstrap/construction.py", line 496, in build
self.run_config(config, worklog)
File "/usr/lib/python2.6/site-packages/cfnbootstrap/construction.py", line 505, in run_config
CloudFormationCarpenter(config, self._auth_config).build(worklog)
File "/usr/lib/python2.6/site-packages/cfnbootstrap/construction.py", line 241, in build
changes = CommandTool().apply(self._config.commands)
File "/usr/lib/python2.6/site-packages/cfnbootstrap/command_tool.py", line 103, in apply
raise ToolError("Command %s failed" % name)
ToolError: Command ipbasedthrotllingcommand1 failed
2013-03-03 20:53:26,362 DEBUG CloudFormation client initialized with endpoint https://cloudformation.us-west-1.amazonaws.com
2013-03-03 20:53:26,362 DEBUG Describing resource AWSEBAutoScalingGroup in stack arn:aws:cloudformation:us-west-1:726941363581:stack/awseb-e-jiipcgeknm-stack/3bb8eac0-842f-11e2-b50d-50690881bc86
2013-03-03 20:53:26,577 DEBUG Not setting a reboot trigger as scheduling support is not available
2013-03-03 20:53:26,593 INFO Running configSets: deque()
2013-03-03 20:53:26,595 INFO Running configSet InfoTask-TailLogs
2013-03-03 20:53:26,596 INFO Running config InfoTask-TailLogs
2013-03-03 20:53:26,596 DEBUG No packages specified
2013-03-03 20:53:26,596 DEBUG No groups specified
2013-03-03 20:53:26,596 DEBUG No users specified
2013-03-03 20:53:26,596 DEBUG No sources specified
2013-03-03 20:53:26,596 DEBUG No files specified
2013-03-03 20:53:26,597 DEBUG Running command taillogs
2013-03-03 20:53:26,597 DEBUG No test for command taillogs

2) If I run the iptables commands without sudo, I dont see them getting executed at all. Basically I dont even see the references to the .config file in my log files, which makes me doubt if the config file is even picked up.

I would really appreciate any help to resolve this.

解决方案

command: echo Defaults:root \!requiretty

is wrong. Based on the docs that you linked to, it should be:

echo Defaults:root \!requiretty >> /etc/sudoers 

这篇关于AWS魔豆 - 不能使用配置文件运行命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆