有没有办法禁用 cvsd 守护进程的 cvs init 命令?

发布于 2024-08-11 04:22:09 字数 407 浏览 3 评论 0原文

有没有办法阻止用户执行“cvs init”?

“cvs init”创建一个新的存储库。该文档表示,这是对现有存储库的安全操作,因为它不会覆盖任何文件。但问题是,CVSROOT 中的管理文件将被更改。

例如,我们有一个 CVSROOT/loginfo 脚本,用于将提交信息邮寄到邮件组。在该存储库上执行 cvs init 后,它会被“干净”版本替换。

我们在作为独立服务器运行的 Linux 机器上使用 cvs 1.12.13,并主要使用 pserver 协议从 Windows 进行连接。

在 CVSROOT 中设置权限没有帮助,因为 cvsd 守护进程以 root 身份运行。 (它需要合并到执行用户中)。

问题是,一些不太熟悉 cvs 的用户尝试使用“cvs init”而不是“cvs import”来创建新模块。

Is there a way to prevent users from doing 'cvs init'?

'cvs init' creates a new repository. The doc says it is a safe operation on an existing repository, since it does not overwrite any files. But the problem is, administrative files in CVSROOT will be changed.

For example, we have a CVSROOT/loginfo script that mails commit info to a mailing group. After doing cvs init on that repo, it is replaced by a 'clean' version.

We use cvs 1.12.13 on a linux box running as stand-alone server and connect mostly from windows using the pserver protocol.

Setting the rights in CVSROOT didn't help, because the cvsd daemon runs as root. (It needs to incorporate into the executing user).

Problem is, that some users not so familiar with cvs tried 'cvs init' instead of 'cvs import' to create a new module.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

剧终人散尽 2024-08-18 04:22:09

我假设您拥有机器的系统管理员权限。您可以在真实的 CVS 二进制文件周围提供一个包装器,以防止某些命令运行,并以在真实的 CVS 之前获取该包装器的方式存储该包装器。这有点像黑客,但在紧要关头,它会起作用:

#!/bin/bash

REAL_CVS=/usr/bin/cvs

case $1 in
  init)
  echo "The use of $1 is restricted. Contact your CVS administrator"
  exit 1
esac

$REAL_CVS $*`

另一个选择是重新编译 CVS 客户端以禁用 init 命令。看一下:

http://cvs.savannah.gnu.org/viewvc/cvs/ccvs/src/client.c?revision=1.483&view=markup

修改这个函数来打印一些东西是很简单的。

void
send_init_command (void)
{
    /* This is here because we need the current_parsed_root->directory variable.  */
    send_to_server ("init ", 0);
    send_to_server (current_parsed_root->directory, 0);
    send_to_server ("\012", 0);
}

I'm assuming that you have sysadmin authority over the machines. You could provide a wrapper around the real CVS binary to prevent certain commands from running and store this wrapper in such a way that it gets picked up before the real CVS. It's a bit of a hack but in a pinch, it would work:

#!/bin/bash

REAL_CVS=/usr/bin/cvs

case $1 in
  init)
  echo "The use of $1 is restricted. Contact your CVS administrator"
  exit 1
esac

$REAL_CVS $*`

An other option would be to recompile the CVS client to disable the init command. Take a look at:

http://cvs.savannah.gnu.org/viewvc/cvs/ccvs/src/client.c?revision=1.483&view=markup

It would be trivial to modify this function to print out something.

void
send_init_command (void)
{
    /* This is here because we need the current_parsed_root->directory variable.  */
    send_to_server ("init ", 0);
    send_to_server (current_parsed_root->directory, 0);
    send_to_server ("\012", 0);
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文