简体   繁体   English

在 tomcat manager 中,如何限制用户只能部署/取消部署特定应用程序?

[英]In tomcat manager, how can I restrict users to be able to deploy/undeploy just a specific application?

could anyone please tell me if it is possible to define a role for tomcat user of the default app manager in a way, that he would be able to deploy only specific application?谁能告诉我是否有可能以某种方式为默认应用程序管理器的 tomcat 用户定义一个角色,让他只能部署特定的应用程序? The situation is that developers can deploy only via console since the server itself is administered by third party.情况是开发人员只能通过控制台进行部署,因为服务器本身是由第三方管理的。 And dealing with it costs money (literally).处理它需要花钱(字面意思)。 The security requirement is that they should be able to deploy and undeploy just the application they are working on.安全要求是他们应该能够仅部署和取消部署他们正在处理的应用程序。 The notion of multiple tomcat instances was refused.拒绝了多个 tomcat 实例的概念。 Is there any third party application which could do that?是否有任何第三方应用程序可以做到这一点? Any ideas are welcome.欢迎任何想法。

Tomcat's built in Manager application does not support this. Tomcat 的内置管理器应用程序不支持此功能。 Assuming you trust your staff, I'd suggest a different approach.假设您信任您的员工,我建议采用不同的方法。 Use social controls rather than technical controls.使用社会控制而不是技术控制。

If anyone does something they shouldn't the access logs will tell you who did it and then you can take appropriate action.如果有人做了他们不应该做的事情,访问日志会告诉你是谁做的,然后你可以采取适当的行动。

Try this:尝试这个:

First of all, Create a new users xml database file inside [tomcat_home]/conf , lets call it tomcat-users-2.xml .首先,在[tomcat_home]/conf创建一个新的用户 xml 数据库文件,我们称之为tomcat-users-2.xml

Add the following entry into the tomcat-users-2.xml file:将以下条目添加到tomcat-users-2.xml文件中:

<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
  <user username="[$yourUsername]" password="[$yourPassword]" roles="tomcat,manager-gui"/>
</tomcat-users>

Notice that you can add more than one user tags in the <tomcat-users>请注意,您可以在<tomcat-users>添加多个user标签

Then in your [tomcat_home]/conf/server.xml file, find <GlobalNamingResources> tag and add (inside it):然后在您的[tomcat_home]/conf/server.xml文件中,找到<GlobalNamingResources>标记并添加(在其中):

<Resource name="UserDatabase2" auth="Container"
          type="org.apache.catalina.UserDatabase"
          description="User database that can be updated and saved"
          factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
          pathname="conf/tomcat-users-2.xml" />

Place the following code inside the <Host ...></Host> tags of the app you want to restrict the user to:将以下代码放在您要限制用户使用的应用程序的<Host ...></Host>标签中:

<Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase2"/>

Finally you must Restart Tomcat for the changes to take effect.最后,您必须重新启动 Tomcat 以使更改生效。

For more information, check out this link有关更多信息,请查看此链接

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM