Thank you for reading this post, don't forget to subscribe!
задача быстро поднять pritunl и выдать доступы.
на сервере уже должен стоять докер и docker-compose
ставим docker:
yum remove docker docker-engine docker.io
yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum install docker-ce -y
systemctl start docker
systemctl enable docker
ставим docker-compose
https://github.com/docker/compose/releases
на текущий момент самая последняя версия:
2,6,1
https://github.com/docker/compose/releases/download/v2.6.1/docker-compose-linux-x86_64
выкачиваем её:
curl -L "https://github.com/docker/compose/releases/download/v2.6.1/docker-compose-linux-x86_64" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
всё готово.
далее качаем репозиторий:
git clone https://github.com/midnight47/docker-compose.git
переходим в директорию:
cd docker-compose/pritunl/
запускаем:
docker-compose up -d
и на этом всё сидим ждём когда соберётся образ, после чего по ip можем заходить на вэб панель
чтоб получить login password надо зайти в контейнер и выполнить команду для получения доступов:
1 2 3 4 |
docker exec -ti pritunl_pritunl_1 bash root@f8c91b8c82a9:/# pritunl default-password |
получим такой вывод:
1 2 3 4 5 |
[undefined][2022-07-17 14:39:37,596][INFO] Getting default administrator password Administrator default password: username: "pritunl" password: "RNQg3alBwWEM" |
cat Dockerfile
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
FROM ubuntu:18.04 ARG PRITUNL_VERSION="1.30.3226.71" ENV PRITUNL_VERSION=${PRITUNL_VERSION} ARG MONGODB_VERSION="*" ENV MONGODB_VERSION=${MONGODB_VERSION} COPY --chown=root:root ["docker-install.sh", "/root"] RUN bash /root/docker-install.sh ADD start-pritunl /bin/start-pritunl EXPOSE 80 EXPOSE 443 EXPOSE 1194 EXPOSE 1194/udp ENTRYPOINT ["/bin/start-pritunl"] CMD ["/usr/bin/tail", "-f","/var/log/pritunl.log"] |
cat docker-install.sh
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
set -ex apt-get update -q apt-get install -y gnupg wget if [ "${MONGODB_VERSION}" != "no" ]; then wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | apt-key add - echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.4 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-4.4.list fi echo 'deb http://repo.pritunl.com/stable/apt bionic main' > /etc/apt/sources.list.d/pritunl.list echo "deb http://build.openvpn.net/debian/openvpn/stable bionic main" > /etc/apt/sources.list.d/openvpn-aptrepo.list apt-key adv --keyserver hkp://keyserver.ubuntu.com --recv 7568D9BB55FF9E5287D586017AE645C0CF8E292A apt-key adv --keyserver hkp://keyserver.ubuntu.com --recv 8E6DA8B4E158C569 apt-get update -q apt-get install -y locales iptables wget locale-gen en_US en_US.UTF-8 dpkg-reconfigure locales ln -sf /usr/share/zoneinfo/UTC /etc/localtime apt-get upgrade -y -q apt-get dist-upgrade -y -q wget --quiet https://github.com/pritunl/pritunl/releases/download/${PRITUNL_VERSION}/pritunl_${PRITUNL_VERSION}-0ubuntu1.bionic_amd64.deb dpkg -i pritunl_${PRITUNL_VERSION}-0ubuntu1.bionic_amd64.deb || apt-get -f -y install rm pritunl_${PRITUNL_VERSION}-0ubuntu1.bionic_amd64.deb if [ "${MONGODB_VERSION}" != "no" ]; then apt-get -y install mongodb-org=${MONGODB_VERSION}; fi apt-get --purge autoremove -y wget apt-get clean apt-get -y -q autoclean apt-get -y -q autoremove rm -rf /tmp/* |
cat start-pritunl
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
#!/bin/sh set -e [ -d /dev/net ] || mkdir -p /dev/net [ -c /dev/net/tun ] || mknod /dev/net/tun c 10 200 touch /var/log/pritunl.log touch /var/run/pritunl.pid /bin/rm /var/run/pritunl.pid if [ "$1" = "bash" ]; then exec "$@" exit $? fi # allow changing debug mode if [ -z "$PRITUNL_DEBUG" ]; then PRITUNL_DEBUG="false" fi # allow changing bind addr if [ -z "$PRITUNL_BIND_ADDR" ]; then PRITUNL_BIND_ADDR="0.0.0.0" fi ## start a local mongodb instance if no mongodb specified through env if [ -z "$PRITUNL_MONGODB_URI" ]; then /usr/bin/mongod -f /etc/mongod.conf & PRITUNL_MONGODB_URI="mongodb://localhost:27017/pritunl" fi if [ -z "$PRITUNL_DONT_WRITE_CONFIG" ]; then cat << EOF > /etc/pritunl.conf { "mongodb_uri": "$PRITUNL_MONGODB_URI", "server_key_path": "/var/lib/pritunl/pritunl.key", "log_path": "/var/log/pritunl.log", "static_cache": true, "server_cert_path": "/var/lib/pritunl/pritunl.crt", "temp_path": "/tmp/pritunl_%r", "bind_addr": "$PRITUNL_BIND_ADDR", "debug": $PRITUNL_DEBUG, "www_path": "/usr/share/pritunl/www", "local_address_interface": "auto" } EOF fi exec /usr/bin/pritunl start -c /etc/pritunl.conf |
cat docker-compose.yml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
version: '3' services: pritunl: build: dockerfile: ./Dockerfile context: . image: 'pritunll:latest' privileged: true ports: - '80:80' - '443:443' - '1194:1194/udp' - '1194:1194/tcp' volumes: - 'pritunl_data:/var/lib/pritunl' - 'pritunl_db:/var/lib/mongodb' volumes: pritunl_data: driver: local pritunl_db: driver: local |
==============================================================================
вот ещё композник вполне рабочий:
cat docker-compose.yml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
version: '3' services: mongo: image: mongo:latest container_name: pritunldb hostname: pritunldb network_mode: bridge volumes: - ./db:/data/db pritunl: image: goofball222/pritunl:latest container_name: pritunl hostname: pritunl depends_on: - mongo network_mode: bridge privileged: true sysctls: - net.ipv6.conf.all.disable_ipv6=0 links: - mongo volumes: - /etc/localtime:/etc/localtime:ro ports: - 80:80 - 443:443 - 1194:1194 - 1194:1194/udp - 1195:1195/udp environment: - TZ=UTC |