🚀 Freeipa Integrated with NextCloud 🚀

FreeIPA Nextcloud MariaDB "mysql"

ـــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ

1- Install Docker-compose ✨

$ sudo curl -L "https://github.com/docker/compose/releases/download/1.27.3/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
$ sudo chmod +x /usr/local/bin/docker-compose

2- Test the installation ✨

$ docker-compose --version
docker-compose version 1.27.3, build 1110ad01

ـــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ

1- Create freeipa Container as below ✨

  • define your version of your docker-compose file :
version: "3.7"
services:
  • define your container name "freeipa" , define the "image" you will use for your freeipa image.
freeipa:
    image: freeipa/freeipa-server:centos-8
  • The container is always restarts.
restart: always
  • change "ipa.ldap.local" to your Hostname
hostname: ipa.ldap.local
environment:
    - IPA_SERVER_HOSTNAME=ipa.ldap.local
tty: true
stdin_open: true
cap_add:
    - NET_ADMIN
  • All data beyond what lives in the database is stored in the docker volume as you defined it,That means your data is saved even if the container crashes, is stopped or deleted.
        volumes:
          - /sys/fs/cgroup:/sys/fs/cgroup:ro
          - ./data/freeipa:/data:Z
  • Disable IPV6
        sysctls:
          - net.ipv6.conf.lo.disable_ipv6=0
          - net.ipv6.conf.all.disable_ipv6=0
        security_opt:
          - "seccomp:unconfined"
  • Configure the FreeIPA master using the inputs provided. For unattended initial installation, if you want to allow dns server, delete # from the beginning.
        command:
          - -U
          - --domain=ldap.local         # add your domain name only
          - --realm=ldap.local
          - --http-pin=UltraS3cure
          - --dirsrv-pin=UltraS3cure
          - --ds-password=UltraS3cure       
          - --admin-password=UltraS3cure    # your default password
          - --no-host-dns
          #- --no-dnssec-validation
          #- --setup-dns
          #- --auto-forwarders
          #- --allow-zone-overlap
          - --unattended
  • Expose the freeipa ports :
        ports:
          #- "53:53/udp"
          #- "53:53"
          - "80:80"
          - "443:443"
          - "389:389"
          - "636:636"
          - "88:88"
          - "464:464"
          - "88:88/udp"
          - "464:464/udp"
          - "123:123/udp"
          - "7389:7389"
          - "9443:9443"
          - "9444:9444"
          - "9445:9445"
  • The Important step for make the Integration between freeipa with Nextcloud , it makes the link between 2 containers.
depends_on:
    - nextcloud         # name of the container, you need to make the link.      
  • define the network card name.
networks:
    - nextcloud_network

ـــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ

2- Create Nextcloud Container as below ✨

  • define the nextcloud service on docker-compose file undername nextcloud.
  • select the image you will use , I use the latest version.
  • define the name of the container.
    nextcloud:
        image: nextcloud:latest
        container_name: nextcloud-app
  • Expose the port '8080' into local machine, and port '80' from docker container.
        ports: 
            - 8080:80
  • All data beyond what lives in the database is stored in the docker volume as you defined it,That means your data is saved even if the container crashes, is stopped or deleted.
  • . it's mean the same directory which the docker-compose file there.
        volumes:
            - ./data/nextcloud:/var/www/html
            - ./data/app/config:/var/www/html/config
            - ./data/app/custom_apps:/var/www/html/custom_apps
            - ./data/app/data:/var/www/html/data
            - ./data/app/themes:/var/www/html/themes
            - /etc/localtime:/etc/localtime:ro
                        
  • define the environment methods , and write your domain name or your IP.
  • cloud.ldap.local <-- domain name
        environment:
            - VIRTUAL_HOST=cloud.ldap.local
            - LETSENCRYPT_HOST=cloud.ldap.local
            - LETSENCRYPT_EMAIL=hakim@gmail.com
        restart: always
        networks:
            - nextcloud_network
  • Nextcloud needs database will depend on it , db it mean the database name of service.
        depends_on:
            - db

ـــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ

3- Create Maria-DB "mysql" Database Container as below ✨

  • define the service name db , Image name mariadb , Container name nextcloud-mariadb, network card name nextcloud_network.
    db:
        image: mariadb
        container_name: nextcloud-mariadb
        restart : always
        networks:
            - nextcloud_network
  • make mount volume for database.
        volumes:
            - ./data/db:/var/lib/mysql
            - /etc/localtime:/etc/localtime:ro
  • define the database name,password,user name.
        environment:
            - MYSQL_ROOT_PASSWORD=toor
            - MYSQL_PASSWORD=mysql
            - MYSQL_DATABASE=nextcloud
            - MYSQL_USER=nextcloud
  • define on the root level the volumes names for create automatickly
volumes:
    nextcloud:
    db:
    datafreeipa:
  • define network card for creation :
networks:
    nextcloud_network:

ـــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ

Edit your hosts file if you don't have DNS server, and add this lines , your local IP or your localHost with your hostname for Freeipa , Nextcloud.

hosts

- Run docker-compose

docker-compose up -d

if you want to show the logs , run this command

docker-compose logs -f
  • wait for freeipa finishing the Installation and configuration.

ـــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ

  • Configure Nextcloud application for start and Integration
  • open browser and go to http://cloud.ldap.local:8080
  • user name is admin password admin
  • Press Finish setup

Image3

Image4

Image5

Image6

Image7

Image8

Image9

Image10

Image11

Image12

Image13

Image14

ـــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ

  • Login to LDAP Server and testing for adding user and go back to nextcloud to join by the same user.
  • open browser and go to http://ipa.ldap.local
  • user name admin password UltraS3cure

Image15

Image16

Image17

ـــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ

  • go back to nextcloud for test the hakim user.

Image18

Image19

Image20

Image21

ـــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ

  • Done :)