2. Create and compile this kind of script and change the path in above hook (change the `appArmorProfile` to an already loaded profile
```text
const (
appArmorProfile = "profile-name"
)
func main() {
// Read data from stdin.
data, err := io.ReadAll(os.Stdin)
if err != nil {
fmt.Println("Error reading from stdin:", err)
os.Exit(1)
}
var spec specs.Spec
err = json.Unmarshal(data, &spec)
spec.Process.ApparmorProfile = appArmorProfile
if err != nil {
fmt.Println("Error unmarshaling data to JSON:", err)
os.Exit(1)
}
if err := json.NewEncoder(os.Stdout).Encode(spec); err != nil {
fmt.Println("Error encoding data to JSON:", err)
os.Exit(1)
}
}
Run the container using (change the image name according to you)
Issue Description
I am trying to load an AppArmor profile using OCI hooks and without passing the
--security-opt
flag. But it is causing some issues.Steps to reproduce the issue
Steps to reproduce the issue
Run the container using (change the image name according to you)
Run
You will see it will show your custom app-armor profile name
Now exec into your container and try to violate the profile, you will find that it is not blocking anything
Now exec into the container and run
You will observe that it also shows the correct profile name
Now run this inside container
You will observe it is showing the default app-armor profile not the custom
Try out with other PIDs also, you will observe that profile name is not consistent.
Describe the results you received
Results are stated above
Describe the results you expected
I have written the expectations in the description itself
podman info output
Podman in a container
No
Privileged Or Rootless
None
Upstream Latest Release
Yes
Additional environment details
Additional environment details
Additional information
Additional information like issue happens only occasionally or issue happens with a particular architecture or on a particular setting