-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.sh
145 lines (108 loc) · 4.58 KB
/
test.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#!/bin/sh
PHPVER=$(grep ^\\[.*\$phpvetc site.pp |cut -f 6 -d\")
#IP=$(ifconfig|grep inet.*broadcast|head -1|awk '{print $2}')
# 14 quick and dirty tests
check() {
[ "$?" -eq "0" ] || err_flag=$i
echo
if ( [ $err_flag ] ); then
echo ERROR at step $i - $1
exit 1
fi
}
echo -----------------------------=== $((i=i+1)) check postgresql ===-----------------------------
/usr/local/bin/pg_isready
check
echo -----------------------------=== $((i=i+1)) open port 5432 on localhost ===-----------------------------
netstat -aln|grep LIST |grep 127.0.0.1.5432
check
echo -----------------------------=== $((i=i+1)) open port 443 ===-----------------------------
netstat -aln|grep LIST |grep \*.443
check
echo -----------------------------=== $((i=i+1)) check pkg.conf ===-----------------------------
grep ^installpath.*/pub/OpenBSD/$(uname -r)/packages/$(uname -m) /etc/pkg.conf
check
# todo disable ipv6
echo -----------------------------=== $((i=i+1)) cron entry for www user ===-----------------------------
crontab -u www -l|grep owncloud
check
echo -----------------------------=== $((i=i+1)) cron.php file exists ===-----------------------------
ls -l /var/www/owncloud/cron.php
check
echo -----------------------------=== $((i=i+1)) cron process ===-----------------------------
ps auxw|grep "^root.*/usr/sbin/cron"
check
echo -----------------------------=== $((i=i+1)) httpd config crt entry ===-----------------------------
grep ^certificate\ \"/etc/ssl/$(facter fqdn).crt\" /etc/httpd.conf
check
echo -----------------------------=== $((i=i+1)) httpd config key entry ===-----------------------------
grep ^key\ \"/etc/ssl/private/$(facter fqdn).key\" /etc/httpd.conf
check
echo -----------------------------=== $((i=i+1)) httpd config server entry ===-----------------------------
grep ^server\ \""$(facter fqdn)"\" /etc/httpd.conf
check
echo -----------------------------=== $((i=i+1)) httpd config listen entry ===-----------------------------
listen=$(grep \$listen site.pp|cut -f2 -d\")
check
grep ^ext_if=\""${listen}"\" /etc/httpd.conf
check
echo -----------------------------=== $((i=i+1)) httpd worker process ===-----------------------------
ps auxw|grep ^www.*httpd:\ server
check
echo -----------------------------=== $((i=i+1)) http logger process ===-----------------------------
ps auxw|grep ^www.*httpd:\ logger
check
echo -----------------------------=== $((i=i+1)) http master process ===-----------------------------
ps auxw|grep ^root.*/usr/sbin/httpd
check
echo -----------------------------=== $((i=i+1)) php fpm proc ===-----------------------------
ps aux|grep php-fpm-"$PHPVER"
check
echo
# todo grep for versions
echo -----------------------------=== $((i=i+1)) packages ===-----------------------------
pkg_info |grep -E '(httpd|php|postgres|owncloud)'
check
echo -----------------------------=== $((i=i+1)) is php a "$PHPVER" symlink ===--------------------------------
f=php ; which $f && ls -l `which $f`|grep "$PHPVER"
check
test -L $(which php)
check
# chroot ?
echo -----------------------------=== $((i=i+1)) chroot - mount point /var without nodev ===-----------------------------
mount |grep "/var"|grep -vw nodev
check
# database todo
# log to db and check owncloud db
echo -----------------------------=== $((i=i+1)) ssl cert ===-----------------------------
file /etc/ssl/*.crt|grep PEM
check
echo -----------------------------=== $((i=i+1)) ssl key ===-----------------------------
head -1 /etc/ssl/private/*key|grep PRIVATE
check
echo -----------------------------=== $((i=i+1)) chroot files ===-----------------------------
file /var/www/usr/share/locale/UTF-8/LC_CTYPE |grep Citrus
check
echo -----------------------------=== $((i=i+1)) chroot test special random files ===-----------------------------
f=/var/www/dev/random
echo -n $f' ' ; test -c $f ; check $f
f=/var/www/dev/urandom
echo -n $f' ' ; test -c $f ; check $f
echo -----------------------------=== $((i=i+1)) system users ===-----------------------------
pguser=$(grep ^\$pguser site.pp |cut -f2 -d\")
check
id $pguser
check
echo -----------------------------=== $((i=i+1)) x11 dir ===-----------------------------
ls -ld /usr/X11R6/bin/
check
echo -----------------------------=== $((i=i+1)) symlinks php ===-----------------------------
for f in bz2 curl gd intl mcrypt pdo_pgsql pgsql zip ; do echo -n $f" "; test -L /etc/php-"$PHPVER"/"$f".ini ; check ; done
check
echo -----------------------------=== $((i=i+1)) website status ===-----------------------------
curl -svk https://localhost/owncloud/status.php 2>x; grep -qE '(installed|owncloud)' x
check
rm x
echo; echo
echo SUCCESS: ALL "$i" TESTS PASSED
echo END