Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Apps | Demo | Docs | Install
  1. Cloudron Forum
  2. Gitea
  3. Need help to enable autosign

Need help to enable autosign

Scheduled Pinned Locked Moved Solved Gitea
27 Posts 5 Posters 15.4k Views 5 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • nebulonN nebulon

    @jaschaezra we may have to add support for that in the packaging then. Do you have a link to a tutorial or docs on how to setup the auto-signing?

    jaschaezraJ Offline
    jaschaezraJ Offline
    jaschaezra
    wrote on last edited by
    #3

    @nebulon That would be great.

    there is no real tutorial, the documentation is quite...vague. it is here: https://docs.gitea.io/en-us/signing/

    What needs ti be done (and not written down in the documentation): create a password less key.

    I normaly do it like this:

    change to the git User (su git)

    create file 'genkey-batch':

    %no-protection
    Key-Type: default
    Subkey-Type: default
    Name-Real: Gitea
    Name-Email: git@GITEADOMAIN
    Expire-Date: 0
    

    Execute key generation:

    gpg --batch --gen-key genkey-batch
    

    the Key will be added to the keychain which resides in /home/$USER/.gnupg

    You can change this with
    export GNUPGHOME=/app/data/appdata/home/.gnupg

    In the app.ini you need to add the following:

    [repository.signing]
    SIGNING_KEY = default
    SIGNING_NAME = Gitea
    SIGNING_EMAIL = git@GITEADOMAIN
    INITIAL_COMMIT = always
    CRUD_ACTIONS = pubkey, twofa, parentsigned
    WIKI = never
    MERGES = pubkey, twofa, basesigned, commitssigned
    

    The last three entries can and should be configured by the Instance Gitea-Owner, depending on what should be auto signed.

    the only thing which needs to be changed if you do it like I did is to add

    export GNUPGHOME=/app/data/appdata/home/.gnupg
    

    to the shell environment. then it works (well, it did on my old server with other paths, but it worked :))

    the only thing I would do if I package would be to add GNUPGHOME as standard and add a note in the documentation how to enable autosign.

    1 Reply Last reply
    1
    • nebulonN Offline
      nebulonN Offline
      nebulon
      Staff
      wrote on last edited by
      #4

      Thanks for the detailed description. I have changed the package to allow adding the keys and set the GNUPGHOME (this change is not published yet). It all seems fine, but I am not sure how to test or check if the signing actually was performed. Also do I have to set something for a git repository in gitea specifically to make it sign the commits?

      jaschaezraJ 1 Reply Last reply
      2
      • nebulonN nebulon marked this topic as a question on
      • nebulonN nebulon

        Thanks for the detailed description. I have changed the package to allow adding the keys and set the GNUPGHOME (this change is not published yet). It all seems fine, but I am not sure how to test or check if the signing actually was performed. Also do I have to set something for a git repository in gitea specifically to make it sign the commits?

        jaschaezraJ Offline
        jaschaezraJ Offline
        jaschaezra
        wrote on last edited by
        #5

        @nebulon I would love to test it. 🙂

        When you create a repository and init it from the webfrostend, then this commit is signed by Gitea. So in fact all the things you do in the webfrontend.

        These settings
        INITIAL_COMMIT = always CRUD_ACTIONS = pubkey, twofa, parentsigned
        say: Always sign the initial commit. Sign every other commits if the User has set a pub key OR enabled TFA or if the parent commit is signed.

        Hope that helps.

        nebulonN 1 Reply Last reply
        1
        • jaschaezraJ jaschaezra

          @nebulon I would love to test it. 🙂

          When you create a repository and init it from the webfrostend, then this commit is signed by Gitea. So in fact all the things you do in the webfrontend.

          These settings
          INITIAL_COMMIT = always CRUD_ACTIONS = pubkey, twofa, parentsigned
          say: Always sign the initial commit. Sign every other commits if the User has set a pub key OR enabled TFA or if the parent commit is signed.

          Hope that helps.

          nebulonN Offline
          nebulonN Offline
          nebulon
          Staff
          wrote on last edited by
          #6

          @jaschaezra the change is quite small https://git.cloudron.io/cloudron/gitea-app/-/commit/32eebcff8fd7c095d4e88cba396e693cb12bfbbe

          It would be great if you could test this. Basically checkout the app package repo and run cloudron build && cloudron install in the folder. Granted you have the cloudron cli tool installed and configured for your Cloudron already.

          jaschaezraJ 3 Replies Last reply
          1
          • nebulonN nebulon

            @jaschaezra the change is quite small https://git.cloudron.io/cloudron/gitea-app/-/commit/32eebcff8fd7c095d4e88cba396e693cb12bfbbe

            It would be great if you could test this. Basically checkout the app package repo and run cloudron build && cloudron install in the folder. Granted you have the cloudron cli tool installed and configured for your Cloudron already.

            jaschaezraJ Offline
            jaschaezraJ Offline
            jaschaezra
            wrote on last edited by jaschaezra
            #7

            @nebulon Thanks! I will test it later tonight and provide feedback!

            EDIT How do I build it? cloudron build asks for a registry...

            1 Reply Last reply
            1
            • nebulonN nebulon

              @jaschaezra the change is quite small https://git.cloudron.io/cloudron/gitea-app/-/commit/32eebcff8fd7c095d4e88cba396e693cb12bfbbe

              It would be great if you could test this. Basically checkout the app package repo and run cloudron build && cloudron install in the folder. Granted you have the cloudron cli tool installed and configured for your Cloudron already.

              jaschaezraJ Offline
              jaschaezraJ Offline
              jaschaezra
              wrote on last edited by
              #8
              This post is deleted!
              1 Reply Last reply
              0
              • nebulonN nebulon

                @jaschaezra the change is quite small https://git.cloudron.io/cloudron/gitea-app/-/commit/32eebcff8fd7c095d4e88cba396e693cb12bfbbe

                It would be great if you could test this. Basically checkout the app package repo and run cloudron build && cloudron install in the folder. Granted you have the cloudron cli tool installed and configured for your Cloudron already.

                jaschaezraJ Offline
                jaschaezraJ Offline
                jaschaezra
                wrote on last edited by
                #9

                @nebulon I got the image built but I can not install it.

                Location: x
                Port SSH_PORT: 29418
                Failed to install app: 409 message: Port 29418-tcp is in use```
                nebulonN 1 Reply Last reply
                0
                • jaschaezraJ jaschaezra

                  @nebulon I got the image built but I can not install it.

                  Location: x
                  Port SSH_PORT: 29418
                  Failed to install app: 409 message: Port 29418-tcp is in use```
                  nebulonN Offline
                  nebulonN Offline
                  nebulon
                  Staff
                  wrote on last edited by
                  #10

                  @jaschaezra seems like you already have an instance using the default port there. Try to run cloudron install -p for interactive way to set a different port.

                  jaschaezraJ 1 Reply Last reply
                  0
                  • nebulonN nebulon

                    @jaschaezra seems like you already have an instance using the default port there. Try to run cloudron install -p for interactive way to set a different port.

                    jaschaezraJ Offline
                    jaschaezraJ Offline
                    jaschaezra
                    wrote on last edited by
                    #11

                    @nebulon I do not know what is going on on my system but I seriously fucked something up 😞

                    Sorry, I just can not test it at the moment 😞

                    nebulonN 1 Reply Last reply
                    0
                    • jaschaezraJ jaschaezra

                      @nebulon I do not know what is going on on my system but I seriously fucked something up 😞

                      Sorry, I just can not test it at the moment 😞

                      nebulonN Offline
                      nebulonN Offline
                      nebulon
                      Staff
                      wrote on last edited by
                      #12

                      @jaschaezra there is no time pressure at all. Hope you get your system back up again though. If it is Cloudron related, let us know of course.

                      jaschaezraJ 1 Reply Last reply
                      1
                      • nebulonN nebulon

                        @jaschaezra there is no time pressure at all. Hope you get your system back up again though. If it is Cloudron related, let us know of course.

                        jaschaezraJ Offline
                        jaschaezraJ Offline
                        jaschaezra
                        wrote on last edited by
                        #13

                        @nebulon It worked for me 🙂

                        So it would be great if this can be deployed in the container. (With the latest update :D)

                        nebulonN 1 Reply Last reply
                        1
                        • jaschaezraJ jaschaezra

                          @nebulon It worked for me 🙂

                          So it would be great if this can be deployed in the container. (With the latest update :D)

                          nebulonN Offline
                          nebulonN Offline
                          nebulon
                          Staff
                          wrote on last edited by
                          #14

                          @jaschaezra thanks for testing and confirming the fix. I have pushed a new package now.

                          jaschaezraJ 1 Reply Last reply
                          1
                          • nebulonN nebulon has marked this topic as solved on
                          • nebulonN nebulon

                            @jaschaezra thanks for testing and confirming the fix. I have pushed a new package now.

                            jaschaezraJ Offline
                            jaschaezraJ Offline
                            jaschaezra
                            wrote on last edited by
                            #15

                            @nebulon I just want to add some screen I just made because I forgot them to create 😄

                            This is how you'll see it in the repository:
                            Bildschirm­foto 2022-11-29 um 20.26.02.png

                            When you take a look at the commit:
                            Bildschirm­foto 2022-11-29 um 20.26.08.png

                            The name is set in app.ini

                            For the key-creation:
                            It is much easier to do it like this:

                            gpg --default-new-key-algo rsa4096 --gen-key
                            

                            then enter the Name, the Email (git@DOMAIN) and NO password!

                            That's it.

                            jaschaezraJ 1 Reply Last reply
                            1
                            • jaschaezraJ jaschaezra

                              @nebulon I just want to add some screen I just made because I forgot them to create 😄

                              This is how you'll see it in the repository:
                              Bildschirm­foto 2022-11-29 um 20.26.02.png

                              When you take a look at the commit:
                              Bildschirm­foto 2022-11-29 um 20.26.08.png

                              The name is set in app.ini

                              For the key-creation:
                              It is much easier to do it like this:

                              gpg --default-new-key-algo rsa4096 --gen-key
                              

                              then enter the Name, the Email (git@DOMAIN) and NO password!

                              That's it.

                              jaschaezraJ Offline
                              jaschaezraJ Offline
                              jaschaezra
                              wrote on last edited by
                              #16

                              @jaschaezra BTW, you can set a Gravatar/Libravatar for git@DOMAIN and upload e.g. the gitea Logo which then is displayed.

                              Bildschirm­foto 2022-11-29 um 20.58.47.png

                              1 Reply Last reply
                              2
                              • jaschaezraJ Offline
                                jaschaezraJ Offline
                                jaschaezra
                                wrote on last edited by
                                #17

                                This is odd - after working for a looong time I suddenly get this error when creating a repository and initializing it:

                                CreatePost, initRepository: initRepoCommit: git commit: exit status 128 - error: gpg failed to sign the data
                                fatal: failed to write commit object
                                 - error: gpg failed to sign the data
                                fatal: failed to write commit object
                                

                                I first thought that maybe the key is gone. By checking this I found that:

                                root@0f44f577-d0e0-42e6-a371-d3914aba0014:/home/git# sudo -u git gpg --list-keys
                                gpg: Fatal: can't create directory '/home/git/.gnupg': Read-only file system
                                root@0f44f577-d0e0-42e6-a371-d3914aba0014:/home/git# 
                                

                                I have not changed anything and I do not know when this happened as I was not using my git for the last ~9 months.

                                Any idea what is going on @nebulon?

                                1 Reply Last reply
                                0
                                • nebulonN Offline
                                  nebulonN Offline
                                  nebulon
                                  Staff
                                  wrote on last edited by
                                  #18

                                  Just briefly rereading the thread, did you set GNUPGHOME for git user so it uses the correct (writeable) folder? Seems like the one which is used should be export GNUPGHOME=/app/data/appdata/home/.gnupg

                                  robiR jaschaezraJ 2 Replies Last reply
                                  1
                                  • nebulonN nebulon

                                    Just briefly rereading the thread, did you set GNUPGHOME for git user so it uses the correct (writeable) folder? Seems like the one which is used should be export GNUPGHOME=/app/data/appdata/home/.gnupg

                                    robiR Offline
                                    robiR Offline
                                    robi
                                    wrote on last edited by
                                    #19

                                    @nebulon might be nice to have these set when terminal is launched including HOME.

                                    Conscious tech

                                    1 Reply Last reply
                                    0
                                    • nebulonN nebulon

                                      Just briefly rereading the thread, did you set GNUPGHOME for git user so it uses the correct (writeable) folder? Seems like the one which is used should be export GNUPGHOME=/app/data/appdata/home/.gnupg

                                      jaschaezraJ Offline
                                      jaschaezraJ Offline
                                      jaschaezra
                                      wrote on last edited by
                                      #20

                                      @nebulon I now get a new error:

                                      root@0f44f577-d0e0-42e6-a371-d3914aba0014:/home/git# sudo -u git bash
                                      git@0f44f577-d0e0-42e6-a371-d3914aba0014:~$ export GNUPGHOME=/app/data/appdata/home/.gnupg
                                      git@0f44f577-d0e0-42e6-a371-d3914aba0014:~$ gpg --list-keys
                                      gpg: WARNING: unsafe permissions on homedir '/app/data/appdata/home/.gnupg'
                                      git@0f44f577-d0e0-42e6-a371-d3914aba0014:~$
                                      
                                      1 Reply Last reply
                                      0
                                      • nebulonN Offline
                                        nebulonN Offline
                                        nebulon
                                        Staff
                                        wrote on last edited by
                                        #21

                                        The permissions can be fixed up with:

                                        chmod 600 /app/data/appdata/home/.gnupg/*
                                        chmod 700 /app/data/appdata/home/.gnupg
                                        

                                        However, this is also only a warning, not sure if this is the root cause. Are there any keys in the folder itself?

                                        1 Reply Last reply
                                        0
                                        • jaschaezraJ Offline
                                          jaschaezraJ Offline
                                          jaschaezra
                                          wrote on last edited by
                                          #22

                                          Oh, no, my key is gone. That is odd as I never touched the key after it worked.

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Bookmarks
                                          • Search