zardus / ctf-tools

Some setup scripts for security research tools.
BSD 3-Clause "New" or "Revised" License
8.38k stars 1.88k forks source link

Support symlinks to manage-tools #155

Closed ypcrts closed 6 years ago

ypcrts commented 6 years ago
zardus commented 6 years ago

Are there problems with the current "symlink-agnostic" way manage-tools works? I don't see an issue with having CTF_TOOLS_ROOT point to the symlink. In fact, if I'm symlinking ctftools, I'd probably prefer to have the tools have the symlink in their configurations rather than the real path.

ypcrts commented 6 years ago

Are there problems with the current "symlink-agnostic" way manage-tools works?

Yes. Currently in HEAD we chdir like this https://github.com/zardus/ctf-tools/blob/9b5a706ee7ebc16d1c80637d577610abf98cf007/bin/manage-tools#L310

Consider this setup:

git clone https://github.com/zardus/ctf-tools ~/Projects/ctf-tools
ln -s ~/Projects/ctf-tools/bin/manage-tools ~/bin/zardus_ctf_tools
export PATH="$PATH:~/bin"

asciicast

ypcrts commented 6 years ago

Of course this is not an intended use case, but if the minor patch doesn't hurt, it would be nice to have.

zardus commented 6 years ago

I see... So this is used when manage_tools is linked in to a bin dir somewhere instead of the ctf-tools bin dir being added to PATH?

What I dislike about this is that I think it'll subtly break the case when the ctf-tools directory itself is sym-linked. The directory link will be resolved by realpath, and all the tools will install expecting that real path. I have had installs that this would have broken, but I've never had installs where I linked in manage_tools instead of adding its bin dir to my path. :-(