che icon indicating copy to clipboard operation
che copied to clipboard

User Rights in Plugin-Container

Open wgbeckmann opened this issue 7 years ago • 8 comments

Hi, I want to work with a Java Maven Project in Eclipse Che under Open Shift. I have the issue, that the user is changed after a Restart of the Workspace. So the next maven clean install run into:

 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean (default-clean) on project ProConChe: Failed to clean project: Failed to delete /projects/ProConChe/target/test-classes -> [Help 1]

In the maven terminal a whoami results:

bash-4.4 /projects/ProConChe $ whoami
user

But an ls shows, that the user chanched:

bash-4.4 /projects/ProConChe $ ls -la
total 20
drwxr-xr-x. 6 1000290000 root  147 Aug 15 14:49 .
drwxrwxrwx. 5 root       root   48 Aug  7 05:48 ..
-rw-r--r--. 1 1000290000 root 1968 Aug  7 08:08 .classpath
drwxr-xr-x. 8 1000290000 root  203 Aug  7 08:14 .git
-rw-r--r--. 1 1000290000 root    7 Aug  7 04:48 .gitignore
-rw-r--r--. 1 1000290000 root  538 Aug  7 08:07 .project
drwxr-xr-x. 2 1000290000 root  152 Aug  7 08:08 .settings
-rw-r--r--. 1 1000290000 root 3416 Aug  7 04:46 devfile.yaml
-rw-r--r--. 1 1000290000 root 2588 Aug  7 08:05 pom.xml
drwxr-xr-x. 3 1000290000 root   18 Aug  6 14:55 src
drwxr-xr-x. 8 1000290000 root  140 Sep  8 07:49 target

The Problem is, that the rights of the target dir is only writable for the owner.

Im using Clipse Che 7.2.0-SNAPSHOT

wgbeckmann avatar Sep 09 '19 14:09 wgbeckmann

@wgbeckmann Could you also please add

  • How you deployed Che (i.e. if chectl, what command you used)
    • Are you running locally on in a cluster?
  • The devfile you're using (is it the default java-maven devfile from the dashboard)
  • The actual uid being used when you run your workspace (i.e. the output of id in a workspace terminal)

I'm having trouble reproducing this, but the way arbitrary user ids work on OpenShift is that they default to the first available ID in the project's assigned range, so I'm getting the same uid on every workspace start.

amisevsk avatar Sep 09 '19 15:09 amisevsk

@amisevsk

  • I installed che with ./deploy_che.sh --project=eclipse-che on our OpenShift Single Node Cluster (origin v3.9.0) on premise.

  • The actual id is

bash-4.4 /projects $ id
uid=10001(user) gid=0(root) groups=0(root)
  • here my devfile
metadata:
  name: ProConChe2
projects:
  - name: ProConChe
    source:
      location: 'http://vm-eclipse-che-01.team-pb.de:10080/wb/ProConChe.git'
      type: git
      branch: master
components:
  - mountSources: true
    endpoints:
      - name: 8080/tcp
        port: 8080
    memoryLimit: 512Mi
    type: dockerimage
    image: 'quay.io/eclipse/che-java11-maven:nightly'
    alias: maven
    env:
      - value: /home/user/.m2
        name: MAVEN_CONFIG
      - value: >-
          -XX:MaxRAMPercentage=50 -XX:+UseParallelGC -XX:MinHeapFreeRatio=10
          -XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4
          -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true
          -Xms20m -Djava.security.egd=file:/dev/./urandom -Duser.home=/home/user
          -Dhttp.proxySet=true -Dhttp.proxyHost==http -Dhttp.proxyPort=8080
          -Dhttps.proxyHost=xxx.xxx.xxx.xxx -Dhttps.proxyPort=8080
          -Dhttp.nonProxyHosts='che-host|localhost|127.0.0.1|*.team-pb.de|vm-eclipse-che-01|xxx.xxx.xxx.xxx|'
        name: MAVEN_OPTS
      - value: >-
          -XX:MaxRAMPercentage=50 -XX:+UseParallelGC -XX:MinHeapFreeRatio=10
          -XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4
          -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true
          -Xms20m -Djava.security.egd=file:/dev/./urandom -Dhttp.proxySet=true
          -Dhttp.proxyHost==http -Dhttp.proxyPort=8080
          -Dhttps.proxyHost=xxx.xxx.xxx.xxx -Dhttps.proxyPort=8080
          -Dhttp.nonProxyHosts='che-host|localhost|127.0.0.1|*.team-pb.de|vm-eclipse-che-01|xxx.xxx.xxx.xxx|'
        name: JAVA_OPTS
      - value: >-
          -XX:MaxRAMPercentage=50 -XX:+UseParallelGC -XX:MinHeapFreeRatio=10
          -XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4
          -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true
          -Xms20m -Djava.security.egd=file:/dev/./urandom -Dhttp.proxySet=true
          -Dhttp.proxyHost==http -Dhttp.proxyPort=8080
          -Dhttps.proxyHost=xxx.xxx.xxx.xxx -Dhttps.proxyPort=8080
          -Dhttp.nonProxyHosts='che-host|localhost|127.0.0.1|*.team-pb.de|vm-eclipse-che-01|xxx.xxx.xxx.xxx|'
        name: JAVA_TOOL_OPTIONS
  - mountSources: true
    endpoints:
      - name: 8080/tcp
        port: 8080
    type: dockerimage
    volumes:
      - name: webapps
        containerPath: /usr/local/tomcat/webapps
    image: tomcat
    alias: tomcat
  - id: redhat/java/latest
    type: chePlugin
  - id: eclipse/che-theia/latest
    type: cheEditor
apiVersion: 1.0.0
commands:
  - name: clean build
    actions:
      - type: exec
        command: mvn clean install -f `find . -name "pom.xml" -print -quit`
        component: maven
  - name: build
    actions:
      - type: exec
        command: mvn install -f `find . -name "pom.xml" -print -quit`
        component: maven
  - name: Update Webapp
    actions:
      - type: exec
        command: >-
          echo "Copy " && cp `find $CHE_PROJECTS_ROOT -name "*.war" -print
          -quit` $CATALINA_HOME/webapps/ROOT.war && find $CHE_PROJECTS_ROOT
          -name "*.war" -print -quit
        component: tomcat

wgbeckmann avatar Sep 09 '19 16:09 wgbeckmann

@wgbeckmann as a workaround you can try the ephemeral mode:

attributes: persistVolumes: 'false'

e.g. https://github.com/redhat-developer/devfile/blob/master/getting-started/java-gradle/devfile.yaml#L5-L6

ibuziuk avatar Sep 09 '19 16:09 ibuziuk

@wgbeckmann Running on OpenShift as user 10001 is pretty strange; is there some specific configuration on the cluster? AFAIK, OpenShift by default will run containers as a user in the range specified at the project level (the 1000290000 from the previous run). The only way I know of to run as user 10001 would be to change some cluster-level configuration.

Could you share the output of oc describe project eclipse-che? Specifically, the annotation openshift.io/sa.scc.uid-range.

amisevsk avatar Sep 09 '19 17:09 amisevsk

We run the OpenShift Cluster with anyuid for every Project. We do this by adding system:authenticated to the groups section of the scc anyuid

wgbeckmann avatar Sep 09 '19 18:09 wgbeckmann

After I revoced it all containers are running with the same userid (1000290000). That was the issue. Thanks!

wgbeckmann avatar Sep 09 '19 18:09 wgbeckmann

@wgbeckmann I think the main issue is that it seems the setting changed between launches; you should also be able to use anyuid, so long as you create the workspace with anyuid enabled.

I don't expect file permissions to necessarily work between uid changes, but if you encounter a Che workspace that fails to run between launches (without changes on the cluster), that definitely warrants an issue.

amisevsk avatar Sep 09 '19 19:09 amisevsk

Ok, Thanks

wgbeckmann avatar Sep 11 '19 16:09 wgbeckmann