diff --git a/docker/README.md b/docker/README.md index 0ba9a84..01b63c5 100644 --- a/docker/README.md +++ b/docker/README.md @@ -31,8 +31,9 @@ docker run -d --name py3-kms \ -e IP=0.0.0.0 \ -e PORT=1688 \ -e SQLITE=true \ - -e HWID=random \ + -e HWID=RANDOM \ -e LOGLEVEL=INFO \ + -e LOGSIZE=2 \ -e LOGFILE=/var/log/py3-kms.log \ -v /etc/localtime:/etc/localtime:ro \ -v /var/log:/var/log:rw \ @@ -94,7 +95,7 @@ ENV SQLITE false ENV HWID 364F463A8863D35F # Use this flag to specify a HWID. # The HWID must be an 16-character string of hex characters. -# The default is "364F463A8863D35F" or type "random" to auto generate the HWID. +# The default is "364F463A8863D35F" or type "RANDOM" to auto generate the HWID. # EN: log level ("CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG") # RU: Уровень логирования ("CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG") @@ -107,6 +108,11 @@ ENV LOGFILE /var/log/pykms_logserver.log # Use this flag to set an output Logfile. The default is "/var/log/pykms_logserver.log". ``` +# EN: log file size in MB +# RU: Максимальный размер Лог-файл в мегабайтах +ENV LOGSIZE "" +# Use this flag to set a maximum size (in MB) to the output log file. Desactivated by default. + # Other Important Stuff Consult the [Wiki](https://github.com/SystemRage/py-kms/wiki) for more informations about activation with _py-kms_ and to get GVLK keys. diff --git a/docker/docker-py2-kms/Dockerfile b/docker/docker-py2-kms/Dockerfile index 00a1156..d8dabfd 100644 --- a/docker/docker-py2-kms/Dockerfile +++ b/docker/docker-py2-kms/Dockerfile @@ -53,7 +53,7 @@ ENV SQLITE false ENV HWID 364F463A8863D35F # Use this flag to specify a HWID. # The HWID must be an 16-character string of hex characters. -# The default is "364F463A8863D35F" or type "random" to auto generate the HWID. +# The default is "364F463A8863D35F" or type "RANDOM" to auto generate the HWID. # EN: log level ("CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG") # RU: Уровень логирования ("CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG") @@ -65,13 +65,18 @@ ENV LOGLEVEL ERROR ENV LOGFILE /var/log/pykms_logserver.log # Use this flag to set an output Logfile. The default is "/var/log/pykms_logserver.log". +# EN: log file size in MB +# RU: Максимальный размер Лог-файл в мегабайтах +ENV LOGSIZE "" +# Use this flag to set a maximum size (in MB) to the output log file. Desactivated by default. + # EN: Startup script # RU: Скрипт автозапуска COPY start.sh /usr/bin/start.sh # EN: Software installation # RU: Установка программного обеспечения -RUN echo "http://dl-cdn.alpinelinux.org/alpine/latest-stable/main" >> /etc/apk/repositories && \ +RUN echo "http://dl-cdn.alpinelinux.org/alpine/v3.8/main" >> /etc/apk/repositories && \ apk update && \ apk upgrade && \ apk add --update \ @@ -80,17 +85,19 @@ RUN echo "http://dl-cdn.alpinelinux.org/alpine/latest-stable/main" >> /etc/a python2 \ py2-argparse \ py2-tz \ - py2-pysqlite \ py2-flask \ py2-pygments \ python2-tkinter \ + py2-pysqlite \ py2-pip && \ # EN: Clone git-repo # RU: Клонирование git-репозитория -git clone https://github.com/SystemRage/py-kms.git /home/py-kms && \ +git clone https://github.com/SystemRage/py-kms.git /tmp/py-kms && \ git clone https://github.com/coleifer/sqlite-web.git /tmp/sqlite_web && \ +mv /tmp/py-kms/py-kms /home/ && \ mv /tmp/sqlite_web/sqlite_web /home/ && \ +rm -rf /tmp/py-kms && \ rm -rf /tmp/sqlite_web && \ pip install peewee tzlocal && \ @@ -103,7 +110,7 @@ chmod a+x /usr/bin/start.sh && \ apk del git py2-pip # Set Workdir -WORKDIR /home/py-kms/py-kms +WORKDIR /home/py-kms # Expose ports EXPOSE ${PORT}/tcp diff --git a/docker/docker-py2-kms/run-py2-kms.sh b/docker/docker-py2-kms/run-py2-kms.sh index 45246c5..64cc84f 100755 --- a/docker/docker-py2-kms/run-py2-kms.sh +++ b/docker/docker-py2-kms/run-py2-kms.sh @@ -1,12 +1,16 @@ +docker stop py2-kms +docker rm py2-kms docker run -d --name py2-kms \ -p 8080:8080 \ -p 1688:1688 \ -e IP=0.0.0.0 \ -e PORT=1688 \ + -e CLIENT_COUNT=30 \ -e SQLITE=true \ - -e HWID=random \ + -e HWID=RANDOM \ -e LOGLEVEL=INFO \ -e LOGFILE=/var/log/py2-kms.log \ + -e LOGSIZE=2 \ -v /etc/localtime:/etc/localtime:ro \ -v /var/log:/var/log:rw \ --restart unless-stopped pykms/pykms:py2-kms diff --git a/docker/docker-py2-kms/start.sh b/docker/docker-py2-kms/start.sh index 6fbb757..08a85a0 100644 --- a/docker/docker-py2-kms/start.sh +++ b/docker/docker-py2-kms/start.sh @@ -1,20 +1,52 @@ #!/bin/bash # EN: Start daemons # RU: Запуск демонов -cd /home/py-kms/py-kms +cd /home/py-kms if [ "$SQLITE" == false ]; then if [ "$EPID" == "" ]; then - /usr/bin/python pykms_Server.py ${IP} ${PORT} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -w ${HWID} -V ${LOGLEVEL} -F ${LOGFILE} + if [ "$LOGSIZE" == "" ]; + then + /usr/bin/python pykms_Server.py ${IP} ${PORT} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -w ${HWID} -V ${LOGLEVEL} -F ${LOGFILE} + else + /usr/bin/python pykms_Server.py ${IP} ${PORT} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -w ${HWID} -V ${LOGLEVEL} -F ${LOGFILE} -S ${LOGSIZE} + fi else - /usr/bin/python pykms_Server.py ${IP} ${PORT} -e ${EPID} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -s ${SQLITE} -w ${HWID} -V ${LOGLEVEL} -F ${LOGFILE} + if [ "$LOGSIZE" == "" ]; + then + /usr/bin/python pykms_Server.py ${IP} ${PORT} -e ${EPID} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -w ${HWID} -V ${LOGLEVEL} -F ${LOGFILE} + else + /usr/bin/python pykms_Server.py ${IP} ${PORT} -e ${EPID} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -w ${HWID} -V ${LOGLEVEL} -F ${LOGFILE} -S ${LOGSIZE} + fi fi else if [ "$EPID" == "" ]; then - /bin/bash -c "/usr/bin/python pykms_Server.py ${IP} ${PORT} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -s -w ${HWID} -V ${LOGLEVEL} -F ${LOGFILE} &" && /usr/bin/python client.py ${IP} ${PORT} -m Windows10 && /usr/bin/python /home/sqlite_web/sqlite_web.py -H ${IP} -x ${PWD}/clients.db + if [ "$LOGSIZE" == "" ]; + then + /bin/bash -c "/usr/bin/python pykms_Server.py ${IP} ${PORT} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -s -w ${HWID} -V ${LOGLEVEL} -F ${LOGFILE} &" + sleep 5 + /usr/bin/python pykms_Client.py ${IP} ${PORT} -m Windows10 & + /usr/bin/python /home/sqlite_web/sqlite_web.py -H ${IP} -x ${PWD}/clients.db + else + /bin/bash -c "/usr/bin/python pykms_Server.py ${IP} ${PORT} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -s -w ${HWID} -V ${LOGLEVEL} -F ${LOGFILE} -S ${LOGSIZE} &" + sleep 5 + /usr/bin/python pykms_Client.py ${IP} ${PORT} -m Windows10 & + /usr/bin/python /home/sqlite_web/sqlite_web.py -H ${IP} -x ${PWD}/clients.db + fi else - /bin/bash -c "/usr/bin/python pykms_Server.py ${IP} ${PORT} -e ${EPID} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -s -w ${HWID} -V ${LOGLEVEL} -F ${LOGFILE} &" && /usr/bin/python client.py ${IP} ${PORT} -m Windows10 && /usr/bin/python /home/sqlite_web/sqlite_web.py -H ${IP} -x ${PWD}/clients.db + if [ "$LOGSIZE" == "" ]; + then + /bin/bash -c "/usr/bin/python pykms_Server.py ${IP} ${PORT} -e ${EPID} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -s -w ${HWID} -V ${LOGLEVEL} -F ${LOGFILE} &" + sleep5 + /usr/bin/python pykms_Client.py ${IP} ${PORT} -m Windows10 & + /usr/bin/python /home/sqlite_web/sqlite_web.py -H ${IP} -x ${PWD}/clients.db + else + /bin/sh -c "/usr/bin/python pykms_Server.py ${IP} ${PORT} -e ${EPID} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -s -w ${HWID} -V ${LOGLEVEL} -F ${LOGFILE} -S ${LOGSIZE} &" + sleep 5 + /usr/bin/python pykms_Client.py ${IP} ${PORT} -m Windows10 & + /usr/bin/python /home/sqlite_web/sqlite_web.py -H ${IP} -x ${PWD}/clients.db + fi fi fi diff --git a/docker/docker-py3-kms/Dockerfile b/docker/docker-py3-kms/Dockerfile index 112ca30..607460e 100644 --- a/docker/docker-py3-kms/Dockerfile +++ b/docker/docker-py3-kms/Dockerfile @@ -50,10 +50,10 @@ ENV SQLITE false # EN: hwid # RU: hwid -ENV HWID 364F463A8863D35F -# Use this flag to specify a HWID. +ENV HWID "364F463A8863D35F" +# Use this flag to specify a HWID. # The HWID must be an 16-character string of hex characters. -# The default is "364F463A8863D35F" or type "random" to auto generate the HWID. +# The default is "364F463A8863D35F" or type "RANDOM" to auto generate the HWID. # EN: log level ("CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG") # RU: Уровень логирования ("CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG") @@ -65,21 +65,25 @@ ENV LOGLEVEL ERROR ENV LOGFILE /var/log/pykms_logserver.log # Use this flag to set an output Logfile. The default is "/var/log/pykms_logserver.log". +# EN: log file size in MB +# RU: Максимальный размер Лог-файл в мегабайтах +ENV LOGSIZE "" +# Use this flag to set a maximum size (in MB) to the output log file. Desactivated by default. + # EN: Startup script # RU: Скрипт автозапуска COPY start.sh /usr/bin/start.sh # EN: Software installation # RU: Установка программного обеспечения -RUN echo "http://dl-cdn.alpinelinux.org/alpine/latest-stable/main" >> /etc/apk/repositories && \ +RUN echo "http://dl-cdn.alpinelinux.org/alpine/v3.8/main" >> /etc/apk/repositories && \ apk update && \ apk upgrade && \ apk add --update \ bash \ git \ - python3 \ py3-argparse \ - py3-tz \ +# py3-tz \ py3-flask \ py3-pygments \ python3-tkinter \ @@ -88,11 +92,13 @@ RUN echo "http://dl-cdn.alpinelinux.org/alpine/latest-stable/main" >> /etc/a # EN: Clone git-repo # RU: Клонирование git-репозитория -git clone https://github.com/SystemRage/py-kms.git /home/py-kms && \ +git clone https://github.com/SystemRage/py-kms.git /tmp/py-kms && \ git clone https://github.com/coleifer/sqlite-web.git /tmp/sqlite_web && \ +mv /tmp/py-kms/py-kms /home/ && \ mv /tmp/sqlite_web/sqlite_web /home/ && \ +rm -rf /tmp/py-kms && \ rm -rf /tmp/sqlite_web && \ -pip3 install peewee tzlocal && \ +pip3 install peewee tzlocal pysqlite3 && \ # EN: Change permissions # RU: Меняем права доступа @@ -100,13 +106,13 @@ chmod a+x /usr/bin/start.sh && \ # EN: Clear after install software # RU: Очистка после установки программного обеспечения -apk del git py3-pip +apk del git # Set Workdir -WORKDIR /home/py-kms/py-kms +WORKDIR /home/py-kms # Expose ports EXPOSE ${PORT}/tcp # Entry point -ENTRYPOINT ["/usr/bin/start.sh"] +ENTRYPOINT ["/usr/bin/start.sh"] \ No newline at end of file diff --git a/docker/docker-py3-kms/run-py3-kms.sh b/docker/docker-py3-kms/run-py3-kms.sh index 24d103b..849cff0 100755 --- a/docker/docker-py3-kms/run-py3-kms.sh +++ b/docker/docker-py3-kms/run-py3-kms.sh @@ -1,12 +1,16 @@ +docker stop py3-kms +docker rm py3-kms docker run -d --name py3-kms \ -p 8080:8080 \ -p 1688:1688 \ -e IP=0.0.0.0 \ -e PORT=1688 \ -e SQLITE=true \ - -e HWID=random \ + -e HWID=RANDOM \ -e LOGLEVEL=INFO \ -e LOGFILE=/var/log/py3-kms.log \ + -e LOGSIZE=2 \ -v /etc/localtime:/etc/localtime:ro \ -v /var/log:/var/log:rw \ --restart unless-stopped pykms/pykms:py3-kms +# --restart unless-stopped ekonprof18/pykms:py3-kms diff --git a/docker/docker-py3-kms/start.sh b/docker/docker-py3-kms/start.sh index 43262a3..66fa2e0 100644 --- a/docker/docker-py3-kms/start.sh +++ b/docker/docker-py3-kms/start.sh @@ -1,20 +1,52 @@ #!/bin/bash # EN: Start daemons # RU: Запуск демонов -cd /home/py-kms/py-kms +cd /home/py-kms if [ "$SQLITE" == false ]; then if [ "$EPID" == "" ]; then - /usr/bin/python3 pykms_Server.py ${IP} ${PORT} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -w ${HWID} -V ${LOGLEVEL} -F ${LOGFILE} + if [ "$LOGSIZE" == "" ]; + then + /usr/bin/python3 pykms_Server.py ${IP} ${PORT} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -w ${HWID} -V ${LOGLEVEL} -F ${LOGFILE} + else + /usr/bin/python3 pykms_Server.py ${IP} ${PORT} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -w ${HWID} -V ${LOGLEVEL} -F ${LOGFILE} -S ${LOGSIZE} + fi else - /usr/bin/python3 pykms_Server.py ${IP} ${PORT} -e ${EPID} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -s ${SQLITE} -w ${HWID} -V ${LOGLEVEL} -F ${LOGFILE} + if [ "$LOGSIZE" == "" ]; + then + /usr/bin/python3 pykms_Server.py ${IP} ${PORT} -e ${EPID} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -w ${HWID} -V ${LOGLEVEL} -F ${LOGFILE} + else + /usr/bin/python3 pykms_Server.py ${IP} ${PORT} -e ${EPID} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -w ${HWID} -V ${LOGLEVEL} -F ${LOGFILE} -S ${LOGSIZE} + fi fi else if [ "$EPID" == "" ]; then - /bin/bash -c "/usr/bin/python3 pykms_Server.py ${IP} ${PORT} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -s -w ${HWID} -V ${LOGLEVEL} -F ${LOGFILE} &" && /usr/bin/python3 pykms_Client.py ${IP} ${PORT} -m Windows10 && /usr/bin/python3 /home/sqlite_web/sqlite_web.py -H ${IP} -x ${PWD}/clients.db --read-only + if [ "$LOGSIZE" == "" ]; + then + /bin/bash -c "/usr/bin/python3 pykms_Server.py ${IP} ${PORT} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -s -w ${HWID} -V ${LOGLEVEL} -F ${LOGFILE} &" + sleep 5 + /usr/bin/python3 pykms_Client.py ${IP} ${PORT} -m Windows10 & + /usr/bin/python3 /home/sqlite_web/sqlite_web.py -H ${IP} -x ${PWD}/clients.db --read-only + else + /bin/bash -c "/usr/bin/python3 pykms_Server.py ${IP} ${PORT} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -s -w ${HWID} -V ${LOGLEVEL} -F ${LOGFILE} -S ${LOGSIZE} &" + sleep 5 + /usr/bin/python3 pykms_Client.py ${IP} ${PORT} -m Windows10 & + /usr/bin/python3 /home/sqlite_web/sqlite_web.py -H ${IP} -x ${PWD}/clients.db --read-only + fi else - /bin/bash -c "/usr/bin/python3 pykms_Server.py ${IP} ${PORT} -e ${EPID} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -s -w ${HWID} -V ${LOGLEVEL} -F ${LOGFILE} &" && /usr/bin/python3 pykms_Client.py ${IP} ${PORT} -m Windows10 && /usr/bin/python3 /home/sqlite_web/sqlite_web.py -H ${IP} -x ${PWD}/clients.db --read-only + if [ "$LOGSIZE" == "" ]; + then + /bin/bash -c "/usr/bin/python3 pykms_Server.py ${IP} ${PORT} -e ${EPID} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -s -w ${HWID} -V ${LOGLEVEL} -F ${LOGFILE} &" + sleep5 + /usr/bin/python3 pykms_Client.py ${IP} ${PORT} -m Windows10 & + /usr/bin/python3 /home/sqlite_web/sqlite_web.py -H ${IP} -x ${PWD}/clients.db --read-only + else + /bin/sh -c "/usr/bin/python3 pykms_Server.py ${IP} ${PORT} -e ${EPID} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -s -w ${HWID} -V ${LOGLEVEL} -F ${LOGFILE} -S ${LOGSIZE} &" + sleep 5 + /usr/bin/python3 pykms_Client.py ${IP} ${PORT} -m Windows10 & + /usr/bin/python3 /home/sqlite_web/sqlite_web.py -H ${IP} -x ${PWD}/clients.db --read-only + fi fi fi