ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Install ownCloud 8.x on CentOS 7

    IT Discussion
    how to owncloud centos 7 real instructions owncloud 8.2
    8
    44
    17.7k
    Loading More Posts
    • 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.
    • JaredBuschJ
      JaredBusch @dafyre
      last edited by

      @dafyre said:

      For free SSL, I've been using StartCom (http://www.startssl.com/?app=32). Works great in Desktop OSes... Still not trusted on mobile devices yet.

      You cannot do subdomains with them I believe? I looked into them once before and there was a problem with it, but I do not recall what.

      dafyreD 1 Reply Last reply Reply Quote 0
      • coliverC
        coliver @dafyre
        last edited by

        @dafyre said:

        For free SSL, I've been using StartCom (http://www.startssl.com/?app=32). Works great in Desktop OSes... Still not trusted on mobile devices yet.

        I use them for my own OwnCloud instance. Works amazing. All of my Android phones recognized them as well.

        1 Reply Last reply Reply Quote 1
        • stacksofplatesS
          stacksofplates @JaredBusch
          last edited by stacksofplates

          @JaredBusch said:

          @jospoortvliet any feedback on the SELinux issues?

          If I set SELinux back to enforcing, I get an error that the config directory cannot be wrote to.

          I ran these commands as listed:

          semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/data'
          restorecon '/var/www/html/owncloud/data'
          semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/config'
          restorecon '/var/www/html/owncloud/config'
          semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/apps'
          restorecon '/var/www/html/owncloud/apps'

          But unless i use setenforce permissive it does not work.

          What if you just do

          chcon -R -t httpd_sys_rw_content_t /var/www/html/owncloud/config
          

          You can also find another folder with the same label type and try it.

          chcon -R --reference=<known good folder> /var/www/html/owncloud/config
          
          JaredBuschJ 1 Reply Last reply Reply Quote 1
          • JaredBuschJ
            JaredBusch @stacksofplates
            last edited by

            @johnhooks said:

            What if you just do

            chcon -R -t httpd_sys_rw_content_t /var/www/html/owncloud/config
            

            That worked. So now to understand why, because I admit to not knowing a lot about SELinux.

            Did not the semanage command set the security context as expected? Would this imply that potentially, the other commands also did not do what was expected fo rthe /data and /apps folders?

            stacksofplatesS 1 Reply Last reply Reply Quote 0
            • stacksofplatesS
              stacksofplates
              last edited by stacksofplates

              This post is deleted!
              1 Reply Last reply Reply Quote 0
              • stacksofplatesS
                stacksofplates @JaredBusch
                last edited by

                @JaredBusch said:

                @johnhooks said:

                What if you just do

                chcon -R -t httpd_sys_rw_content_t /var/www/html/owncloud/config
                

                That worked. So now to understand why, because I admit to not knowing a lot about SELinux.

                Did not the semanage command set the security context as expected? Would this imply that potentially, the other commands also did not do what was expected fo rthe /data and /apps folders?

                Was there data in the folder before the context change? If so they didn't add the -R for the restorecon command. Chcon doesn't create a permanent change, so you should be able to type:

                restorecon -R  -v /var/www/html/owncloud/config
                

                And it will put everything back the way it was. Then if you type

                ls -lZ /var/www/html/owncloud/config
                

                it will list the context for all of the files in the config folder. If they are back to the original context but the parent folder isn't, that's what happened. If not something else happened.

                1 Reply Last reply Reply Quote 1
                • stacksofplatesS
                  stacksofplates
                  last edited by stacksofplates

                  And after a little more looking around, even if you use the -R on restorecon it still wouldn't work. That's because the semanage command they have listed doesn't change the files inside. It should look like this:

                  semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/html/owncloud/config(/.*)?"
                  

                  Then it will include everything inside the folder.

                  So it would seem you would have to run that for each folder again.

                  If you pass -v with restorecon it will show you all the files it changed so you can make sure it did it correctly.

                  JaredBuschJ 1 Reply Last reply Reply Quote 0
                  • JaredBuschJ
                    JaredBusch @stacksofplates
                    last edited by

                    @johnhooks said:

                    And after a little more looking around, even if you use the -R on restorecon it still wouldn't work. That's because the semanage command they have listed doesn't change the files inside. It should look like this:

                    semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/html/owncloud/config(/.*)?"
                    

                    Then it will include everything inside the folder.

                    So it would seem you would have to run that for each folder again.

                    If you pass -v with restorecon it will show you all the files it changed so you can make sure it did it correctly.

                    I have not had time to circle back to this, but I will. thanks.

                    1 Reply Last reply Reply Quote 1
                    • JaredBuschJ
                      JaredBusch
                      last edited by JaredBusch

                      More stupid issues with ownCloud. The system I setup while creating these instructions is wokring normally for the users. But here is more evidence that ownCloud just does not quite get things right...

                      This is what greats me when logged in to the settings tab as an administrator.

                      https://i.imgur.com/dmMHYbN.jpg

                      1 Reply Last reply Reply Quote 0
                      • stacksofplatesS
                        stacksofplates
                        last edited by

                        I set up an ownCloud system one time, but I did find that Seafile seems to sync much faster. They've also come a long way with their web interface.

                        1 Reply Last reply Reply Quote 0
                        • JaredBuschJ
                          JaredBusch
                          last edited by JaredBusch

                          ownCloud is REALLY making it hard to love them. My personal system setup last year has issues, but it was hacked together in CentOS 7 before the EPEL was even out for 7. I expected problems.

                          But this new install is now up but without disc space because I assumed (wrongly) that ownCloud would put their default data directory in whatever their install kit makes the largest ext3 partition. Nope..
                          The default location is /var/www/html/owncloud/data. A 50GB partition from a 300 GB vdisk.

                          [root@owncloud ~]# df -h
                          Filesystem               Size  Used Avail Use% Mounted on
                          /dev/mapper/centos-root   50G   18G   33G  36% /
                          devtmpfs                 232M     0  232M   0% /dev
                          tmpfs                    241M     0  241M   0% /dev/shm
                          tmpfs                    241M  4.3M  236M   2% /run
                          tmpfs                    241M     0  241M   0% /sys/fs/cgroup
                          /dev/sda2                497M  129M  368M  26% /boot
                          /dev/sda1                200M  9.8M  191M   5% /boot/efi
                          /dev/mapper/centos-home  249G   33M  249G   1% /home
                          
                          1 Reply Last reply Reply Quote 1
                          • JaredBuschJ
                            JaredBusch
                            last edited by JaredBusch

                            I moved everything easily enough, but my point is that a default install should handle this.

                            To move everything shut down the webserver
                            systemctl stop httpd

                            Create the directory structure up to just before the /data folder. IN my case I wanted to simply move it to /home/owncloud/data.
                            mkdir /home/owncloud

                            Now move the data folder.
                            mv /var/www/html/owncloud/data /home/owncloud/data

                            Change ownership to apache
                            chown -R apache:apache /home/owncloud/data

                            Update SELinux
                            semanage fcontext -a -t httpd_sys_rw_content_t "/home/owncloud/data(/.*)?"

                            Edit the ownCloud config file to reflect the new location
                            sed -i -e 's/\/var\/www\/html\/owncloud\/data/\/home\/owncloud\/data/' /var/www/html/owncloud/config/config.php

                            Restart the webserver
                            systemctl start httpd

                            1 Reply Last reply Reply Quote 2
                            • JaredBuschJ
                              JaredBusch
                              last edited by

                              Now it all looks like this.

                              [root@owncloud ~]# df -h
                              Filesystem               Size  Used Avail Use% Mounted on
                              /dev/mapper/centos-root   50G  1.4G   49G   3% /
                              devtmpfs                 232M     0  232M   0% /dev
                              tmpfs                    241M     0  241M   0% /dev/shm
                              tmpfs                    241M  4.3M  236M   2% /run
                              tmpfs                    241M     0  241M   0% /sys/fs/cgroup
                              /dev/sda2                497M  129M  368M  26% /boot
                              /dev/sda1                200M  9.8M  191M   5% /boot/efi
                              /dev/mapper/centos-home  249G   34G  215G  14% /home
                              
                              1 Reply Last reply Reply Quote 0
                              • dafyreD
                                dafyre @JaredBusch
                                last edited by

                                @JaredBusch said:

                                @dafyre said:

                                For free SSL, I've been using StartCom (http://www.startssl.com/?app=32). Works great in Desktop OSes... Still not trusted on mobile devices yet.

                                You cannot do subdomains with them I believe? I looked into them once before and there was a problem with it, but I do not recall what.

                                I've not had any problems with the subdomains. They just make you verify that you own the top level domain.... It works great so far.

                                JaredBuschJ 1 Reply Last reply Reply Quote 0
                                • JaredBuschJ
                                  JaredBusch @dafyre
                                  last edited by

                                  @dafyre said:

                                  @JaredBusch said:

                                  @dafyre said:

                                  For free SSL, I've been using StartCom (http://www.startssl.com/?app=32). Works great in Desktop OSes... Still not trusted on mobile devices yet.

                                  You cannot do subdomains with them I believe? I looked into them once before and there was a problem with it, but I do not recall what.

                                  I've not had any problems with the subdomains. They just make you verify that you own the top level domain.... It works great so far.

                                  I never tried. I stopped when I seen this. See, I apparently was not paying attention to detail and assumed.. My cert is now created, thanks!

                                  https://i.imgur.com/otsGn8i.jpg

                                  1 Reply Last reply Reply Quote 0
                                  • JaredBuschJ
                                    JaredBusch
                                    last edited by JaredBusch

                                    With ownCloud now working, you should secure logins with fail2ban

                                    Install fail2ban
                                    yum -y install fail2ban

                                    create the initial jail file
                                    cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local

                                    add ownlcoud to the jail.local
                                    nano /etc/fail2ban/jail.local

                                    paste this data in at the bottom

                                    [owncloud]
                                    enabled = true
                                    filter  = owncloud
                                    port    = http,https
                                    # 'This is the data path we set earlier. Change if yours is different.'
                                    logpath = /home/owncloud/data/owncloud.log
                                    

                                    Create the owncloud filter file
                                    nano /etc/fail2ban/filter.d/owncloud.conf

                                    Paste in the following ONLY FOR ownCloud 8.2
                                    Other regex patterns can be found in this thread

                                    [Definition]
                                    failregex={"reqId":".*","remoteAddr":".*","app":"core","message":"Login failed: '.*' \(Remote IP: '<HOST>'\)","level":2,"time":".*"}
                                    
                                    ignoreregex =
                                    

                                    Start fail2ban and enable it to start on boot
                                    systemctl start fail2ban
                                    systemctl enable fail2ban

                                    Note: This is only securing ownCloud. Consult the jail.local to enable other protections you may want.

                                    1 Reply Last reply Reply Quote 0
                                    • JaredBuschJ
                                      JaredBusch
                                      last edited by

                                      Note, I am still having issues with getting the SELinux labels right and currently still have it set to permissive.

                                      A 1 Reply Last reply Reply Quote 0
                                      • A
                                        Alex Sage @JaredBusch
                                        last edited by

                                        @JaredBusch said:

                                        Note, I am still having issues with getting the SELinux labels right and currently still have it set to permissive.

                                        Did you ever get this fixed?

                                        JaredBuschJ 1 Reply Last reply Reply Quote 0
                                        • JaredBuschJ
                                          JaredBusch @Alex Sage
                                          last edited by

                                          @anonymous said:

                                          @JaredBusch said:

                                          Note, I am still having issues with getting the SELinux labels right and currently still have it set to permissive.

                                          Did you ever get this fixed?

                                          Maybe? I have installed another server and I am not having the same problems. I have not had time to track it down yet.

                                          1 Reply Last reply Reply Quote 0
                                          • JaredBuschJ
                                            JaredBusch
                                            last edited by JaredBusch

                                            Coming back to this. Everything is running correctly with SELinux on except fail2ban.

                                            I have to disable SELinux in order for fail2ban to have access to the owncloud.log file.

                                            [root@owncloud log]# systemctl start fail2ban
                                            Job for fail2ban.service failed because the control process exited with error code. See "systemctl status fail2ban.service" and "journalctl -xe" for details.
                                            [root@owncloud log]# setenforce 0
                                            [root@owncloud log]# systemctl start fail2ban
                                            [root@owncloud log]#
                                            
                                            -- Unit fail2ban.service has begun starting up.
                                            Feb 24 15:13:26 owncloud fail2ban-client[15984]: ERROR  No file(s) found for glob /home/owncloud/data/owncloud.log
                                            Feb 24 15:13:26 owncloud fail2ban-client[15984]: ERROR  Failed during configuration: Have not found any log file for owncloud ja
                                            Feb 24 15:13:26 owncloud systemd[1]: fail2ban.service: control process exited, code=exited status=255
                                            Feb 24 15:13:26 owncloud systemd[1]: Failed to start Fail2Ban Service.
                                            
                                            [root@owncloud log]# ls -l /home/owncloud/data/owncloud.log
                                            -rw-r-----. 1 apache apache 38136 Feb 24 15:09 /home/owncloud/data/owncloud.log
                                            [root@owncloud log]#
                                            
                                            1 Reply Last reply Reply Quote 1
                                            • 1
                                            • 2
                                            • 3
                                            • 1 / 3
                                            • First post
                                              Last post