Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cos-tool binary permissions 775 in charmcraft.yaml and 755 in charm #242

Open
MichaelThamm opened this issue Jan 22, 2025 · 1 comment
Open

Comments

@MichaelThamm
Copy link
Contributor

MichaelThamm commented Jan 22, 2025

Bug Description

In the charmcraft.yaml we:

    override-pull: |
      curl -L -O https://github.com/canonical/cos-tool/releases/latest/download/cos-tool-${CRAFT_ARCH_BUILD_FOR}
      chmod 775 cos-tool-*

Which should result in 775 permissions on the cos-tool binary, but when checking the permissions in the VM we get 755.

To Reproduce

Note: This occurs when packing the charm locally from main and latest/edge from charmhub.

default-base: [email protected]/stable
applications:
  gagent:
    charm: grafana-agent
    channel: latest/edge
    revision: 396
    trust: true
  zookeeper:
    charm: zookeeper
    channel: 3/stable
    revision: 149
    num_units: 1
    to:
    - "0"
    constraints: arch=amd64
    storage:
      data: rootfs,1,1024M
    trust: true
machines:
  "0":
    constraints: arch=amd64
relations:
- - zookeeper:cos-agent
  - gagent:cos-agent

Relevant log output

juju ssh gagent/0 "ls -la1 /var/lib/juju/agents/unit-gagent-0/charm/cos-tool-amd64"

  • -rwxr-xr-x 1 root root 14864384 Jan 22 17:25 /var/lib/juju/agents/unit-gagent-0/charm/cos-tool-amd64

Which is 755 not 775!

@MichaelThamm MichaelThamm transferred this issue from canonical/grafana-agent-k8s-operator Jan 22, 2025
@MichaelThamm MichaelThamm changed the title Cos-tool binary is world-writable, need to restrict permissions Cos-tool binary is defined as 775 in charmcraft.yaml and 755 in charm Jan 22, 2025
@MichaelThamm MichaelThamm changed the title Cos-tool binary is defined as 775 in charmcraft.yaml and 755 in charm Cos-tool binary permissions 775 in charmcraft.yaml and 755 in charm Jan 22, 2025
@MichaelThamm
Copy link
Contributor Author

Instead of running chmod on the binary after installing it we should add a permissions key in the charmcraft.yaml similar to how we do it in our rocks:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant