Skip to content

Configuration_Intra

fantuzziSebastien edited this page Jun 8, 2022 · 8 revisions

Créer le dossier "interne" au même niveau que les dossiers "DNS","Mail", etc.
mkdir interne
Dans ce dossier nouvellement créé, il faut créer les autres dossiers nécessaires :
mkdir user
mkdir RESOLVER
mkdir SOA-in
mkdir cloud
nano docker-compose.yml

Partie SOA-in

Dans ce dossier, il faut créer les dossiers ci-dessous avec la commande nano.
Dockerfile

FROM ubuntu:latest

RUN apt update && apt full-upgrade -y && apt install bind9 bind9utils dnsutils net-tools nano -y

COPY named.conf /etc/bind/named.conf
COPY intranet.m1-5.ephec-ti.be /etc/bind/intranet.m1-5.ephec-ti.be
COPY reverse /etc/bind/reverse

CMD ["named", "-c", "/etc/bind/named.conf", "-g"]

intranet.m1-5.ephec-ti.be

$ORIGIN intranet.m1-5.ephec-ti.be.
$TTL 604800
@       IN      SOA     ns.intranet.m1-5.ephec-ti.be. root.m1-5.ephec-ti.be. (
                        1           ; Serial
                        604800      ; Refresh
                        86400       ; Retry
                        2419200     ; Expire
                        604800 )    ; Negative Cache TTL
;
; name servers => RR de type NS
@           IN      NS      ns.intranet.m1-5.ephec-ti.be.

; name servers => RR de type A
ns          IN      A       172.16.0.3

; services web
erp         IN      A       172.16.0.4
mysql       IN      A       172.16.0.5

#resolv    IN      A       172.16.0.2

named.conf

options {
        directory "/var/bind";

        listen-on { any; };
        listen-on-v6 { none; };

        allow-query {
                172.16.0.0/24;
                192.168.0.0/24;
                192.168.1.0/24;
                192.168.2.0/24;
        };

        allow-transfer {
                none;
        };

        pid-file "/var/run/named/named.pid";


        allow-recursion { none; };
        recursion no;
};

zone "intranet.m1-5.ephec-ti.be" {
    type master;
    file "/etc/bind/intranet.m1-5.ephec-ti.be";
};

zone "0.16.172.in-addr.arpa" IN {
    type master;
    file "/etc/bind/reverse";
};

reverse

$ORIGIN 0.16.172.in-addr.arpa.
$TTL 604800
@       IN      SOA     ns.intranet.m1-5.ephec-ti.be. root.m1-5.ephec-ti.be. (
                        1           ; Serial
                        604800      ; Refresh
                        86400       ; Retry
                        2419200     ; Expire
                        604800 )    ; Negative Cache TTL
;
; name servers => RR de type NS
@               IN      NS      ns.intranet.m1-5.ephec-ti.be.

#2              PTR             resolv.intranet.ephec-ti.be.

; name servers => RR de type PTR
3               IN      PTR     ns.intranet.m1-5.ephec-ti.be.

; services web
4               IN      PTR     erp.intranet.m1-5.ephec-ti.be.
5               IN      PTR     mysql.intranet.m1-5.ephec-ti.be.

Partie RESOLVER

Dans ce dossier, il faut créer les dossiers ci-dessous avec la commande nano.
Dockerfile

FROM ubuntu:latest

RUN apt-get update && apt-get install -y bind9
RUN apt-get install -y dnsutils net-tools iputils-ping

COPY named.conf /etc/bind/named.conf

CMD ["named", "-c", "/etc/bind/named.conf", "-g"]

named.conf

options {
        directory "/var/bind";

        allow-recursion {
                172.16.0.0/24;
                192.168.0.0/24;
                192.168.1.0/24;
                192.168.2.0/24;
        };

        listen-on port 53 { any; };
        listen-on-v6 { none; };

        pid-file "/var/run/named/named.pid";

        allow-transfer { none; };
};

zone "localhost" IN {
        type master;
        file "pri/localhost.zone";
        allow-update { none; };
        notify no;
};

zone "127.in-addr.arpa" IN {
        type master;
        file "pri/127.zone";
        allow-update { none; };
        notify no;
};

zone "intranet.m1-5.ephec-ti.be" {
    type forward;
    forwarders { 172.16.0.3; };
    forward only;
};

zone "0.16.172.in-addr.arpa" IN {
    type forward;
    forwarders { 172.16.0.3; };
    forward only;
};

Partie user

Créer les différents groupes d'utilisateurs : mkdir atelier, mkdir commerciaux, mkdir compta, mkdir direction, mkdir secretariat.
Dans chacun de ces dossiers, créer un dockerfile : nano Dockerfile.
Dockerfile

FROM ubuntu:latest

RUN apt-get update -y && apt-get upgrade -y
RUN apt-get install -y dnsutils
RUN apt-get install -y iputils-ping
RUN apt-get install -y net-tools
RUN apt-get install -y nano

Partie cloud

Créer un dossier pour les données de Nextcloud et un dossier pour les données de la DB liée à Nexcloud : mkdir data, mkdir datadb. Et créée le docker-compose pour les créer : nano docker-compose.yml.
docker-compose.yml

version: '2'

services:
  db:
    image: mysql
    restart: always
    container_name: cloudDB
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
    volumes:
      - ./datadb:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=xx
      - MYSQL_PASSWORD=xx
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud

  app:
    image: nextcloud
    container_name: cloud
    restart: always
    ports:
      - 8080:80
    links:
      - db
    volumes:
      - ./data:/var/www/html
    environment:
      - MYSQL_PASSWORD=voir discord
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - MYSQL_HOST=db

Partie docker compose

docker-compose.yml

version: '2'

services:

  resolver:
    build:
      context: ./RESOLVER
      dockerfile: Dockerfile
    ports:
      - "54:54/tcp"
      - "54:54/udp"
    networks:
      local:
          ipv4_address: 172.16.0.2
    volumes:
      - ./RESOLVER/named.conf:/etc/bind/named.conf
    container_name: RESOLVER

  soa-in:
    build:
      context: ./SOA-in
      dockerfile: Dockerfile
    networks:
      local:
          ipv4_address: 172.16.0.3
    volumes:
      - ./SOA-in/named.conf:/etc/bind/named.conf
      - ./SOA-in/intranet.m1-5.ephec-ti.be:/etc/bind/intranet.m1-5.ephec-ti.be
      - ./SOA-in/reverse:/etc/bind/reverse
    container_name: SOA-in
    dns:
      - 172.16.0.2

  direction:
    build:
      context: ./user/direction
      dockerfile: Dockerfile
    networks:
      direction_network:
        ipv4_address: 192.168.0.2
    container_name: direction_container

  atelier:
    build:
      context: ./user/atelier
      dockerfile: Dockerfile
    networks:
      atelier_network:
        ipv4_address: 192.168.2.2
    container_name: atelier_container

  administratif:
    build:
      context: ./user/administratif
      dockerfile: Dockerfile
    networks:
      administratif_network:
        ipv4_address: 192.168.1.2
    container_name: administratif_container


networks:
  local:
      ipam:
          driver: default
          config:
              - subnet: 172.16.0.0/24
                gateway: 172.16.0.1

  direction_network:
    ipam:
      driver: default
      config:
        - subnet: 192.168.0.0/24
          gateway: 192.168.0.1

  atelier_network:
    ipam:
      driver: default
      config:
        - subnet: 192.168.2.0/24
          gateway: 192.168.2.1

  administratif_network:
    ipam:
      driver: default
      config:
        - subnet: 192.168.1.0/24
          gateway: 192.168.1.1

Clone this wiki locally