gpt4 book ai didi

amazon-web-services - AWS Beanstalk - 无法使用配置文件运行命令

转载 作者:行者123 更新时间:2023-12-04 08:12:49 24 4
gpt4 key购买 nike

我使用 beantalk 安装了 Tomcat 7。我试图通过将命令放在 .config(yaml) 文件中来在该环境中运行以下命令,如下所示:

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

配置文件命令:

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

这是我的推论:

1) 我听从了这个帖子中的建议 --> https://forums.aws.amazon.com/message.jspa?messageID=395894并将上面显示的内容放入我的 .config 文件并上传我的 .war 只是为了得到以下错误

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) 如果我在没有 sudo 的情况下运行 iptables 命令,我根本看不到它们被执行。基本上,我什至没有在我的日志文件中看到对 .config 文件的引用,这让我怀疑配置文件是否被提取。

如果能帮我解决这个问题,我将不胜感激。

最佳答案

command: echo Defaults:root \!requiretty

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

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

关于amazon-web-services - AWS Beanstalk - 无法使用配置文件运行命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15195279/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com