Skip to content

Commit c612ac6

Browse files
author
vsilent
committed
initial commit
1 parent a488758 commit c612ac6

File tree

1,837 files changed

+315133
-43
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,837 files changed

+315133
-43
lines changed

.travis.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
language: python
2+
python:
3+
- 2.7
4+
5+
env:
6+
- DOCKER_CONTENT_TRUST=0
7+
8+
services:
9+
- docker
10+
11+
before_install:
12+
# update is required to update the repositories to see the new packages for
13+
# Docker.
14+
- sudo apt-get update
15+
- docker-compose --version
16+
- pip install docker-compose --upgrade
17+
- docker-compose --version
18+
19+
install:
20+
- cd 1.12/build
21+
- docker-compose up -d --build
22+
- docker-compose ps
23+
24+
before_script:
25+
- pip install requests
26+
- pip install docker
27+
- cd $TRAVIS_BUILD_DIR
28+
29+
script:
30+
- bash ./.travis/linters.sh
31+
- python tests.py
32+
33+
34+
notifications:
35+
slack:
36+
rooms:
37+
- optimum-team:GycletOWK4Kt95GktwYwfUMp#build
38+
39+
after_success:
40+
- cd build
41+
- echo "$DOCKER_PASS" | docker login -u "$DOCKER_USER" --password-stdin
42+
- docker-compose -f images
43+
- docker push trydirect/osticket:1.12

.travis/docker-linter.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
set -eu
3+
4+
echo "Run docker linter: $1"
5+
docker run --rm -i hadolint/hadolint:v1.3.0 hadolint --ignore DL3006 - < "$1"
6+
echo "-end-"

.travis/docker-security.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env bash
2+
set -eu
3+
4+
echo "Run docker bench security"
5+
docker run \
6+
-it \
7+
--net host \
8+
--pid host \
9+
--userns host \
10+
--cap-add audit_control \
11+
-e DOCKER_CONTENT_TRUST=$DOCKER_CONTENT_TRUST \
12+
-v /var/lib:/var/lib \
13+
-v /var/run/docker.sock:/var/run/docker.sock \
14+
-v /usr/lib/systemd:/usr/lib/systemd \
15+
-v /etc:/etc --label docker_bench_security \
16+
docker/docker-bench-security
17+
echo "-end-"

.travis/linters.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env bash
2+
3+
docker pull hadolint/hadolint:v1.3.0
4+
5+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
6+
7+
find ./ -name Dockerfile -print0 | xargs -0 -L1 $DIR/docker-linter.sh
8+
9+
docker pull docker/docker-bench-security
10+
$DIR/docker-security.sh

1.12/.env

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1+
# COMMON
12
REGISTRY=
23
DOMAIN=localdomain
4+
ADMIN_EMAIL=admin@localhost
5+
SECRET_SALT=somethingverysecret
6+
DEBUG=True
7+
8+
# SMTP
9+
BIND_ADDRESS=127.0.0.1
10+
ROOT=.
311

4-
# SMTP docker image
5-
SMTP_IMAGE={{SMTP_IMAGE}}
612
EMAIl_ADMIN=admin@localhost
713
EMAIL_USE_TLS=False
814
EMAIL_HOST=smtp.gmail.com
@@ -11,8 +17,9 @@ [email protected]
1117
EMAIL_HOST_PASSWORD=pass
1218
DEFAULT_FROM_EMAIL=[email protected]
1319

20+
# MySQL
21+
MYSQL_HOST=db
1422
MYSQL_DATABASE=osticket
15-
MYSQ_USER=osticket
23+
MYSQ_USER=root
24+
MYSQ_PASSWORD=osticketroot
1625
MYSQL_ROOT_PASSWORD=osticketroot
17-
18-
DEBUG=True

1.12/build/Dockerfile

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,30 @@
11
FROM ubuntu:18.04
2-
32
LABEL maintainer="[email protected]"
3+
4+
# Let the container know that there is no tty
5+
ENV DEBIAN_FRONTEND noninteractive
6+
47
ENV APP_VERSION 1.12
58

6-
RUN apt-get update -y -qq ; apt-get install --no-install-recommends -y -qq supervisor software-properties-common; \
9+
RUN apt-get update -y -qq ; apt-get install --no-install-recommends -y -qq supervisor curl software-properties-common; \
710
LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php -y; apt-get update -y -qq; \
8-
apt-get install -y -qq cron curl net-tools \
9-
php7.2 php7.2-fpm php7.2-mysql php7.2-cli php7.2-cgi php7.2-gd php7.2-zip php7.2-xml php7.2-curl \
11+
apt-get install --no-install-recommends -y -qq cron net-tools sudo lsof \
12+
php7.2 php7.2-fpm php7.2-mysql php7.2-cli php7.2-cgi \
13+
php7.2-gd php7.2-zip php7.2-xml php7.2-curl php7.2-imap \
14+
php7.2-mbstring php7.2-intl php7.2-apcu \
1015
&& apt-get clean; apt-get autoclean; apt-get autoremove -y -qq && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
1116

1217
RUN groupadd -r -g 2000 osticket; useradd -r -u 2000 -g 2000 -m -c "app account" -d /home/osticket -s /bin/bash osticket
1318
RUN curl -L -o /usr/src/app.tar.gz https://github.com/osTicket/osTicket/archive/v${APP_VERSION}.tar.gz
1419
WORKDIR /home/osticket
20+
RUN mkdir -p /var/run/php && chown -R osticket:osticket /var/run/php
1521
RUN tar -xf /usr/src/app.tar.gz && mv osTicket-${APP_VERSION} app
1622
RUN chown -R osticket:osticket app
23+
ADD ./configs/php/fpm/php-fpm.conf /etc/php/7.2/fpm/php-fpm.conf
1724
ADD ./configs/php/fpm/php.ini /etc/php/7.2/fpm/php.ini
1825
ADD ./configs/php/fpm/www.conf /etc/php/7.2/fpm/pool.d/www.conf
1926
ADD ./configs/supervisord/osticket.conf /etc/supervisor/conf.d/osticket.conf
20-
RUN mkdir /run/php && chown -R osticket:osticket /run/php
2127

28+
WORKDIR /home/osticket/app
2229
EXPOSE 9000
2330
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/osticket.conf"]
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
;;;;;;;;;;;;;;;;;;;;;
2+
; FPM Configuration ;
3+
;;;;;;;;;;;;;;;;;;;;;
4+
5+
; All relative paths in this configuration file are relative to PHP's install
6+
; prefix (/usr). This prefix can be dynamically changed by using the
7+
; '-p' argument from the command line.
8+
9+
;;;;;;;;;;;;;;;;;;
10+
; Global Options ;
11+
;;;;;;;;;;;;;;;;;;
12+
13+
[global]
14+
; Pid file
15+
; Note: the default prefix is /var
16+
; Default Value: none
17+
18+
pid = /run/php/php7.2-fpm.pid
19+
20+
; Error log file
21+
; If it's set to "syslog", log is sent to syslogd instead of being written
22+
; into a local file.
23+
; Note: the default prefix is /var
24+
; Default Value: log/php-fpm.log
25+
;error_log = /var/log/php7.2-fpm.log
26+
27+
;error_log = /proc/self/fd/2;
28+
;error_log = /dev/stdout;
29+
error_log = "syslog";
30+
31+
; syslog_facility is used to specify what type of program is logging the
32+
; message. This lets syslogd specify that messages from different facilities
33+
; will be handled differently.
34+
; See syslog(3) for possible values (ex daemon equiv LOG_DAEMON)
35+
; Default Value: daemon
36+
;syslog.facility = daemon
37+
38+
; syslog_ident is prepended to every message. If you have multiple FPM
39+
; instances running on the same server, you can change the default value
40+
; which must suit common needs.
41+
; Default Value: php-fpm
42+
;syslog.ident = php-fpm
43+
44+
; Log level
45+
; Possible Values: alert, error, warning, notice, debug
46+
; Default Value: notice
47+
48+
;log_level = error
49+
50+
; If this number of child processes exit with SIGSEGV or SIGBUS within the time
51+
; interval set by emergency_restart_interval then FPM will restart. A value
52+
; of '0' means 'Off'.
53+
; Default Value: 0
54+
;emergency_restart_threshold = 0
55+
56+
; Interval of time used by emergency_restart_interval to determine when
57+
; a graceful restart will be initiated. This can be useful to work around
58+
; accidental corruptions in an accelerator's shared memory.
59+
; Available Units: s(econds), m(inutes), h(ours), or d(ays)
60+
; Default Unit: seconds
61+
; Default Value: 0
62+
;emergency_restart_interval = 0
63+
64+
; Time limit for child processes to wait for a reaction on signals from master.
65+
; Available units: s(econds), m(inutes), h(ours), or d(ays)
66+
; Default Unit: seconds
67+
; Default Value: 0
68+
;process_control_timeout = 0
69+
70+
; The maximum number of processes FPM will fork. This has been designed to control
71+
; the global number of processes when using dynamic PM within a lot of pools.
72+
; Use it with caution.
73+
; Note: A value of 0 indicates no limit
74+
; Default Value: 0
75+
; process.max = 128
76+
77+
; Specify the nice(2) priority to apply to the master process (only if set)
78+
; The value can vary from -19 (highest priority) to 20 (lowest priority)
79+
; Note: - It will only work if the FPM master process is launched as root
80+
; - The pool process will inherit the master process priority
81+
; unless specified otherwise
82+
; Default Value: no set
83+
; process.priority = -19
84+
85+
; Send FPM to background. Set to 'no' to keep FPM in foreground for debugging.
86+
; Default Value: yes
87+
;daemonize = yes
88+
89+
; Set open file descriptor rlimit for the master process.
90+
; Default Value: system defined value
91+
;rlimit_files = 1024
92+
93+
; Set max core size rlimit for the master process.
94+
; Possible Values: 'unlimited' or an integer greater or equal to 0
95+
; Default Value: system defined value
96+
;rlimit_core = 0
97+
98+
; Specify the event mechanism FPM will use. The following is available:
99+
; - select (any POSIX os)
100+
; - poll (any POSIX os)
101+
; - epoll (linux >= 2.5.44)
102+
; - kqueue (FreeBSD >= 4.1, OpenBSD >= 2.9, NetBSD >= 2.0)
103+
; - /dev/poll (Solaris >= 7)
104+
; - port (Solaris >= 10)
105+
; Default Value: not set (auto detection)
106+
;events.mechanism = epoll
107+
108+
; When FPM is built with systemd integration, specify the interval,
109+
; in seconds, between health report notification to systemd.
110+
; Set to 0 to disable.
111+
; Available Units: s(econds), m(inutes), h(ours)
112+
; Default Unit: seconds
113+
; Default value: 10
114+
;systemd_interval = 10
115+
116+
;;;;;;;;;;;;;;;;;;;;
117+
; Pool Definitions ;
118+
;;;;;;;;;;;;;;;;;;;;
119+
120+
; Multiple pools of child processes may be started with different listening
121+
; ports and different management options. The name of the pool will be
122+
; used in logs and stats. There is no limitation on the number of pools which
123+
; FPM can handle. Your system will tell you anyway :)
124+
125+
; Include one or more files. If glob(3) exists, it is used to include a bunch of
126+
; files from a glob(3) pattern. This directive can be used everywhere in the
127+
; file.
128+
; Relative path can also be used. They will be prefixed by:
129+
; - the global prefix if it's been set (-p argument)
130+
; - /usr otherwise
131+
include=/etc/php/7.2/fpm/pool.d/*.conf

1.12/build/configs/php/fpm/php.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ max_input_time = 60
401401

402402
; Maximum amount of memory a script may consume (128MB)
403403
; http://php.net/memory-limit
404-
memory_limit = 256M
404+
memory_limit = 512M
405405

406406
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
407407
; Error handling and logging ;
@@ -485,7 +485,7 @@ display_errors = Off
485485
; Development Value: On
486486
; Production Value: Off
487487
; http://php.net/display-startup-errors
488-
display_startup_errors = Off
488+
display_startup_errors = On
489489

490490
; Besides displaying errors, PHP can also log errors to locations such as a
491491
; server-specific log, STDERR, or a location specified by the error_log

1.12/build/configs/php/fpm/www.conf

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
; Unix user/group of processes
2121
; Note: The user is mandatory. If the group is not set, the default user's group
2222
; will be used.
23+
2324
user = osticket
2425
group = osticket
2526

@@ -33,8 +34,9 @@ group = osticket
3334
; (IPv6 and IPv4-mapped) on a specific port;
3435
; '/path/to/unix/socket' - to listen on a unix socket.
3536
; Note: This value is mandatory.
36-
;listen = /run/php/php7.1-fpm.sock
37-
listen = 127.0.0.1:9000
37+
;listen = /run/php/php7.0-fpm.sock
38+
listen = 0.0.0.0:9000
39+
3840
; Set listen(2) backlog.
3941
; Default Value: 511 (-1 on FreeBSD and OpenBSD)
4042
;listen.backlog = 511
@@ -47,6 +49,7 @@ listen = 127.0.0.1:9000
4749
;listen.owner = www-data
4850
;listen.group = www-data
4951
;listen.mode = 0660
52+
5053
; When POSIX Access Control Lists are supported you can set them using
5154
; these options, value is a comma separated list of user/group names.
5255
; When set, listen.owner and listen.group are ignored
@@ -59,7 +62,9 @@ listen = 127.0.0.1:9000
5962
; must be separated by a comma. If this value is left blank, connections will be
6063
; accepted from any ip address.
6164
; Default Value: any
62-
;listen.allowed_clients = 127.0.0.1
65+
66+
; listen.allowed_clients = 127.0.0.1
67+
; listen.allowed_clients = 0.0.0.0
6368

6469
; Specify the nice(2) priority to apply to the pool processes (only if set)
6570
; The value can vary from -19 (highest priority) to 20 (lower priority)
@@ -355,17 +360,23 @@ pm.max_spare_servers = 3
355360
; Default Value: not set
356361
;chroot =
357362

363+
;chroot = /home/osticket
364+
358365
; Chdir to this directory at the start.
359366
; Note: relative path can be used.
360367
; Default Value: current directory or / when chroot
361368
;chdir = /var/www
362369

370+
371+
;chdir = /app
372+
363373
; Redirect worker stdout and stderr into main error log. If not set, stdout and
364374
; stderr will be redirected to /dev/null according to FastCGI specs.
365375
; Note: on highloaded environement, this can cause some delay in the page
366376
; process time (several ms).
367377
; Default Value: no
368-
;catch_workers_output = yes
378+
379+
catch_workers_output = yes
369380

370381
; Clear environment in FPM workers
371382
; Prevents arbitrary environment variables from reaching FPM worker processes
@@ -374,7 +385,8 @@ pm.max_spare_servers = 3
374385
; Setting to "no" will make all environment variables available to PHP code
375386
; via getenv(), $_ENV and $_SERVER.
376387
; Default Value: yes
377-
;clear_env = no
388+
389+
clear_env = no
378390

379391
; Limits the extensions of the main script FPM will allow to parse. This can
380392
; prevent configuration mistakes on the web server side. You should only limit
@@ -414,6 +426,6 @@ pm.max_spare_servers = 3
414426
; specified at startup with the -d argument
415427
;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f [email protected]
416428
;php_flag[display_errors] = off
417-
;php_admin_value[error_log] = /var/log/fpm-php.www.log
429+
;php_admin_value[error_log] = /dev/stderr
418430
;php_admin_flag[log_errors] = on
419431
;php_admin_value[memory_limit] = 32M

1.12/build/configs/supervisord/osticket.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ logfile_maxbytes=0
66
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
77

88
[unix_http_server]
9-
file = /tmp/supervisor.sock
9+
file=/tmp/supervisor.sock
1010
chmod = 0700
1111
username = dummy
1212
password = dummy
@@ -16,7 +16,7 @@ username = dummy
1616
password = dummy
1717

1818
[program:php-fpm]
19-
command=/usr/sbin/php-fpm7.2 -F
19+
command=/usr/sbin/php-fpm7.2 -F -R -c /etc/php/7.2/fpm
2020
stopasgroup=true
2121
stopsignal=TERM
2222
autostart=true

0 commit comments

Comments
 (0)