Compare commits
1162 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
051f463350 | ||
|
f626406685 | ||
|
dd971b6ee5 | ||
|
6f1ed28d0a | ||
|
044afa838c | ||
|
7ba47f504c | ||
|
0be1717ff4 | ||
|
189a4e0078 | ||
|
3adf8785d8 | ||
|
b74862bfc5 | ||
|
01273124ea | ||
|
721ada7e16 | ||
|
bd9dc91396 | ||
|
de6c43a8d3 | ||
|
f6fc6a5e56 | ||
|
ca24f7c143 | ||
|
17b0db6515 | ||
|
83b0600863 | ||
|
38961fb31b | ||
|
6c130b7960 | ||
|
7244d44a1d | ||
|
9b060aab34 | ||
|
ba5bbf3523 | ||
|
66d7ebd6c3 | ||
|
ae24f1255f | ||
|
ec7e75a6e3 | ||
|
aee106ae69 | ||
|
2a881a90ac | ||
|
ce6c465942 | ||
|
3748a0ed33 | ||
|
7a1a2dec67 | ||
|
7ed1bbad49 | ||
|
0fe5efba76 | ||
|
fb6631d317 | ||
|
cd0b8927c5 | ||
|
3fab34687c | ||
|
b2d78edae9 | ||
|
412cacac49 | ||
|
fcc3d5450d | ||
|
86c6e0e826 | ||
|
5c223b5f4e | ||
|
763b51fe22 | ||
|
66ae79f9b8 | ||
|
7da076df18 | ||
|
45fbadbb26 | ||
|
a7def771c8 | ||
|
543f1243e2 | ||
|
a001443ad7 | ||
|
36166c129a | ||
|
4e7a485e23 | ||
|
9e5795bf55 | ||
|
053b38e0bd | ||
|
2aa3a109a0 | ||
|
472708376d | ||
|
cfed3d59e9 | ||
|
95fd9d4863 | ||
|
c89bca6ec8 | ||
|
ee262c30c2 | ||
|
6b8240d4de | ||
|
26cb6a1929 | ||
|
7c63bbfe44 | ||
|
109026222e | ||
|
af8e629df4 | ||
|
f7f1daa69f | ||
|
01f980d49c | ||
|
99fab7e52a | ||
|
692292b1d4 | ||
|
cd608d9d5b | ||
|
ba67144e34 | ||
|
162d9d7d57 | ||
|
357f5a2cfd | ||
|
d1ca32b0a5 | ||
|
34f326c559 | ||
|
7785dac50e | ||
|
01f643e5eb | ||
|
8037f3e332 | ||
|
19e30b829a | ||
|
afe5176e01 | ||
|
a48317883d | ||
|
5ac92ae4eb | ||
|
8fb6ba19a1 | ||
|
314f7e7889 | ||
|
4fcf8fd23f | ||
|
10a30344e5 | ||
|
1206dda347 | ||
|
b764d17c64 | ||
|
ba0abdb88d | ||
|
1428b58dde | ||
|
e57425df5f | ||
|
5e7dfaf220 | ||
|
ad5c011b6c | ||
|
fcdd33b585 | ||
|
f767f066ad | ||
|
b8d0e5e5a1 | ||
|
26ad23f01e | ||
|
21d771e171 | ||
|
66616eb0f0 | ||
|
18eb8a2159 | ||
|
72a1fc3f64 | ||
|
96eea32a9d | ||
|
3239c7023a | ||
|
5333895a9f | ||
|
da05491992 | ||
|
b9f5d79f3d | ||
|
fddc515ee1 | ||
|
3d4516dc95 | ||
|
509c864cc3 | ||
|
8b22f435ad | ||
|
55d39595e1 | ||
|
f8944177a0 | ||
|
3060c4d887 | ||
|
13ee5dc728 | ||
|
06873fe69e | ||
|
a8ac212ee6 | ||
|
3d9d13222b | ||
|
745adabb05 | ||
|
3861b57dc6 | ||
|
99a4a80017 | ||
|
033ba26041 | ||
|
439999cb62 | ||
|
7291aa07ca | ||
|
9181e2652e | ||
|
409f76aa34 | ||
|
54e2c6181a | ||
|
a281d87315 | ||
|
2a5587f236 | ||
|
2d18b2d784 | ||
|
585f842206 | ||
|
8cb4304c13 | ||
|
737819b56e | ||
|
a7130e6530 | ||
|
f9cfed5aff | ||
|
f65a9dbfd2 | ||
|
96c59fada4 | ||
|
153a9d8ac7 | ||
|
297d4eec57 | ||
|
c31b4383e6 | ||
|
0375a3caa3 | ||
|
08cddba200 | ||
|
1bf43b0425 | ||
|
35828f9cea | ||
|
90af12fdb8 | ||
|
dc63182647 | ||
|
5fede23cf7 | ||
|
bc4762f270 | ||
|
01429d59bd | ||
|
731d15f9b5 | ||
|
f0bd7fae5c | ||
|
f8322cc2d4 | ||
|
dfdb9e393b | ||
|
bd07d7f32e | ||
|
f588c6f93c | ||
|
d9ec3d2c22 | ||
|
e2b87759d8 | ||
|
52e0aa11af | ||
|
1421c31179 | ||
|
d5587e32d0 | ||
|
28eb348707 | ||
|
91bcc18e6a | ||
|
5b43f13935 | ||
|
85b3fef08d | ||
|
cc7c48237c | ||
|
15037fa888 | ||
|
d595fef18f | ||
|
be5fa22b6f | ||
|
a5c6bbeee7 | ||
|
094a645e60 | ||
|
51acdfa633 | ||
|
2c16a75ef1 | ||
|
6fd7e0311c | ||
|
1bcf2dd0fc | ||
|
9a3cf949cf | ||
|
cec214f900 | ||
|
dad669d68b | ||
|
561f40d97e | ||
|
dad18dc5de | ||
|
5c95c4074b | ||
|
4301b9a12a | ||
|
0bbe0aed83 | ||
|
b16f797317 | ||
|
4bb71ae046 | ||
|
679b098aa7 | ||
|
e0e88fdb52 | ||
|
8bba3a257c | ||
|
8529c1287f | ||
|
9c7f7756b4 | ||
|
f1cfb16bf9 | ||
|
95796e1978 | ||
|
968b981ecb | ||
|
3aeb378b56 | ||
|
28bafe7427 | ||
|
1317b67657 | ||
|
3f462c771f | ||
|
31aa42c35e | ||
|
f7a17248b7 | ||
|
b60e6310bf | ||
|
6a89c6bf3b | ||
|
b3b7aae7d7 | ||
|
fe8c365d17 | ||
|
9acc3aac01 | ||
|
1ad23a065e | ||
|
de102fde5c | ||
|
77554fbd13 | ||
|
6863bff7c5 | ||
|
eaf6938c35 | ||
|
34ad2157dd | ||
|
0635309f23 | ||
|
2661ef53a2 | ||
|
eddca8f127 | ||
|
cef0211c00 | ||
|
86052540d9 | ||
|
930cb15e2c | ||
|
8bb9dd460b | ||
|
8a3c78ca0a | ||
|
62a5e36afd | ||
|
00b28f0aed | ||
|
7c94aa9f07 | ||
|
ec8c40b69b | ||
|
2981f3cbd1 | ||
|
c2e1819098 | ||
|
63d02df0bc | ||
|
f579fd3895 | ||
|
34df34ba27 | ||
|
2689b37c35 | ||
|
9b6427144f | ||
|
9212eea8bd | ||
|
6de5d6dd0a | ||
|
08f08fea61 | ||
|
1ed2a8637f | ||
|
d8bcbdadd6 | ||
|
d196c13f2c | ||
|
7ba251d3a6 | ||
|
0b72c639fb | ||
|
bd1c5a42e8 | ||
|
845d8c0e63 | ||
|
bcb8a52418 | ||
|
322cb2387b | ||
|
bfe56942f9 | ||
|
b4c32e47c6 | ||
|
248d8680f7 | ||
|
1bda965a7c | ||
|
2ee305769d | ||
|
3a8a936575 | ||
|
6b6fbc4709 | ||
|
3fd2ffd466 | ||
|
b56ca2b834 | ||
|
10f77df8bb | ||
|
df7671d393 | ||
|
a263936243 | ||
|
11924d425b | ||
|
0bd5a5f382 | ||
|
757eb64be3 | ||
|
6b3aea933d | ||
|
2935275227 | ||
|
cbe045b946 | ||
|
c58a95ca2e | ||
|
80a3bce6d5 | ||
|
6f0289de49 | ||
|
0966d7660e | ||
|
27e90cc4e6 | ||
|
b785213c3a | ||
|
642a73508d | ||
|
8f7b023769 | ||
|
a122fb2900 | ||
|
a299a2cc5f | ||
|
47196d86ad | ||
|
a713cf7952 | ||
|
6cd7b8ff5e | ||
|
f8264f8277 | ||
|
0e4d5e9103 | ||
|
f599bcfef9 | ||
|
74a4e62cc9 | ||
|
63a414a544 | ||
|
7d1f5091a7 | ||
|
3b54cab3bc | ||
|
52d06d906e | ||
|
d9e949b27c | ||
|
b65fe9d64f | ||
|
168397e90d | ||
|
e3c1fcd2c6 | ||
|
a2bc86fbcb | ||
|
26c6446252 | ||
|
e5e44db5ac | ||
|
d4f833c739 | ||
|
806f44abe6 | ||
|
900bdc5ee2 | ||
|
200995bf29 | ||
|
3a90c1c192 | ||
|
cc68155dfa | ||
|
b8545eb1df | ||
|
76531da340 | ||
|
12bec1df68 | ||
|
2b778695b1 | ||
|
ad61852804 | ||
|
dbd8aee4ee | ||
|
677694b01a | ||
|
85f0241c0d | ||
|
ade2185a9f | ||
|
0d27005dda | ||
|
8ee2bdec4d | ||
|
de6ce276d0 | ||
|
fbea81dcd7 | ||
|
502c349b8b | ||
|
5fb0aa70de | ||
|
7750e1344c | ||
|
8be37130e9 | ||
|
fa055481a7 | ||
|
d080e5d7a8 | ||
|
ad07655630 | ||
|
7cceb8615a | ||
|
ab9c8f4859 | ||
|
ffb8a74111 | ||
|
45587194e5 | ||
|
ccbf391913 | ||
|
ebf0db4bbf | ||
|
7765efa6c4 | ||
|
02d4b6794c | ||
|
836b717346 | ||
|
9ac265980f | ||
|
40798da6b1 | ||
|
fc596e41d4 | ||
|
1f9b0f7cef | ||
|
7bcc15e416 | ||
|
1a3bdbaabf | ||
|
5e35fdbc52 | ||
|
ab2c486f25 | ||
|
7fd7430d38 | ||
|
089b98430f | ||
|
5c7fc05a32 | ||
|
ced0d3c2c0 | ||
|
1afc5d351d | ||
|
09bbc81470 | ||
|
f7274addcd | ||
|
09bfa2ef77 | ||
|
a48518d234 | ||
|
a4a9879643 | ||
|
d1ccd7a460 | ||
|
9181a4a1d8 | ||
|
3268e1611a | ||
|
ea9ec384c6 | ||
|
bbb958b7ed | ||
|
cf724176dc | ||
|
18d1c98f08 | ||
|
d0cd39a25f | ||
|
03d4fcd17d | ||
|
02d658be65 | ||
|
1e627c7e8f | ||
|
9170488b0a | ||
|
b02730a5ad | ||
|
9af26cbaac | ||
|
73741f1518 | ||
|
9a9cb61345 | ||
|
6abd6d8879 | ||
|
c3b51b4ceb | ||
|
321ea8a3a9 | ||
|
4d6263872d | ||
|
fcdd58ac94 | ||
|
ef8292d371 | ||
|
bc6a985f7c | ||
|
7320fc11d2 | ||
|
51f6d75db4 | ||
|
a328326e39 | ||
|
4eedf8a746 | ||
|
c5f5252145 | ||
|
3f189ae7fe | ||
|
7fadd469c9 | ||
|
823e874d20 | ||
|
739aaafa9a | ||
|
62d001225a | ||
|
e50947eb58 | ||
|
ca056d32d2 | ||
|
63a455f4f7 | ||
|
a0e0465036 | ||
|
d174a9d015 | ||
|
7eb6124721 | ||
|
f458780ba7 | ||
|
8ad52806de | ||
|
dc22a50dcc | ||
|
852341c601 | ||
|
d5ed6c1901 | ||
|
e15548cbf5 | ||
|
5e28e6b9ac | ||
|
c78d43f640 | ||
|
da41383476 | ||
|
6ff79835da | ||
|
1d608b204a | ||
|
c2b8bed3a8 | ||
|
3365ef7aaa | ||
|
68c17b26dc | ||
|
e647efd471 | ||
|
15db1ffdd5 | ||
|
4632b0f797 | ||
|
65c35a5530 | ||
|
c449a1c0e0 | ||
|
b020010f0d | ||
|
0276c72fe2 | ||
|
e4aec05d0f | ||
|
2919f852ad | ||
|
a6e3b9de37 | ||
|
04a9791be2 | ||
|
6b896a1c54 | ||
|
cb8df06685 | ||
|
bfe5506cc1 | ||
|
b64066fec7 | ||
|
ffd31d8330 | ||
|
d89254fedf | ||
|
a771ddf667 | ||
|
ce2e410468 | ||
|
c1982c04ff | ||
|
9a62026830 | ||
|
d12efccd0b | ||
|
54afffed19 | ||
|
fc8fcdbece | ||
|
abd1fedc9d | ||
|
9725985037 | ||
|
754f3359ec | ||
|
4c131b8c28 | ||
|
15c674ba29 | ||
|
00aff6a906 | ||
|
c45c3a72b5 | ||
|
662d450651 | ||
|
a8897becd2 | ||
|
d0126f4454 | ||
|
fdb64a5702 | ||
|
73a80ff7dc | ||
|
a795fd698d | ||
|
2fb0dc0a4a | ||
|
5b4653cf39 | ||
|
aa8e1497a3 | ||
|
eb13d846ef | ||
|
c674a175ee | ||
|
afabf30ec6 | ||
|
420158494d | ||
|
6b7b0e0eb3 | ||
|
ad70db7e0e | ||
|
ef1ce66793 | ||
|
c364fd80b6 | ||
|
3bc5d1bae0 | ||
|
e4e34acba1 | ||
|
ff3c36a7a2 | ||
|
1e7e3259b5 | ||
|
5e53f484be | ||
|
513bc32d87 | ||
|
e7c944ff0b | ||
|
9355a8ad0e | ||
|
a74e48a138 | ||
|
ea5ee7b0f9 | ||
|
bc8cf1b2d8 | ||
|
bb28d94884 | ||
|
a4f58b0a22 | ||
|
bcf8139708 | ||
|
9b0390c9da | ||
|
e88f58c34e | ||
|
8f402f5c77 | ||
|
60054da582 | ||
|
4626b8ced5 | ||
|
ab7d193f98 | ||
|
cbf84c1840 | ||
|
420fb69166 | ||
|
c9c28cb59a | ||
|
9073f34b30 | ||
|
fb5578c0d4 | ||
|
4244f716e0 | ||
|
07a4f970d4 | ||
|
2335097c99 | ||
|
bef0a2fef0 | ||
|
c48e6c91f5 | ||
|
f082b5ba54 | ||
|
8841bdd252 | ||
|
58261098fb | ||
|
9432d3035a | ||
|
9907fc2770 | ||
|
d42caa8672 | ||
|
8117ec8e20 | ||
|
ff2783f9fc | ||
|
156a51c945 | ||
|
c72ffae4a2 | ||
|
7f3b0030ea | ||
|
9a626948f8 | ||
|
5c43df66a8 | ||
|
d0e3c546f8 | ||
|
a9cb93d801 | ||
|
ee8f29d178 | ||
|
da363070c7 | ||
|
50cf891e01 | ||
|
715838cf89 | ||
|
cd0c3f9418 | ||
|
efaee2b68b | ||
|
372c699cc6 | ||
|
8cb01cdd29 | ||
|
7a243f890e | ||
|
10982a0f45 | ||
|
d4c378ed5d | ||
|
7872f68a45 | ||
|
ec8c848106 | ||
|
3b50ce8c54 | ||
|
afabb5957b | ||
|
1eeaa01234 | ||
|
e2898217d2 | ||
|
f81dadc5d0 | ||
|
a0019d86c5 | ||
|
3c4a9bba78 | ||
|
4348653431 | ||
|
09cfa9bb20 | ||
|
e7713a9028 | ||
|
906a1753be | ||
|
a3d519b671 | ||
|
8591f9d576 | ||
|
c10ec5548f | ||
|
684ac98c8e | ||
|
db89fa9881 | ||
|
9a80421d73 | ||
|
2ddacf40c0 | ||
|
92f4824884 | ||
|
9a2ffabc33 | ||
|
2977168da1 | ||
|
85e3f37503 | ||
|
ba015c1918 | ||
|
1556adb678 | ||
|
6bfe729112 | ||
|
c340668870 | ||
|
207422f83a | ||
|
004ba28378 | ||
|
6f38801ed8 | ||
|
1509eb7d82 | ||
|
b8d2bfc890 | ||
|
8a2ee95e4a | ||
|
bc91716082 | ||
|
a00034a6a7 | ||
|
8dc0dc4d69 | ||
|
2f4b7ce3dd | ||
|
d4f83cb1d4 | ||
|
aaab3306a8 | ||
|
2bafa2f2ac | ||
|
9ac378ae09 | ||
|
bf867bd9fd | ||
|
7fd9ff43af | ||
|
bebb569c43 | ||
|
74e33bb1a0 | ||
|
b591df55b0 | ||
|
bddf31443c | ||
|
b9e0e88fe9 | ||
|
5120d9ec33 | ||
|
0a423ffd40 | ||
|
505c9e8979 | ||
|
75deb02961 | ||
|
480211033d | ||
|
c0886cb5c6 | ||
|
294df8690c | ||
|
5374f652dd | ||
|
fb72ac9904 | ||
|
b6639d9e7e | ||
|
74cb79252c | ||
|
6cd3c93472 | ||
|
eb63e75379 | ||
|
ca9321624c | ||
|
40f18df90f | ||
|
0d63cfd6c3 | ||
|
3d6b22de6c | ||
|
fc233fcdd3 | ||
|
20370d4348 | ||
|
0f90671241 | ||
|
a866c4e388 | ||
|
e7241a989c | ||
|
6e788668f9 | ||
|
b246dba7e7 | ||
|
f98de3d5db | ||
|
fab7d60373 | ||
|
b4e5358145 | ||
|
486db1e797 | ||
|
78cb43d0dc | ||
|
870454330d | ||
|
509cfd15f2 | ||
|
2061daa902 | ||
|
629ca970a1 | ||
|
c8ad6f23a8 | ||
|
d8912fd0a7 | ||
|
925c80edd4 | ||
|
2f6afd375b | ||
|
d92646324c | ||
|
c9fe62a691 | ||
|
cb52ad3ba3 | ||
|
2ec4acfe52 | ||
|
1c64f1d0cf | ||
|
48f4f44289 | ||
|
80c19cbf7d | ||
|
c97cfde9f9 | ||
|
7b26b308ad | ||
|
4c10634d85 | ||
|
3ba7d7640f | ||
|
907995a221 | ||
|
7bf0985a57 | ||
|
3ca21d8c8a | ||
|
a3a87c8883 | ||
|
de4401823e | ||
|
3ee10f5983 | ||
|
0fc8ac8d4d | ||
|
41bb53a29f | ||
|
cdee6d55d3 | ||
|
e5a1afaa26 | ||
|
f50cbe74cb | ||
|
5dbbf91917 | ||
|
7424a29960 | ||
|
eb22ca2467 | ||
|
ddbcbe5458 | ||
|
6e54cfd2ac | ||
|
fc3d4b3def | ||
|
df55b2c516 | ||
|
4d9fb57e22 | ||
|
3ed08b5c39 | ||
|
d715471426 | ||
|
486a4929da | ||
|
aacddb745b | ||
|
924f499303 | ||
|
e863a200e8 | ||
|
bb7f8ae69d | ||
|
33b6fe72da | ||
|
733919be4a | ||
|
4333e5487b | ||
|
22ead933b6 | ||
|
d53a3af191 | ||
|
08e7b7e0ad | ||
|
68cb0782c0 | ||
|
0e5a8e0033 | ||
|
4945f33254 | ||
|
3fa05293fc | ||
|
27e5f2798d | ||
|
291ca0874a | ||
|
96f2aa1803 | ||
|
c6857501aa | ||
|
3aba1607b2 | ||
|
f667298b64 | ||
|
0f4c8d4923 | ||
|
6d2c5b2312 | ||
|
a95ce11ca6 | ||
|
808503d526 | ||
|
d4b6fb9214 | ||
|
9bce5a09f3 | ||
|
bd61f38169 | ||
|
cac9c63325 | ||
|
e6d555ac31 | ||
|
fd0dd9f54c | ||
|
88c161769d | ||
|
01bf1ae92d | ||
|
9193c71cff | ||
|
db278d81e4 | ||
|
bdad454a0d | ||
|
ac8064c754 | ||
|
736e963cef | ||
|
b191cd73a7 | ||
|
86d3ca48ae | ||
|
fd7e4f2268 | ||
|
e9475a9739 | ||
|
d4270e02e9 | ||
|
b9a263ecb2 | ||
|
4929d415a6 | ||
|
b9e1f518aa | ||
|
0caa44e979 | ||
|
ca56ca5bd8 | ||
|
a0f0dff88e | ||
|
e5cc38a210 | ||
|
6cb5bb7200 | ||
|
563696e291 | ||
|
c755b3c49e | ||
|
b9f3493dbc | ||
|
8c08e9e473 | ||
|
c2930b0ca5 | ||
|
4300759287 | ||
|
fc1854cadd | ||
|
933973b12c | ||
|
5b54b9cb11 | ||
|
d2f815bba7 | ||
|
a5a067d50f | ||
|
699e299345 | ||
|
05e114173d | ||
|
d958b3ff65 | ||
|
0d7e06a141 | ||
|
633095aee1 | ||
|
a4aeb9a1dd | ||
|
71005e1db3 | ||
|
d7d6d6f991 | ||
|
5986121cfc | ||
|
c452a4569e | ||
|
a182a208dc | ||
|
d273b4b48b | ||
|
afed7d4af0 | ||
|
b429e890ad | ||
|
2f976504e8 | ||
|
b5fc88227b | ||
|
4b7b859db9 | ||
|
f7d0de53bb | ||
|
603ec997ba | ||
|
f7266ef4c8 | ||
|
3d43e1568c | ||
|
3cf6a65da9 | ||
|
c1a3f003e8 | ||
|
3f61aea7fc | ||
|
bd68db51e0 | ||
|
b8a5ed710e | ||
|
34be601dd7 | ||
|
1d64ad1ccd | ||
|
dfb4ac0365 | ||
|
f2d7a3d26d | ||
|
6d415a7384 | ||
|
0ef8832b04 | ||
|
e42a037b7d | ||
|
fe18d69b65 | ||
|
a1a9a7fa9e | ||
|
07029f93e3 | ||
|
e99ef9c093 | ||
|
fef9ab674e | ||
|
ee37c37cab | ||
|
b636c1e1f8 | ||
|
8b9f0487c0 | ||
|
a6cbd5a2fd | ||
|
ece1667fb0 | ||
|
50bd8b4a09 | ||
|
93d91353a1 | ||
|
8dc9143b34 | ||
|
a0d9a1133c | ||
|
7740e4268c | ||
|
f36e4ba336 | ||
|
3df2ef8587 | ||
|
354309fcad | ||
|
e832bfc61e | ||
|
99057ed859 | ||
|
c47c5e466f | ||
|
edd00e8e70 | ||
|
82e7de2aaa | ||
|
b723714c0c | ||
|
a2903b6e63 | ||
|
9a1876571b | ||
|
c07d7165ab | ||
|
d695c5972f | ||
|
bbc09ed313 | ||
|
1d21b0da9a | ||
|
617a147706 | ||
|
d4dccfdb2d | ||
|
035e4bf727 | ||
|
9ec5bbd560 | ||
|
34482c5ed6 | ||
|
7d414b5628 | ||
|
d9528dfd09 | ||
|
12f5f8ba00 | ||
|
db0f3307e0 | ||
|
9c83825cb8 | ||
|
7a22471787 | ||
|
7548d9a8fe | ||
|
26789f9b36 | ||
|
b4524839bb | ||
|
6605c269cf | ||
|
c30478bf4a | ||
|
d986746ef9 | ||
|
a8fa061f2e | ||
|
72015b0226 | ||
|
f8e9726922 | ||
|
884363bd05 | ||
|
bdd240ecb6 | ||
|
04da292df9 | ||
|
85b8676b8e | ||
|
114bc13c23 | ||
|
5fef5f1ed4 | ||
|
807b60b0e6 | ||
|
fbc800e556 | ||
|
1991ee7a7d | ||
|
ffbfadbccf | ||
|
c3e2bce956 | ||
|
0c9520d7e3 | ||
|
1e7e5230cc | ||
|
f1efc97357 | ||
|
fb5ac6d6d7 | ||
|
4e7ca51beb | ||
|
d561600a31 | ||
|
024e843998 | ||
|
126f275e18 | ||
|
c65e5ff8e0 | ||
|
ef13e67572 | ||
|
7920fcbb5e | ||
|
fa36fdeb03 | ||
|
c143b5ccb4 | ||
|
05c8406fca | ||
|
69e3a45083 | ||
|
45259b6ec6 | ||
|
d6fe48112c | ||
|
dcf6e6b14d | ||
|
908697a963 | ||
|
bdaf961196 | ||
|
6bd5d9b1a4 | ||
|
beb0dae5a7 | ||
|
fad2d6b1d1 | ||
|
9cd830b6aa | ||
|
d9a16b0ff4 | ||
|
cb5c94ef5e | ||
|
85fbd66871 | ||
|
3da75d6125 | ||
|
d4a3a5c180 | ||
|
65e0fcbf10 | ||
|
e22aca49c8 | ||
|
71e3a473d6 | ||
|
c2cfc09f63 | ||
|
cbfad28f7e | ||
|
6a4a468022 | ||
|
01f10b56e8 | ||
|
90ec0a610e | ||
|
42bff1ce1b | ||
|
e3c7a1f31f | ||
|
0debbffa70 | ||
|
473b58d26d | ||
|
7e9498f04c | ||
|
300001e766 | ||
|
21fc6344bf | ||
|
a38edd891f | ||
|
794fa21137 | ||
|
977d1d1998 | ||
|
cde003bc98 | ||
|
9e4e1d1cb2 | ||
|
60142cd960 | ||
|
f9570a82cc | ||
|
36285ead57 | ||
|
13e488dace | ||
|
f169da8fd0 | ||
|
60741298b7 | ||
|
f73734acb0 | ||
|
fc360abe43 | ||
|
3996e11425 | ||
|
3a4fe3e391 | ||
|
98db002770 | ||
|
7c89b6934a | ||
|
380a19274d | ||
|
f1c1caf7bd | ||
|
e2997b8135 | ||
|
4ed6e4d016 | ||
|
ac8d24a1ce | ||
|
fc776921d5 | ||
|
55a653aca4 | ||
|
0d6a6b97f9 | ||
|
469ff45f01 | ||
|
bc077acfb8 | ||
|
4269626f5d | ||
|
8fa897aadb | ||
|
f549618d12 | ||
|
2fa47aaf31 | ||
|
b0874fb23a | ||
|
fb70fd77e8 | ||
|
01f17f9cbb | ||
|
4c853defb2 | ||
|
bd0db56ba0 | ||
|
95f0b3710d | ||
|
e0ac109dd1 | ||
|
86349527e7 | ||
|
18005ceee8 | ||
|
7653b3d088 | ||
|
911053f63f | ||
|
eb52f81a5c | ||
|
4839953328 | ||
|
aba0d93fda | ||
|
0de74c0448 | ||
|
ee927346b7 | ||
|
2f8015cbca | ||
|
f3bf7c4b38 | ||
|
e37c4d57da | ||
|
acff90c000 | ||
|
5f9e72dd71 | ||
|
be0bcb8f7d | ||
|
44c3d56439 | ||
|
519d731ddd | ||
|
119c00c22a | ||
|
12596dd697 | ||
|
cb38f5f0d7 | ||
|
b49384ffe4 | ||
|
7fb622638b | ||
|
bd0cc134bf | ||
|
476fd1f695 | ||
|
96053d13be | ||
|
c958bed418 | ||
|
2b2c240d39 | ||
|
1f0ae16216 | ||
|
b79392ba2c | ||
|
8ee98f0a4a | ||
|
82e78fb651 | ||
|
d0826b2c33 | ||
|
ff588200c0 | ||
|
5d6072524c | ||
|
07a66a70fc | ||
|
69ba8a3c2f | ||
|
a30c75ef71 | ||
|
d0b3727c5d | ||
|
6e94bf5b6d | ||
|
0f04e270a7 | ||
|
ec4f5007e7 | ||
|
21b906e0e0 | ||
|
7ebaf8e843 | ||
|
640398ced4 | ||
|
ebbe1fc236 | ||
|
aac8e45397 | ||
|
5ebfa5ecf7 | ||
|
12e041c9ef | ||
|
54913f06a3 | ||
|
44a36368a2 | ||
|
8f9ff930b3 | ||
|
e199f6db87 | ||
|
c83dd3ccd7 | ||
|
78fbafa1cd | ||
|
c0012540ed | ||
|
9ab6df0e54 | ||
|
685b775b68 | ||
|
9056a5a7b6 | ||
|
e1c56bcbfe | ||
|
15d68467a1 | ||
|
3b6ecc573e | ||
|
9427b1e594 | ||
|
3ca3eaa62c | ||
|
dda448e050 | ||
|
60873144ea | ||
|
a9d17c96be | ||
|
aaee895b2b | ||
|
7d7e17b351 | ||
|
c71a976e76 | ||
|
3623183072 | ||
|
e6bd979aeb | ||
|
266c160108 | ||
|
b5b6350cc7 | ||
|
bbcf4800de | ||
|
41056ace02 | ||
|
60a80dd678 | ||
|
0efda04920 | ||
|
8819e58882 | ||
|
28eeaf201b | ||
|
74bfcea6a8 | ||
|
16f1d7fad9 | ||
|
9aa38cf0ae | ||
|
a7fa7466fb | ||
|
3f73c61cee | ||
|
a64f4cd871 | ||
|
a41eff1276 | ||
|
b88fe572fe | ||
|
59ba6f8aec | ||
|
25343da6b7 | ||
|
60d17b97f5 | ||
|
8cb72d87e4 | ||
|
8872594ab9 | ||
|
b50584119b | ||
|
975f4f2a17 | ||
|
16e4f79f09 | ||
|
76cae20c33 | ||
|
b66f23cfd0 | ||
|
27d6e5d8cf | ||
|
ff5d5b97c3 | ||
|
ce46c4dec4 | ||
|
77e8be09a1 | ||
|
013d77488a | ||
|
29ad2496b6 | ||
|
97a013b2b7 | ||
|
77808223dc | ||
|
fc89851ce9 | ||
|
c4c6555814 | ||
|
df0087fb23 | ||
|
ef3c13fe2b | ||
|
0ad704e532 | ||
|
2220d2dab8 | ||
|
49f48e2aaa | ||
|
dce24df379 | ||
|
b59136c262 | ||
|
fb9664b636 | ||
|
5b736ae05e | ||
|
ee114b3075 | ||
|
123b16991b | ||
|
5792fc0bef | ||
|
42c93917ef | ||
|
8c0f860601 | ||
|
df30a4c0d1 | ||
|
9ce13f0035 | ||
|
3884b01503 | ||
|
a84c3adeab | ||
|
a65b784907 | ||
|
05dadad2e1 | ||
|
3a9b39b842 | ||
|
e612003293 | ||
|
a43577fa26 | ||
|
7e10dcdcf0 | ||
|
7ee1110351 | ||
|
51c4c51d9e | ||
|
fc4fe54099 | ||
|
b5b240d0be | ||
|
4c42f00a86 | ||
|
090fbd04af | ||
|
461de48625 | ||
|
9352ba6e4a | ||
|
5e883239f9 | ||
|
5ea08a2120 | ||
|
a6fa60868b | ||
|
99878ae7d6 | ||
|
26202014a2 | ||
|
f4f8b96788 | ||
|
e5ede16749 | ||
|
fbe3547129 | ||
|
23f7363c70 | ||
|
97c44042e1 | ||
|
a03caea549 | ||
|
aa23fb1d56 | ||
|
4f35aac6dd | ||
|
4418ca9e9f | ||
|
570611fc09 | ||
|
94dd5b1ebe | ||
|
74524e024d | ||
|
324e00194f | ||
|
e42b6dcc8e | ||
|
d71b799e75 | ||
|
87e7121332 | ||
|
94f6354c94 | ||
|
b79059ebdb | ||
|
07b7e8a1a6 | ||
|
7ae2fc37c0 | ||
|
4f98c1bebb | ||
|
2feec01e10 | ||
|
72b95e192e | ||
|
47aad254d8 | ||
|
bc14074d2a | ||
|
5ab5b1a190 | ||
|
b055f190f5 | ||
|
84b8953352 | ||
|
93a591d487 | ||
|
e6c0f38a7c | ||
|
d169305e5d | ||
|
f107ae4f9b | ||
|
bad7a08804 | ||
|
25cbf4cb35 | ||
|
7f179f9a58 | ||
|
5287ea8537 | ||
|
43e2aaebf0 | ||
|
e60eb66283 | ||
|
ca59b808d8 | ||
|
8a15fd44d5 | ||
|
dac2b8942e | ||
|
54a1c5b63a | ||
|
61b02bf6d3 | ||
|
9d048b2fdf | ||
|
d9e28a7422 | ||
|
1fecdf42ca | ||
|
d4bf85b67c | ||
|
7131ff27c3 | ||
|
a30f78c1c8 | ||
|
7e0afffca8 | ||
|
293c60fb9c | ||
|
f5be8b2a5e | ||
|
6772603c15 | ||
|
a22904f99b | ||
|
6710d2852f | ||
|
b157bc5cd7 | ||
|
10e1a03c76 | ||
|
d20df92e9f | ||
|
44170207ac | ||
|
9354799a26 | ||
|
33745be745 | ||
|
6a28070017 | ||
|
91b948332e | ||
|
d1a7fe2d44 | ||
|
8224ef20a4 | ||
|
a4c3464bc8 | ||
|
5966d76e9a | ||
|
c39324d11f | ||
|
8c151c62ce | ||
|
50d16d8215 | ||
|
3bbac9a5f2 | ||
|
3600fd277e | ||
|
e8bb4a7e36 | ||
|
36987cb1cc | ||
|
5382b4fa37 | ||
|
28ef8068c8 | ||
|
ca0cbd68d6 | ||
|
c281b47905 | ||
|
aca5064743 | ||
|
6f780316c4 | ||
|
4e262d81f0 | ||
|
6c2ff950ee | ||
|
7684069d0b | ||
|
73c85ae68a | ||
|
911e39ba09 | ||
|
9a421d510a | ||
|
3bc7172e5e | ||
|
1a83988e26 | ||
|
0d0fc2504a | ||
|
0d4402ee0c | ||
|
722def9362 | ||
|
6a8bef83b3 | ||
|
a9c3e2c7ba | ||
|
7fcb40739d | ||
|
5a3d319677 | ||
|
8466d0b681 | ||
|
5de179f1eb | ||
|
36e10595cc | ||
|
78c8723629 | ||
|
edd7f28104 | ||
|
dba1ab3fc0 | ||
|
3df9c48012 | ||
|
6f6450bcff | ||
|
1f34203167 | ||
|
fed20648c6 | ||
|
3fc3c5cae4 | ||
|
daa5366b57 | ||
|
ac1c299369 | ||
|
5bbb3ac49a | ||
|
014bdf911a | ||
|
874853fe18 | ||
|
274b71f8bc | ||
|
c41d543d81 | ||
|
7729ddab30 | ||
|
60c0e59a83 | ||
|
ac49e639bd | ||
|
f01b20c2af | ||
|
a0d47be088 | ||
|
521374e238 | ||
|
34806ee2c2 | ||
|
4a0d5138a1 | ||
|
e6a3758899 | ||
|
fcb7d9111e | ||
|
d907731027 | ||
|
ac8d295bb9 | ||
|
a963beb96e | ||
|
737b510116 | ||
|
47cba83450 | ||
|
21d4199a38 | ||
|
655c422c3c | ||
|
b6f8bd408f | ||
|
a3edd0b976 | ||
|
8e8efa5caf | ||
|
a41b8f62a2 | ||
|
452ee8c2df | ||
|
5ca6599ca9 | ||
|
dcedf6bfd0 | ||
|
1f4b43645b | ||
|
3d5140458b | ||
|
f16574085f | ||
|
3ed62d45f5 | ||
|
b1a7b0a186 | ||
|
ec0c68621c | ||
|
a0977af081 | ||
|
a3ef9efd2f | ||
|
d58f7c6ec9 | ||
|
d124c2c12e | ||
|
0229f70761 | ||
|
dde9281139 | ||
|
6eedfb572e | ||
|
edf81a232d | ||
|
c2cb92a0b0 | ||
|
640af300cb | ||
|
6c0c6182e9 | ||
|
05ad4445b5 | ||
|
1dd9f0747e | ||
|
150e01be8b | ||
|
95ee3216c4 | ||
|
3b5e409b38 | ||
|
eb201b614a | ||
|
162a6b8b5c | ||
|
4ec01769cb | ||
|
19b656132d | ||
|
6305c7e2ab | ||
|
04c60e8a1c | ||
|
b6ceb06a32 | ||
|
8cb2f85a08 | ||
|
7ccfb6ea88 | ||
|
531398b532 |
38
.gitattributes
vendored
Normal file
38
.gitattributes
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
# FROM https://github.com/libgit2/libgit2sharp
|
||||
# Text files that should be normalized to LF in odb.
|
||||
*.cs text diff=csharp
|
||||
*.config text
|
||||
|
||||
*.sln text
|
||||
*.csproj text
|
||||
|
||||
*.md text
|
||||
*.sh text
|
||||
*.ps1 text
|
||||
*.cmd text
|
||||
*.bat text
|
||||
*.markdown text
|
||||
*.msbuild text
|
||||
|
||||
Lib/* binary
|
||||
GitHub.Tests.Integration/Resources/* binary
|
||||
|
||||
|
||||
# Binary files that should not be normalized or diffed
|
||||
*.png binary
|
||||
*.jpg binary
|
||||
*.gif binary
|
||||
|
||||
*.pfx binary
|
||||
*.snk binary
|
||||
*.dll binary
|
||||
*.exe binary
|
||||
*.lib binary
|
||||
*.exp binary
|
||||
*.pdb binary
|
||||
*.sdf binary
|
||||
*.7z binary
|
||||
|
||||
|
||||
# Catch all for anything we forgot. Add rules if you get CRLF -> LF warnings.
|
||||
* text eol=lf
|
32
.github/ISSUE_TEMPLATE.md
vendored
32
.github/ISSUE_TEMPLATE.md
vendored
@@ -1,7 +1,33 @@
|
||||
##### Expected Behaviour:
|
||||
**In raising this issue, I confirm the following (please check boxes, eg [X]) Failure to fill the template will close your issue:**
|
||||
|
||||
- [] I have read and understood the [contributors guide](https://github.com/pi-hole/pi-hole/blob/master/CONTRIBUTING.md).
|
||||
- [] The issue I am reporting can be *replicated*
|
||||
- [] The issue I'm reporting isn't a duplicate (see [FAQs](https://github.com/pi-hole/pi-hole/wiki/FAQs), [closed issues](https://github.com/pi-hole/pi-hole/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aclosed%20), and [open issues](https://github.com/pi-hole/pi-hole/issues)).
|
||||
|
||||
**How familiar are you with the codebase?:**
|
||||
|
||||
_{replace this text with a number from 1 to 10, with 1 being not familiar, and 10 being very familiar}_
|
||||
|
||||
---
|
||||
**[FEATURE REQUEST | QUESTION | OTHER]:**
|
||||
|
||||
Please [submit your feature request here](https://discourse.pi-hole.net/c/feature-requests), so it is votable by the community. It's also easier for us to track.
|
||||
|
||||
**[BUG | ISSUE] Expected Behaviour:**
|
||||
|
||||
|
||||
##### Actual Behaviour:
|
||||
**[BUG | ISSUE] Actual Behaviour:**
|
||||
|
||||
|
||||
##### Steps to reproduce this issue:
|
||||
**[BUG | ISSUE] Steps to reproduce:**
|
||||
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
|
||||
**(Optional) Debug token generated by `pihole -d`:**
|
||||
|
||||
`<token>`
|
||||
|
||||
_This template was created based on the work of [`udemy-dl`](https://github.com/nishad/udemy-dl/blob/master/LICENSE)._
|
||||
|
20
.github/PULL_REQUEST_TEMPLATE.md
vendored
20
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -1,11 +1,19 @@
|
||||
Fixes #[issue number] .
|
||||
**By submitting this pull request, I confirm the following (please check boxes, eg [X]) _Failure to fill the template will close your PR_:**
|
||||
|
||||
Changes proposed in this pull request:
|
||||
***Please submit all pull requests against the `development` branch. Failure to do so will delay or deny your request***
|
||||
|
||||
-
|
||||
- [] I have read and understood the [contributors guide](https://github.com/pi-hole/pi-hole/blob/master/CONTRIBUTING.md).
|
||||
- [] I have checked that [another pull request](https://github.com/pi-hole/pi-hole/pulls) for this purpose does not exist.
|
||||
- [] I have considered, and confirmed that this submission will be valuable to others.
|
||||
- [] I accept that this submission may not be used, and the pull request closed at the will of the maintainer.
|
||||
- [] I give this submission freely, and claim no ownership to its content.
|
||||
|
||||
-
|
||||
**How familiar are you with the codebase?:**
|
||||
|
||||
-
|
||||
_{replace this text with a number from 1 to 10, with 1 being not familiar, and 10 being very familiar}_
|
||||
|
||||
@pi-hole/gravity
|
||||
---
|
||||
_{replace this line with your pull request content}_
|
||||
|
||||
|
||||
_This template was created based on the work of [`udemy-dl`](https://github.com/nishad/udemy-dl/blob/master/LICENSE)._
|
||||
|
6
.gitignore
vendored
6
.gitignore
vendored
@@ -1 +1,7 @@
|
||||
.DS_Store
|
||||
*.pyc
|
||||
*.swp
|
||||
__pycache__
|
||||
.cache
|
||||
.pullapprove.yml
|
||||
|
||||
|
25
.idea/codeStyleSettings.xml
generated
Normal file
25
.idea/codeStyleSettings.xml
generated
Normal file
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectCodeStyleSettingsManager">
|
||||
<option name="PER_PROJECT_SETTINGS">
|
||||
<value>
|
||||
<option name="OTHER_INDENT_OPTIONS">
|
||||
<value>
|
||||
<option name="INDENT_SIZE" value="2" />
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="8" />
|
||||
<option name="TAB_SIZE" value="2" />
|
||||
<option name="USE_TAB_CHARACTER" value="false" />
|
||||
<option name="SMART_TABS" value="false" />
|
||||
<option name="LABEL_INDENT_SIZE" value="0" />
|
||||
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
|
||||
<option name="USE_RELATIVE_INDENTS" value="false" />
|
||||
</value>
|
||||
</option>
|
||||
<MarkdownNavigatorCodeStyleSettings>
|
||||
<option name="RIGHT_MARGIN" value="72" />
|
||||
</MarkdownNavigatorCodeStyleSettings>
|
||||
</value>
|
||||
</option>
|
||||
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
||||
</component>
|
||||
</project>
|
@@ -1,14 +1,38 @@
|
||||
approve_by_comment: true
|
||||
approve_regex: '^(Approved|:shipit:|:\+1:)'
|
||||
reject_regex: '^(Rejected|:-1:)'
|
||||
reset_on_push: true
|
||||
author_approval: required
|
||||
reviewers:
|
||||
members:
|
||||
- brantje
|
||||
- dschaper
|
||||
- jacobsalmela
|
||||
- Mcat12
|
||||
- PromoFaux
|
||||
name: pullapprove
|
||||
required: 3
|
||||
version: 2
|
||||
|
||||
always_pending:
|
||||
title_regex: '(WIP|wip)'
|
||||
labels:
|
||||
- wip
|
||||
explanation: 'This PR is a work in progress...'
|
||||
|
||||
group_defaults:
|
||||
reset_on_push:
|
||||
enabled: true
|
||||
reject_value: -2
|
||||
approve_regex: '^(Approved|:shipit:|:\+1:|Engage)'
|
||||
reject_regex: '^(Rejected|:-1:|Borg)'
|
||||
author_approval:
|
||||
auto: true
|
||||
|
||||
|
||||
groups:
|
||||
development:
|
||||
approve_by_comment:
|
||||
enabled: true
|
||||
conditions:
|
||||
branches:
|
||||
- development
|
||||
required: 2
|
||||
teams:
|
||||
- approvers
|
||||
|
||||
master:
|
||||
approve_by_comment:
|
||||
enabled: true
|
||||
conditions:
|
||||
branches:
|
||||
- master
|
||||
required: -1
|
||||
teams:
|
||||
- admin
|
||||
|
10
.travis.yml
Normal file
10
.travis.yml
Normal file
@@ -0,0 +1,10 @@
|
||||
sudo: required
|
||||
services:
|
||||
- docker
|
||||
language: python
|
||||
python:
|
||||
- "2.7"
|
||||
install:
|
||||
- pip install -r requirements.txt
|
||||
|
||||
script: py.test -vv
|
@@ -1,8 +1,38 @@
|
||||
This is a basic checklist for now, We will update it in the future.
|
||||
_This template was created based on the work of [`udemy-dl`](https://github.com/nishad/udemy-dl/blob/master/LICENSE)._
|
||||
|
||||
* Fork the repo and create your new branch based on the `development` branch.
|
||||
* Commit Unix line endings
|
||||
* If you want, try to keep to the theme of black holes/gravity. This can add some fun to your submission.
|
||||
* Submit Pull Requests to the development branch only.
|
||||
* Before Submitting your Pull Request, merge `development` with your new branch and fix any conflicts. (Make sure you don't break anything in development!)
|
||||
* Be patient. We will review all submitted pull requests, but our focus is on stability.. please don't be offended if we reject your PR, or it appears we're doing nothing with it! We'll get around to it..
|
||||
# Contributors Guide
|
||||
|
||||
Please read and understand the contribution guide before creating an issue or pull request.
|
||||
|
||||
## Etiquette
|
||||
|
||||
- Our goal for Pi-hole is **stability before features**. This means we focus on squashing critical bugs before adding new features. Often, we can do both in tandem, but bugs will take priority over a new feature.
|
||||
- Pi-hole is open source and [powered by donations](https://pi-hole.net/donate/), and as such, we give our **free time** to build, maintain, and **provide user support** for this project. It would be extremely unfair for us to suffer abuse or anger for our hard work, so please take a moment to consider that.
|
||||
- Please be considerate towards the developers and other users when raising issues or presenting pull requests.
|
||||
- Respect our decision(s), and do not be upset or abusive if your submission is not used.
|
||||
|
||||
## Viability
|
||||
|
||||
When requesting or submitting new features, first consider whether it might be useful to others. Open source projects are used by many people, who may have entirely different needs to your own. Think about whether or not your feature is likely to be used by other users of the project.
|
||||
|
||||
## Procedure
|
||||
|
||||
**Before filing an issue:**
|
||||
|
||||
- Attempt to replicate and **document** the problem, to ensure that it wasn't a coincidental incident.
|
||||
- Check to make sure your feature suggestion isn't already present within the project.
|
||||
- Check the pull requests tab to ensure that the bug doesn't have a fix in progress.
|
||||
- Check the pull requests tab to ensure that the feature isn't already in progress.
|
||||
|
||||
**Before submitting a pull request:**
|
||||
|
||||
- Check the codebase to ensure that your feature doesn't already exist.
|
||||
- Check the pull requests to ensure that another person hasn't already submitted the feature or fix.
|
||||
|
||||
## Technical Requirements
|
||||
|
||||
- Submit Pull Requests to the **development branch only**.
|
||||
- Before Submitting your Pull Request, merge `development` with your new branch and fix any conflicts. (Make sure you don't break anything in development!)
|
||||
- Please use the [Google Style Guide for Shell](https://google.github.io/styleguide/shell.xml) for your code submission styles.
|
||||
- Commit Unix line endings.
|
||||
- (Optional fun) keep to the theme of Star Trek/black holes/gravity.
|
||||
|
390
LICENSE
390
LICENSE
@@ -1,339 +1,167 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
Copyright (C) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
Pi-hole Core
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
This software is licensed under the European Union Public License (EUPL)
|
||||
The license is available in the 22 official languages of the EU. The English version is included here.
|
||||
Please see https://joinup.ec.europa.eu/community/eupl/og_page/eupl for official translations of the other languages.
|
||||
|
||||
Preamble
|
||||
This license applies to the whole project EXCEPT:
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
- any commits made to the master branch prior to the release of version 3.0
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
The licenses that existed prior to this change have remained intact.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
-------------------------------------------------------------
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
European Union Public Licence
|
||||
V. 1.1
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
EUPL (C) the European Community 2007
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
This European Union Public Licence (the "EUPL") applies to the Work or Software (as defined below) which is provided under the terms of this Licence. Any use of the Work, other than as authorised under this Licence is prohibited (to the extent such use is covered by a right of the copyright holder of the Work).
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
The Original Work is provided under the terms of this Licence when the Licensor (as defined below) has placed the following notice immediately following the copyright notice for the Original Work:
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
Licensed under the EUPL V.1.1
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
or has expressed by any other mean his willingness to license under the EUPL.
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
1. Definitions
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
In this Licence, the following terms have the following meaning:
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
- The Licence: this Licence.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
- The Original Work or the Software: the software distributed and/or communicated by the Licensor under this Licence, available as Source Code and also as Executable Code as the case may be.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
- Derivative Works: the works or software that could be created by the Licensee, based upon the Original Work or modifications thereof. This Licence does not define the extent of modification or dependence on the Original Work required in order to classify a work as a Derivative Work; this extent is determined by copyright law applicable in the country mentioned in Article 15.
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
- The Work: the Original Work and/or its Derivative Works.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
- The Source Code: the human-readable form of the Work which is the most convenient for people to study and modify.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
- The Executable Code: any code which has generally been compiled and which is meant to be interpreted by a computer as a program.
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
- The Licensor: the natural or legal person that distributes and/or communicates the Work under the Licence.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
- Contributor(s): any natural or legal person who modifies the Work under the Licence, or otherwise contributes to the creation of a Derivative Work.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
- The Licensee or "You": any natural or legal person who makes any usage of the Software under the terms of the Licence.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
- Distribution and/or Communication: any act of selling, giving, lending, renting, distributing, communicating, transmitting, or otherwise making available, on-line or off-line, copies of the Work or providing access to its essential functionalities at the disposal of any other natural or legal person.
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
2. Scope of the rights granted by the Licence
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
The Licensor hereby grants You a world-wide, royalty-free, non-exclusive, sub-licensable licence to do the following, for the duration of copyright vested in the Original Work:
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
- use the Work in any circumstance and for all usage,
|
||||
- reproduce the Work,
|
||||
- modify the Original Work, and make Derivative Works based upon the Work,
|
||||
- communicate to the public, including the right to make available or display the Work or copies thereof to the public and perform publicly, as the case may be, the Work,
|
||||
- distribute the Work or copies thereof,
|
||||
- lend and rent the Work or copies thereof,
|
||||
- sub-license rights in the Work or copies thereof.
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
Those rights can be exercised on any media, supports and formats, whether now known or later invented, as far as the applicable law permits so.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
In the countries where moral rights apply, the Licensor waives his right to exercise his moral right to the extent allowed by law in order to make effective the licence of the economic rights here above listed.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
The Licensor grants to the Licensee royalty-free, non exclusive usage rights to any patents held by the Licensor, to the extent necessary to make use of the rights granted on the Work under this Licence.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
3. Communication of the Source Code
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
The Licensor may provide the Work either in its Source Code form, or as Executable Code. If the Work is provided as Executable Code, the Licensor provides in addition a machine-readable copy of the Source Code of the Work along with each copy of the Work that the Licensor distributes or indicates, in a notice following the copyright notice attached to the Work, a repository where the Source Code is easily and freely accessible for as long as the Licensor continues to distribute and/or communicate the Work.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
4. Limitations on copyright
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
Nothing in this Licence is intended to deprive the Licensee of the benefits from any exception or limitation to the exclusive rights of the rights owners in the Original Work or Software, of the exhaustion of those rights or of other applicable limitations thereto.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
5. Obligations of the Licensee
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
The grant of the rights mentioned above is subject to some restrictions and obligations imposed on the Licensee. Those obligations are the following:
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
Attribution right: the Licensee shall keep intact all copyright, patent or trademarks notices and all notices that refer to the Licence and to the disclaimer of warranties. The Licensee must include a copy of such notices and a copy of the Licence with every copy of the Work he/she distributes and/or communicates. The Licensee must cause any Derivative Work to carry prominent notices stating that the Work has been modified and the date of modification.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
Copyleft clause: If the Licensee distributes and/or communicates copies of the Original Works or Derivative Works based upon the Original Work, this Distribution and/or Communication will be done under the terms of this Licence or of a later version of this Licence unless the Original Work is expressly distributed only under this version of the Licence. The Licensee (becoming Licensor) cannot offer or impose any additional terms or conditions on the Work or Derivative Work that alter or restrict the terms of the Licence.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
Compatibility clause: If the Licensee Distributes and/or Communicates Derivative Works or copies thereof based upon both the Original Work and another work licensed under a Compatible Licence, this Distribution and/or Communication can be done under the terms of this Compatible Licence. For the sake of this clause, "Compatible Licence" refers to the licences listed in the appendix attached to this Licence. Should the Licensee’s obligations under the Compatible Licence conflict with his/her obligations under this Licence, the obligations of the Compatible Licence shall prevail.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
Provision of Source Code: When distributing and/or communicating copies of the Work, the Licensee will provide a machine-readable copy of the Source Code or indicate a repository where this Source will be easily and freely available for as long as the Licensee continues to distribute and/or communicate the Work.
|
||||
|
||||
NO WARRANTY
|
||||
Legal Protection: This Licence does not grant permission to use the trade names, trademarks, service marks, or names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the copyright notice.
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
6. Chain of Authorship
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
The original Licensor warrants that the copyright in the Original Work granted hereunder is owned by him/her or licensed to him/her and that he/she has the power and authority to grant the Licence.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
Each Contributor warrants that the copyright in the modifications he/she brings to the Work are owned by him/her or licensed to him/her and that he/she has the power and authority to grant the Licence.
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
Each time You accept the Licence, the original Licensor and subsequent Contributors grant You a licence to their contributions to the Work, under the terms of this Licence.
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
7. Disclaimer of Warranty
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
The Work is a work in progress, which is continuously improved by numerous contributors. It is not a finished work and may therefore contain defects or "bugs" inherent to this type of software development.
|
||||
|
||||
{description}
|
||||
Copyright (C) {year} {fullname}
|
||||
For the above reason, the Work is provided under the Licence on an "as is" basis and without warranties of any kind concerning the Work, including without limitation merchantability, fitness for a particular purpose, absence of defects or errors, accuracy, non-infringement of intellectual property rights other than copyright as stated in Article 6 of this Licence.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This disclaimer of warranty is an essential part of the Licence and a condition for the grant of any rights to the Work.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
8. Disclaimer of Liability
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
Except in the cases of wilful misconduct or damages directly caused to natural persons, the Licensor will in no event be liable for any direct or indirect, material or moral, damages of any kind, arising out of the Licence or of the use of the Work, including without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, loss of data or any commercial damage, even if the Licensor has been advised of the possibility of such damage. However, the Licensor will be liable under statutory product liability laws as far such laws apply to the Work.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
9. Additional agreements
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
While distributing the Original Work or Derivative Works, You may choose to conclude an additional agreement to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or services consistent with this Licence. However, in accepting such obligations, You may act only on your own behalf and on your sole responsibility, not on behalf of the original Licensor or any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against such Contributor by the fact You have accepted any such warranty or additional liability.
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
10. Acceptance of the Licence
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
The provisions of this Licence can be accepted by clicking on an icon "I agree" placed under the bottom of a window displaying the text of this Licence or by affirming consent in any other similar way, in accordance with the rules of applicable law. Clicking on that icon indicates your clear and irrevocable acceptance of this Licence and all of its terms and conditions.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
Similarly, you irrevocably accept this Licence and all of its terms and conditions by exercising any rights granted to You by Article 2 of this Licence, such as the use of the Work, the creation by You of a Derivative Work or the Distribution and/or Communication by You of the Work or copies thereof.
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
11. Information to the public
|
||||
|
||||
{signature of Ty Coon}, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
In case of any Distribution and/or Communication of the Work by means of electronic communication by You (for example, by offering to download the Work from a remote location) the distribution channel or media (for example, a website) must at least provide to the public the information requested by the applicable law regarding the Licensor, the Licence and the way it may be accessible, concluded, stored and reproduced by the Licensee.
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
12. Termination of the Licence
|
||||
|
||||
The Licence and the rights granted hereunder will terminate automatically upon any breach by the Licensee of the terms of the Licence.
|
||||
|
||||
Such a termination will not terminate the licences of any person who has received the Work from the Licensee under the Licence, provided such persons remain in full compliance with the Licence.
|
||||
|
||||
13. Miscellaneous
|
||||
|
||||
Without prejudice of Article 9 above, the Licence represents the complete agreement between the Parties as to the Work licensed hereunder.
|
||||
|
||||
If any provision of the Licence is invalid or unenforceable under applicable law, this will not affect the validity or enforceability of the Licence as a whole. Such provision will be construed and/or reformed so as necessary to make it valid and enforceable.
|
||||
|
||||
The European Commission may publish other linguistic versions and/or new versions of this Licence, so far this is required and reasonable, without reducing the scope of the rights granted by the Licence. New versions of the Licence will be published with a unique version number.
|
||||
|
||||
All linguistic versions of this Licence, approved by the European Commission, have identical value. Parties can take advantage of the linguistic version of their choice.
|
||||
|
||||
14. Jurisdiction
|
||||
|
||||
Any litigation resulting from the interpretation of this License, arising between the European Commission, as a Licensor, and any Licensee, will be subject to the jurisdiction of the Court of Justice of the European Communities, as laid down in article 238 of the Treaty establishing the European Community.
|
||||
|
||||
Any litigation arising between Parties, other than the European Commission, and resulting from the interpretation of this License, will be subject to the exclusive jurisdiction of the competent court where the Licensor resides or conducts its primary business.
|
||||
|
||||
15. Applicable Law
|
||||
|
||||
This Licence shall be governed by the law of the European Union country where the Licensor resides or has his registered office.
|
||||
|
||||
This licence shall be governed by the Belgian law if:
|
||||
|
||||
- a litigation arises between the European Commission, as a Licensor, and any Licensee;
|
||||
- the Licensor, other than the European Commission, has no residence or registered office inside a European Union country.
|
||||
|
||||
|
||||
===
|
||||
Appendix
|
||||
|
||||
"Compatible Licences" according to article 5 EUPL are:
|
||||
- GNU General Public License (GNU GPL) v. 2
|
||||
- Open Software License (OSL) v. 2.1, v. 3.0
|
||||
- Common Public License v. 1.0
|
||||
- Eclipse Public License v. 1.0
|
||||
- Cecill v. 2.0
|
||||
|
146
README.md
146
README.md
@@ -1,79 +1,128 @@
|
||||
[](https://www.bountysource.com/trackers/3011939-pi-hole-pi-hole?utm_source=3011939&utm_medium=shield&utm_campaign=TRACKER_BADGE)
|
||||
<p align="center">
|
||||
<a href=https://www.bountysource.com/trackers/3011939-pi-hole-pi-hole?utm_source=3011939&utm_medium=shield&utm_campaign=TRACKER_BADGE><img src="https://www.bountysource.com/badge/tracker?tracker_id=3011939"></a>
|
||||
<a href="https://www.codacy.com/app/Pi-hole/pi-hole?utm_source=github.com&utm_medium=referral&utm_content=pi-hole/pi-hole&utm_campaign=Badge_Grade"><img src="https://api.codacy.com/project/badge/Grade/c558a0f8d7124c99b02b84f0f5564238"/></a>
|
||||
<a href=https://travis-ci.org/pi-hole/pi-hole><img src="https://travis-ci.org/pi-hole/pi-hole.svg?branch=development"></a>
|
||||
</p>
|
||||
|
||||
# Automated Install
|
||||
<p align="center">
|
||||
<a href=https://discourse.pi-hole.net><img src="https://assets.pi-hole.net/static/Vortex_text.png" width=210></a>
|
||||
</p>
|
||||
|
||||
Designed For Raspberry Pi A+, B, B+, 2, 3B, and Zero (with an Ethernet/Wi-Fi adapter)
|
||||
Works on most Debian and CentOS/RHEL based distributions!
|
||||
## The multi-platform, network-wide ad blocker
|
||||
|
||||
1. Install Raspbian
|
||||
2. Run the command below (downloads [this script](https://github.com/pi-hole/pi-hole/blob/master/automated%20install/basic-install.sh) in case you want to read over it first!)
|
||||
Block ads for **all** your devices _without_ the need to install client-side software. The Pi-hole blocks ads at the DNS-level, so all your devices are protected.
|
||||
|
||||
## `curl -L https://install.pi-hole.net | bash`
|
||||
- Web Browsers
|
||||
- Cell Phones
|
||||
- Smart TV's
|
||||
- Internet-connected home automation
|
||||
- Anything that communicates with the Internet
|
||||
|
||||
### Alternative Semi-Automated install
|
||||
<p align="center">
|
||||
<a href=http://www.digitalocean.com/?refcode=344d234950e1><img src="https://assets.pi-hole.net/static/DOHostingSlug.png"></a>
|
||||
</p>
|
||||
|
||||
## Your Support Still Matters
|
||||
|
||||
Digital Ocean helps with our infrastructure, but our developers are all volunteers so *your donations help keep us innovating*. Sending a donation using our links below helps us offset a portion of our monthly costs.
|
||||
|
||||
-  [Donate via PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3J2L3Z4DHW9UY)
|
||||
-  Bitcoin Address: 1GKnevUnVaQM2pQieMyeHkpr8DXfkpfAtL
|
||||
|
||||
### One-Step Automated Install
|
||||
1. Install a [supported operating system](https://discourse.pi-hole.net/t/hardware-software-requirements/273/1)
|
||||
2. Run the command below (it downloads [this script](https://github.com/pi-hole/pi-hole/blob/master/automated%20install/basic-install.sh) in case you want to read over it first!)
|
||||
|
||||
### `curl -sSL https://install.pi-hole.net | bash`
|
||||
|
||||
#### Alternative Semi-Automated Install Methods
|
||||
_If you wish to read over the script before running it, run `nano basic-install.sh` to open the file in a text viewer._
|
||||
|
||||
##### Clone our repository and run the automated installer from your device.
|
||||
|
||||
```
|
||||
git clone --depth 1 https://github.com/pi-hole/pi-hole.git Pi-hole
|
||||
cd Pi-hole/automated\ install/
|
||||
bash basic-install.sh
|
||||
```
|
||||
|
||||
##### Or
|
||||
|
||||
```bash
|
||||
wget -O basic-install.sh https://install.pi-hole.net
|
||||
chmod +x basic-install.sh
|
||||
./basic-install.sh
|
||||
bash basic-install.sh
|
||||
```
|
||||
|
||||
If you wish to read over the script before running it, then after the `wget` command, do `nano basic-install.sh` to open a text viewer
|
||||
Once installed, [configure your router to have **DHCP clients use the Pi as their DNS server**](https://discourse.pi-hole.net/t/how-do-i-configure-my-devices-to-use-pi-hole-as-their-dns-server/245) and then any device that connects to your network will have ads blocked without any further configuration. Alternatively, you can manually set each device to use Pi-hole as their DNS server.
|
||||
|
||||
Once installed, [configure your router to have **DHCP clients use the Pi as their DNS server**](http://pi-hole.net/faq/can-i-set-the-pi-hole-to-be-the-dns-server-at-my-router-so-i-dont-have-to-change-settings-for-my-devices/) and then any device that connects to your network will have ads blocked without any further configuration. Alternatively, you can manually set each device to [use the Raspberry Pi as its DNS server](http://pi-hole.net/faq/how-do-i-use-the-pi-hole-as-my-dns-server/).
|
||||
## What is Pi-hole and how do I install it?
|
||||
<p align="center">
|
||||
<a href=https://www.youtube.com/watch?v=vKWjx1AQYgs><img src="https://assets.pi-hole.net/static/video-explainer.png"></a>
|
||||
</p>
|
||||
|
||||
## How To Install Pi-hole
|
||||
|
||||
[](https://www.youtube.com/watch?v=TzFLJqUeirA)
|
||||
|
||||
## How It Works
|
||||
|
||||
**Watch the 60-second video below to get a quick overview**
|
||||
|
||||
[](https://youtu.be/9Eti3xibiho)
|
||||
|
||||
## Pi-hole Is Free, But Powered By Your Donations
|
||||
|
||||
Send a one-time donation or sign up for Optimal.com's service using our link below to provide us with a small portion of the monthly fee.
|
||||
|
||||
-  : [Donate](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3J2L3Z4DHW9UY)
|
||||
-  : [Donate](https://flattr.com/submit/auto?user_id=jacobsalmela&url=https://github.com/pi-hole/pi-hole)
|
||||
-  : 1GKnevUnVaQM2pQieMyeHkpr8DXfkpfAtL
|
||||
|
||||
## Get Help Or Connect With Us On The Web
|
||||
|
||||
- [@The_Pi_Hole](https://twitter.com/The_Pi_Hole)
|
||||
- [/r/pihole](https://www.reddit.com/r/pihole/)
|
||||
- [Pi-hole YouTube channel](https://www.youtube.com/channel/UCT5kq9w0wSjogzJb81C9U0w)
|
||||
- [Wiki](https://github.com/pi-hole/pi-hole/wiki/Customization)
|
||||
- [FAQs](https://pi-hole.net/help/)
|
||||
- [Users Forum](https://discourse.pi-hole.net/)
|
||||
- [FAQs](https://discourse.pi-hole.net/c/faqs)
|
||||
- [Wiki](https://github.com/pi-hole/pi-hole/wiki)
|
||||
-  [Tweet @The_Pi_Hole](https://twitter.com/The_Pi_Hole)
|
||||
-  [Reddit /r/pihole](https://www.reddit.com/r/pihole/)
|
||||
-  [Pi-hole channel](https://www.youtube.com/channel/UCT5kq9w0wSjogzJb81C9U0w)
|
||||
- [](https://gitter.im/pi-hole/pi-hole?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
|
||||
## Technical Details
|
||||
|
||||
The Pi-hole is an **advertising-aware DNS/Web server**. If an ad domain is queried, a small Web page or GIF is delivered in place of the advertisement. You can also [replace ads with any image you want](http://pi-hole.net/faq/is-it-possible-to-change-the-blank-page-that-takes-place-of-the-ads-to-something-else/) since it is just a simple Webpage taking place of the ads.
|
||||
The Pi-hole is an **advertising-aware DNS/Web server**. If an ad domain is queried, a small Web page or GIF is delivered in place of the advertisement.
|
||||
|
||||
### Gravity
|
||||
|
||||
The [gravity.sh](https://github.com/pi-hole/pi-hole/blob/master/gravity.sh) does most of the magic. The script pulls in ad domains from many sources and compiles them into a single list of [over 1.6 million entries](http://jacobsalmela.com/block-millions-ads-network-wide-with-a-raspberry-pi-hole-2-0) (if you decide to use the [mahakala list](https://github.com/pi-hole/pi-hole/commit/963eacfe0537a7abddf30441c754c67ca1e40965)).
|
||||
The [gravity.sh](https://github.com/pi-hole/pi-hole/blob/master/gravity.sh) does most of the magic. The script pulls in ad domains from many sources and compiles them into a single list of [over 1.6 million entries](http://jacobsalmela.com/block-millions-ads-network-wide-with-a-raspberry-pi-hole-2-0) (if you decide to use the [mahakala list](https://github.com/pi-hole/pi-hole/commit/963eacfe0537a7abddf30441c754c67ca1e40965)). This script is controlled by the `pihole` command. Please run `pihole -h` to see what commands can be run via `pihole`.
|
||||
|
||||
## Web Interface
|
||||
|
||||
The [Web interface](https://github.com/jacobsalmela/AdminLTE#pi-hole-admin-dashboard) will be installed automatically so you can view stats and change settings. You can find it at:
|
||||
|
||||
#### Other Operating Systems
|
||||
|
||||
The automated install is only for a clean install of a Debian family or Fedora based system, such as the Raspberry Pi. However, this script will work for most UNIX-like systems, some with some slight **modifications** that we can help you work through. If you can install `dnsmasq` and a Webserver, it should work OK. If there are other platforms you'd like supported, let us know.
|
||||
|
||||
### Web Interface
|
||||
|
||||
The [Web interface](https://github.com/pi-hole/AdminLTE#pi-hole-admin-dashboard) will be installed automatically so you can view stats and change settings. You can find it at:
|
||||
|
||||
`http://192.168.1.x/admin/index.php` or `http://pi.hole/admin`
|
||||
|
||||

|
||||

|
||||
|
||||
### Whitelist and blacklist
|
||||
|
||||
Domains can be whitelisted and blacklisted using two pre-installed scripts. See [the wiki page](https://github.com/pi-hole/pi-hole/wiki/Whitelisting-and-Blacklisting) for more details 
|
||||
Domains can be whitelisted and blacklisted using either the web interface or the command line. See [the wiki page](https://github.com/pi-hole/pi-hole/wiki/Whitelisting-and-Blacklisting) for more details
|
||||
<p align="center">
|
||||
<a href=https://github.com/pi-hole/pi-hole/wiki/Whitelisting-and-Blacklisting><img src="https://assets.pi-hole.net/static/whitelist212.png"></a>
|
||||
</p>
|
||||
|
||||
### Settings
|
||||
|
||||
The settings page lets you control and configure your Pi-hole. You can do things like:
|
||||
|
||||
- enable Pi-hole's built-in DHCP server
|
||||
- exclude domains from the graphs
|
||||
- configure upstream DNS servers
|
||||
- and more!
|
||||
|
||||

|
||||
|
||||
#### Built-in DHCP Server
|
||||
|
||||
Pi-hole ships with a built-in DHCP server. This allows you to let your network devices use Pi-hole as their DNS server if your router does not let you adjust the DHCP options.
|
||||
<p align="center">
|
||||
<a href=hhttps://discourse.pi-hole.net/t/how-do-i-configure-my-devices-to-use-pi-hole-as-their-dns-server/245><img src="https://assets.pi-hole.net/static/piholedhcpserver.png"></a>
|
||||
</p>
|
||||
|
||||
## API
|
||||
|
||||
A basic read-only API can be accessed at `/admin/api.php`. It returns the following JSON:
|
||||
|
||||
```json
|
||||
``` json
|
||||
{
|
||||
"domains_being_blocked": "136708",
|
||||
"dns_queries_today": "18108",
|
||||
@@ -86,14 +135,15 @@ The same output can be achieved on the CLI by running `chronometer.sh -j`
|
||||
|
||||
## Real-time Statistics
|
||||
|
||||
You can view [real-time stats](http://pi-hole.net/faq/install-the-real-time-lcd-monitor-chronometer/) via `ssh` or on an [2.8" LCD screen](http://amzn.to/1P0q1Fj). This is accomplished via [`chronometer.sh`](https://github.com/pi-hole/pi-hole/blob/master/advanced/Scripts/chronometer.sh). 
|
||||
You can view [real-time stats](https://discourse.pi-hole.net/t/how-do-i-view-my-pi-holes-stats-over-ssh-or-on-an-lcd-using-chronometer/240) via `ssh` or on an [2.8" LCD screen](http://amzn.to/1P0q1Fj). This is accomplished via [`chronometer.sh`](https://github.com/pi-hole/pi-hole/blob/master/advanced/Scripts/chronometer.sh). 
|
||||
|
||||
## Pi-hole Projects
|
||||
|
||||
- [An ad blocking Magic Mirror](https://zonksec.com/blog/magic-mirror-dns-filtering/#dnssoftware)
|
||||
- [Pi-hole stats in your Mac's menu bar](https://getbitbar.com/plugins/Network/pi-hole.1m.py)
|
||||
- [Get LED alerts for each blocked ad](http://www.stinebaugh.info/get-led-alerts-for-each-blocked-ad-using-pi-hole/)
|
||||
- [Get LED alerts for each blocked ad](http://thetimmy.silvernight.org/pages/endisbutton/)
|
||||
- [Pi-hole on Ubuntu 14.04 on VirtualBox](http://hbalagtas.blogspot.com/2016/02/adblocking-with-pi-hole-and-ubuntu-1404.html)
|
||||
- [x86 Docker container that runs Pi-hole](https://hub.docker.com/r/diginc/pi-hole/)
|
||||
- [Docker Pi-hole container (x86 and ARM)](https://hub.docker.com/r/diginc/pi-hole/)
|
||||
- [Splunk: Pi-hole Visualizser](https://splunkbase.splunk.com/app/3023/)
|
||||
- [Pi-hole Chrome extension](https://chrome.google.com/webstore/detail/pi-hole-list-editor/hlnoeoejkllgkjbnnnhfolapllcnaglh) ([open source](https://github.com/packtloss/pihole-extension))
|
||||
- [Go Bananas for CHiP-hole ad blocking](https://www.hackster.io/jacobsalmela/chip-hole-network-wide-ad-blocker-98e037)
|
||||
@@ -103,6 +153,9 @@ You can view [real-time stats](http://pi-hole.net/faq/install-the-real-time-lcd-
|
||||
- [Pi-hole on/off button](http://thetimmy.silvernight.org/pages/endisbutton/)
|
||||
- [Minibian Pi-hole](http://munkjensen.net/wiki/index.php/See_my_Pi-Hole#Minibian_Pi-hole)
|
||||
- [Windows Tray Stat Application](https://github.com/goldbattle/copernicus)
|
||||
- [Let your blink1 device blink when Pi-hole filters ads](https://gist.github.com/elpatron68/ec0b4c582e5abf604885ac1e068d233f)
|
||||
- [Pi-Hole Prometheus exporter](https://github.com/nlamirault/pihole_exporter) : a [Prometheus](https://prometheus.io/) exporter for Pi-Hole
|
||||
- [Pi-hole Droid - open source Android client](https://github.com/friimaind/pi-hole-droid)
|
||||
|
||||
## Coverage
|
||||
|
||||
@@ -119,7 +172,4 @@ You can view [real-time stats](http://pi-hole.net/faq/install-the-real-time-lcd-
|
||||
- [Foolish Tech Show](https://youtu.be/bYyena0I9yc?t=2m4s)
|
||||
- [Pi-hole on Ubuntu](http://www.boyter.org/2015/12/pi-hole-ubuntu-14-04/)
|
||||
- [Catchpoint: iOS 9 Ad Blocking](http://blog.catchpoint.com/2015/09/14/ad-blocking-apple/)
|
||||
|
||||
## Other Operating Systems
|
||||
|
||||
This script will work for other UNIX-like systems with some slight **modifications**. As long as you can install `dnsmasq` and a Webserver, it should work OK. The automated install is only for a clean install of a Debian based system, such as the Raspberry Pi.
|
||||
- [Build an Ad-Blocker for less than 10$ with Orange-Pi](http://www.devacron.com/orangepi-zero-as-an-ad-block-server-with-pi-hole/)
|
||||
|
@@ -1,4 +1,4 @@
|
||||
## Pi-hole ad-list default sources. Updated 22/05/2016 #########################
|
||||
## Pi-hole ad-list default sources. Updated 29/10/2016 #########################
|
||||
# #
|
||||
# To make changes to this file: #
|
||||
# 1. run `cp /etc/pihole/adlists.default /etc/pihole/adlists.list` #
|
||||
@@ -14,8 +14,7 @@
|
||||
https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts
|
||||
|
||||
# Other lists we consider safe:
|
||||
http://adblock.gjtech.net/?format=unix-hosts
|
||||
http://mirror1.malwaredomains.com/files/justdomains
|
||||
https://mirror1.malwaredomains.com/files/justdomains
|
||||
http://sysctl.org/cameleon/hosts
|
||||
https://zeustracker.abuse.ch/blocklist.php?download=domainblocklist
|
||||
https://s3.amazonaws.com/lists.disconnect.me/simple_tracking.txt
|
||||
@@ -24,12 +23,12 @@ https://s3.amazonaws.com/lists.disconnect.me/simple_ad.txt
|
||||
# hosts-file.net list. Updated frequently, but has been known to block legitimate sites.
|
||||
https://hosts-file.net/ad_servers.txt
|
||||
|
||||
# Mahakala list. Has been known to block legitimage domains including the entire .com range.
|
||||
# Mahakala list. Has been known to block legitimate domains including the entire .com range.
|
||||
# Warning: Due to the sheer size of this list, the web admin console will be unresponsive.
|
||||
#http://adblock.mahakala.is/
|
||||
#https://adblock.mahakala.is/
|
||||
|
||||
# ADZHOSTS list. Has been known to block legitimate domains
|
||||
#http://optimate.dl.sourceforge.net/project/adzhosts/HOSTS.txt
|
||||
#http://pilotfiber.dl.sourceforge.net/project/adzhosts/HOSTS.txt
|
||||
|
||||
# Windows 10 telemetry list
|
||||
#https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/data/hosts/win10/spy.txt
|
||||
@@ -38,14 +37,11 @@ https://hosts-file.net/ad_servers.txt
|
||||
#http://securemecca.com/Downloads/hosts.txt
|
||||
|
||||
# Quidsup's tracker list
|
||||
https://raw.githubusercontent.com/quidsup/notrack/master/trackers.txt
|
||||
#https://raw.githubusercontent.com/quidsup/notrack/master/trackers.txt
|
||||
|
||||
# Block the BBC News website Breaking News banner
|
||||
#https://raw.githubusercontent.com/BreakingTheNews/BreakingTheNews.github.io/master/hosts
|
||||
|
||||
# List of known C&C malware servers (see https://github.com/pi-hole/pi-hole/issues/528)
|
||||
https://ransomwaretracker.abuse.ch/downloads/RW_DOMBL.txt
|
||||
|
||||
# Untested Lists:
|
||||
#https://raw.githubusercontent.com/reek/anti-adblock-killer/master/anti-adblock-killer-filters.txt
|
||||
#https://raw.githubusercontent.com/Dawsey21/Lists/master/main-blacklist.txt
|
||||
@@ -53,5 +49,5 @@ https://ransomwaretracker.abuse.ch/downloads/RW_DOMBL.txt
|
||||
# Following two lists should be used simultaneously: (readme https://github.com/notracking/hosts-blocklists/)
|
||||
#https://raw.github.com/notracking/hosts-blocklists/master/hostnames.txt
|
||||
#https://raw.github.com/notracking/hosts-blocklists/master/domains.txt
|
||||
# Combination of serveral host files on the internet (warning some facebook domains are also blocked but you can go to facebook.com). See https://github.com/mat1th/Dns-add-block for more information.
|
||||
# Combination of several host files on the internet (warning some facebook domains are also blocked but you can go to facebook.com). See https://github.com/mat1th/Dns-add-block for more information.
|
||||
#https://raw.githubusercontent.com/mat1th/Dns-add-block/master/hosts
|
||||
|
@@ -9,53 +9,36 @@
|
||||
# the Free Software Foundation, either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# If you want dnsmasq to read another file, as well as /etc/hosts, use
|
||||
# this.
|
||||
###############################################################################
|
||||
# FILE AUTOMATICALLY POPULATED BY PI-HOLE INSTALL/UPDATE PROCEDURE. #
|
||||
# ANY CHANGES MADE TO THIS FILE AFTER INSTALL WILL BE LOST ON THE NEXT UPDATE #
|
||||
# #
|
||||
# IF YOU WISH TO CHANGE THE UPSTREAM SERVERS, CHANGE THEM IN: #
|
||||
# /etc/pihole/setupVars.conf #
|
||||
# #
|
||||
# ANY OTHER CHANGES SHOULD BE MADE IN A SEPERATE CONFIG FILE #
|
||||
# OR IN /etc/dnsmasq.conf #
|
||||
###############################################################################
|
||||
|
||||
addn-hosts=/etc/pihole/gravity.list
|
||||
addn-hosts=/etc/pihole/local.list
|
||||
|
||||
# The following two options make you a better netizen, since they
|
||||
# tell dnsmasq to filter out queries which the public DNS cannot
|
||||
# answer, and which load the servers (especially the root servers)
|
||||
# unnecessarily. If you have a dial-on-demand link they also stop
|
||||
# these requests from bringing up the link unnecessarily.
|
||||
|
||||
# Never forward plain names (without a dot or domain part)
|
||||
domain-needed
|
||||
# Never forward addresses in the non-routed address spaces.
|
||||
|
||||
bogus-priv
|
||||
|
||||
# If you don't want dnsmasq to read /etc/resolv.conf or any other
|
||||
# file, getting its servers from this file instead (see below), then
|
||||
# uncomment this.
|
||||
no-resolv
|
||||
|
||||
# Add other name servers here, with domain specs if they are for
|
||||
# non-public domains.
|
||||
server=@DNS1@
|
||||
server=@DNS2@
|
||||
|
||||
# If you want dnsmasq to listen for DHCP and DNS requests only on
|
||||
# specified interfaces (and the loopback) give the name of the
|
||||
# interface (eg eth0) here.
|
||||
interface=@INT@
|
||||
# Or which to listen on by address (remember to include 127.0.0.1 if
|
||||
# you use this.)
|
||||
listen-address=127.0.0.1
|
||||
|
||||
# Set the cachesize here.
|
||||
cache-size=10000
|
||||
|
||||
# For debugging purposes, log each DNS query as it passes through
|
||||
# dnsmasq.
|
||||
log-queries
|
||||
log-facility=/var/log/pihole.log
|
||||
|
||||
# Normally responses which come from /etc/hosts and the DHCP lease
|
||||
# file have Time-To-Live set as zero, which conventionally means
|
||||
# do not cache further. If you are happy to trade lower load on the
|
||||
# server for potentially stale date, you can set a time-to-live (in
|
||||
# seconds) here.
|
||||
local-ttl=300
|
||||
|
||||
# This allows it to continue functioning without being blocked by syslog, and allows syslog to use dnsmasq for DNS queries without risking deadlock
|
||||
log-async
|
||||
|
@@ -1,237 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Pi-hole: A black hole for Internet advertisements
|
||||
# (c) 2015, 2016 by Jacob Salmela
|
||||
# Network-wide ad blocking via your Raspberry Pi
|
||||
# http://pi-hole.net
|
||||
# Blacklists domains
|
||||
#
|
||||
# Pi-hole is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
#rootcheck
|
||||
if [[ $EUID -eq 0 ]];then
|
||||
echo "::: You are root."
|
||||
else
|
||||
echo "::: sudo will be used."
|
||||
# Check if it is actually installed
|
||||
# If it isn't, exit because the install cannot complete
|
||||
if [ -x "$(command -v sudo)" ];then
|
||||
export SUDO="sudo"
|
||||
else
|
||||
echo "::: Please install sudo or run this script as root."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
function helpFunc()
|
||||
{
|
||||
echo "::: Immediately blacklists one or more domains in the hosts file"
|
||||
echo ":::"
|
||||
echo ":::"
|
||||
echo "::: Usage: pihole -b domain1 [domain2 ...]"
|
||||
echo "::: Options:"
|
||||
echo "::: -d, --delmode Remove domains from the blacklist"
|
||||
echo "::: -nr, --noreload Update blacklist without refreshing dnsmasq"
|
||||
echo "::: -f, --force Force updating of the hosts files, even if there are no changes"
|
||||
echo "::: -q, --quiet output is less verbose"
|
||||
echo "::: -h, --help Show this help dialog"
|
||||
echo "::: -l, --list Display your blacklisted domains"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [[ $# = 0 ]]; then
|
||||
helpFunc
|
||||
fi
|
||||
|
||||
#globals
|
||||
basename=pihole
|
||||
piholeDir=/etc/${basename}
|
||||
adList=${piholeDir}/gravity.list
|
||||
blacklist=${piholeDir}/blacklist.txt
|
||||
reload=true
|
||||
addmode=true
|
||||
force=false
|
||||
verbose=true
|
||||
|
||||
domList=()
|
||||
domToRemoveList=()
|
||||
|
||||
piholeIPfile=/etc/pihole/piholeIP
|
||||
piholeIPv6file=/etc/pihole/.useIPv6
|
||||
|
||||
if [[ -f ${piholeIPfile} ]];then
|
||||
# If the file exists, it means it was exported from the installation script and we should use that value instead of detecting it in this script
|
||||
piholeIP=$(cat ${piholeIPfile})
|
||||
#rm $piholeIPfile
|
||||
else
|
||||
# Otherwise, the IP address can be taken directly from the machine, which will happen when the script is run by the user and not the installation script
|
||||
IPv4dev=$(ip route get 8.8.8.8 | awk '{for(i=1;i<=NF;i++)if($i~/dev/)print $(i+1)}')
|
||||
piholeIPCIDR=$(ip -o -f inet addr show dev "$IPv4dev" | awk '{print $4}' | awk 'END {print}')
|
||||
piholeIP=${piholeIPCIDR%/*}
|
||||
fi
|
||||
|
||||
modifyHost=false
|
||||
|
||||
# After setting defaults, check if there's local overrides
|
||||
if [[ -r ${piholeDir}/pihole.conf ]];then
|
||||
echo "::: Local calibration requested..."
|
||||
. ${piholeDir}/pihole.conf
|
||||
fi
|
||||
|
||||
|
||||
if [[ -f ${piholeIPv6file} ]];then
|
||||
# If the file exists, then the user previously chose to use IPv6 in the automated installer
|
||||
piholeIPv6=$(ip -6 route get 2001:4860:4860::8888 | awk -F " " '{ for(i=1;i<=NF;i++) if ($i == "src") print $(i+1) }')
|
||||
fi
|
||||
|
||||
function HandleOther(){
|
||||
#check validity of domain
|
||||
validDomain=$(echo "$1" | perl -ne'print if /\b((?=[a-z0-9-]{1,63}\.)(xn--)?[a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,63}\b/')
|
||||
if [ -z "$validDomain" ]; then
|
||||
echo "::: $1 is not a valid argument or domain name"
|
||||
else
|
||||
domList=("${domList[@]}" ${validDomain})
|
||||
fi
|
||||
}
|
||||
|
||||
function PopBlacklistFile(){
|
||||
#check blacklist file exists, and if not, create it
|
||||
if [[ ! -f ${blacklist} ]];then
|
||||
touch ${blacklist}
|
||||
fi
|
||||
for dom in "${domList[@]}"; do
|
||||
if "$addmode"; then
|
||||
AddDomain "$dom"
|
||||
else
|
||||
RemoveDomain "$dom"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
function AddDomain(){
|
||||
#| sed 's/\./\\./g'
|
||||
bool=false
|
||||
grep -Ex -q "$1" ${blacklist} || bool=true
|
||||
if ${bool}; then
|
||||
#domain not found in the blacklist file, add it!
|
||||
if ${verbose}; then
|
||||
echo -n "::: Adding $1 to blacklist file..."
|
||||
fi
|
||||
echo "$1" >> ${blacklist}
|
||||
modifyHost=true
|
||||
echo " done!"
|
||||
else
|
||||
if ${verbose}; then
|
||||
echo "::: $1 already exists in $blacklist! No need to add"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function RemoveDomain(){
|
||||
|
||||
bool=false
|
||||
grep -Ex -q "$1" ${blacklist} || bool=true
|
||||
if ${bool}; then
|
||||
#Domain is not in the blacklist file, no need to Remove
|
||||
if ${verbose}; then
|
||||
echo "::: $1 is NOT blacklisted! No need to remove"
|
||||
fi
|
||||
else
|
||||
#Domain is in the blacklist file, add to a temporary array
|
||||
if ${verbose}; then
|
||||
echo "::: Un-blacklisting $dom..."
|
||||
fi
|
||||
domToRemoveList=("${domToRemoveList[@]}" $1)
|
||||
modifyHost=true
|
||||
fi
|
||||
}
|
||||
|
||||
function ModifyHostFile(){
|
||||
if ${addmode}; then
|
||||
#add domains to the hosts file
|
||||
if [[ -r ${blacklist} ]];then
|
||||
numberOf=$(cat ${blacklist} | sed '/^\s*$/d' | wc -l)
|
||||
plural=; [[ "$numberOf" != "1" ]] && plural=s
|
||||
echo ":::"
|
||||
echo -n "::: Modifying HOSTS file to blacklist $numberOf domain${plural}..."
|
||||
if [[ -n ${piholeIPv6} ]];then
|
||||
cat ${blacklist} | awk -v ipv4addr="$piholeIP" -v ipv6addr="$piholeIPv6" '{sub(/\r$/,""); print ipv4addr" "$0"\n"ipv6addr" "$0}' >> ${adList}
|
||||
else
|
||||
cat ${blacklist} | awk -v ipv4addr="$piholeIP" '{sub(/\r$/,""); print ipv4addr" "$0}' >>${adList}
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo ":::"
|
||||
for dom in "${domToRemoveList[@]}"
|
||||
do
|
||||
#we need to remove the domains from the blacklist file and the host file
|
||||
echo "::: $dom"
|
||||
echo -n "::: removing from HOSTS file..."
|
||||
echo "$dom" | sed 's/\./\\./g' | xargs -I {} perl -i -ne'print unless /[^.]'{}'(?!.)/;' ${adList}
|
||||
echo " done!"
|
||||
echo -n "::: removing from blackist.txt..."
|
||||
echo "$dom" | sed 's/\./\\./g' | xargs -I {} perl -i -ne'print unless /'{}'(?!.)/;' ${blacklist}
|
||||
echo " done!"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
function Reload() {
|
||||
# Reload hosts file
|
||||
echo ":::"
|
||||
echo -n "::: Refresh lists in dnsmasq..."
|
||||
|
||||
dnsmasqPid=$(pidof dnsmasq)
|
||||
|
||||
if [[ ${dnsmasqPid} ]]; then
|
||||
# service already running - reload config
|
||||
${SUDO} killall -s HUP dnsmasq
|
||||
else
|
||||
# service not running, start it up
|
||||
${SUDO} service dnsmasq start
|
||||
fi
|
||||
echo " done!"
|
||||
}
|
||||
|
||||
function DisplayBlist() {
|
||||
verbose=false
|
||||
echo -e " Displaying Gravity Affected Domains \n"
|
||||
count=1
|
||||
while IFS= read -r AD
|
||||
do
|
||||
echo "${count}: $AD"
|
||||
count=$((count+1))
|
||||
done < "$blacklist"
|
||||
}
|
||||
|
||||
###################################################
|
||||
|
||||
for var in "$@"
|
||||
do
|
||||
case "$var" in
|
||||
"-nr"| "--noreload" ) reload=false;;
|
||||
"-d" | "--delmode" ) addmode=false;;
|
||||
"-f" | "--force" ) force=true;;
|
||||
"-q" | "--quiet" ) verbose=false;;
|
||||
"-h" | "--help" ) helpFunc;;
|
||||
"-l" | "--list" ) DisplayBlist;;
|
||||
* ) HandleOther "$var";;
|
||||
esac
|
||||
done
|
||||
|
||||
PopBlacklistFile
|
||||
|
||||
if ${modifyHost} || ${force}; then
|
||||
ModifyHostFile
|
||||
else
|
||||
if ${verbose}; then
|
||||
echo "::: No changes need to be made"
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ${reload}; then
|
||||
Reload
|
||||
fi
|
@@ -1,87 +1,41 @@
|
||||
#!/usr/bin/env bash
|
||||
# Pi-hole: A black hole for Internet advertisements
|
||||
# (c) 2015, 2016 by Jacob Salmela
|
||||
# Network-wide ad blocking via your Raspberry Pi
|
||||
# http://pi-hole.net
|
||||
# (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
# Network-wide ad blocking via your own hardware.
|
||||
#
|
||||
# Calculates stats and displays to an LCD
|
||||
#
|
||||
# Pi-hole is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
# This file is copyright under the latest version of the EUPL.
|
||||
# Please see LICENSE file for your rights under this license.
|
||||
|
||||
|
||||
|
||||
|
||||
#Functions##############################################################################################################
|
||||
piLog="/var/log/pihole.log"
|
||||
gravity="/etc/pihole/gravity.list"
|
||||
|
||||
today=$(date "+%b %e")
|
||||
. /etc/pihole/setupVars.conf
|
||||
|
||||
function CalcBlockedDomains(){
|
||||
CheckIPv6
|
||||
if [ -e "$gravity" ]; then
|
||||
#Are we IPV6 or IPV4?
|
||||
if [[ -n ${piholeIPv6} ]];then
|
||||
#We are IPV6
|
||||
blockedDomainsTotal=$(wc -l /etc/pihole/gravity.list | awk '{print $1/2}')
|
||||
else
|
||||
#We are IPV4
|
||||
blockedDomainsTotal=$(wc -l /etc/pihole/gravity.list | awk '{print $1}')
|
||||
fi
|
||||
else
|
||||
blockedDomainsTotal="Err."
|
||||
fi
|
||||
# Borrowed/modified from https://gist.github.com/cjus/1047794
|
||||
function GetJSONValue {
|
||||
retVal=$(echo $1 | sed 's/\\\\\//\//g' | \
|
||||
sed 's/[{}]//g' | \
|
||||
awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}' | \
|
||||
sed 's/\"\:/\|/g' | \
|
||||
sed 's/[\,]/ /g' | \
|
||||
sed 's/\"//g' | \
|
||||
grep -w $2)
|
||||
echo ${retVal##*|}
|
||||
}
|
||||
|
||||
function CalcQueriesToday(){
|
||||
if [ -e "$piLog" ];then
|
||||
queriesToday=$(cat "$piLog" | grep "$today" | awk '/query/ {print $6}' | wc -l)
|
||||
else
|
||||
queriesToday="Err."
|
||||
fi
|
||||
outputJSON() {
|
||||
json=$(curl -s -X GET http://127.0.0.1/admin/api.php?summaryRaw)
|
||||
echo ${json}
|
||||
}
|
||||
|
||||
function CalcblockedToday(){
|
||||
if [ -e "$piLog" ] && [ -e "$gravity" ];then
|
||||
blockedToday=$(cat ${piLog} | awk '/\/etc\/pihole\/gravity.list/ && !/address/ {print $6}' | wc -l)
|
||||
else
|
||||
blockedToday="Err."
|
||||
fi
|
||||
}
|
||||
|
||||
function CalcPercentBlockedToday(){
|
||||
if [ "$queriesToday" != "Err." ] && [ "$blockedToday" != "Err." ]; then
|
||||
if [ "$queriesToday" != 0 ]; then #Fixes divide by zero error :)
|
||||
#scale 2 rounds the number down, so we'll do scale 4 and then trim the last 2 zeros
|
||||
percentBlockedToday=$(echo "scale=4; $blockedToday/$queriesToday*100" | bc)
|
||||
percentBlockedToday=$(sed 's/.\{2\}$//' <<< "$percentBlockedToday")
|
||||
else
|
||||
percentBlockedToday=0
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function CheckIPv6(){
|
||||
piholeIPv6file="/etc/pihole/.useIPv6"
|
||||
if [[ -f ${piholeIPv6file} ]];then
|
||||
# If the file exists, then the user previously chose to use IPv6 in the automated installer
|
||||
piholeIPv6=$(ip -6 route get 2001:4860:4860::8888 | awk -F " " '{ for(i=1;i<=NF;i++) if ($i == "src") print $(i+1) }')
|
||||
fi
|
||||
}
|
||||
|
||||
function outputJSON(){
|
||||
CalcQueriesToday
|
||||
CalcblockedToday
|
||||
CalcPercentBlockedToday
|
||||
|
||||
CalcBlockedDomains
|
||||
|
||||
printf '{"domains_being_blocked":"%s","dns_queries_today":"%s","ads_blocked_today":"%s","ads_percentage_today":"%s"}\n' "$blockedDomainsTotal" "$queriesToday" "$blockedToday" "$percentBlockedToday"
|
||||
}
|
||||
|
||||
function normalChrono(){
|
||||
for (( ; ; ))
|
||||
do
|
||||
normalChrono() {
|
||||
for (( ; ; )); do
|
||||
clear
|
||||
# Displays a colorful Pi-hole logo
|
||||
echo " [0;1;35;95m_[0;1;31;91m__[0m [0;1;33;93m_[0m [0;1;34;94m_[0m [0;1;36;96m_[0m"
|
||||
@@ -89,7 +43,7 @@ function normalChrono(){
|
||||
echo "[0;1;33;93m|[0m [0;1;32;92m_[0;1;36;96m/[0m [0;1;34;94m|_[0;1;35;95m__[0;1;31;91m|[0m [0;1;33;93m'[0m [0;1;32;92m\/[0m [0;1;36;96m_[0m [0;1;34;94m\[0m [0;1;35;95m/[0m [0;1;31;91m-[0;1;33;93m_)[0m"
|
||||
echo "[0;1;32;92m|_[0;1;36;96m|[0m [0;1;34;94m|_[0;1;35;95m|[0m [0;1;33;93m|_[0;1;32;92m||[0;1;36;96m_\[0;1;34;94m__[0;1;35;95m_/[0;1;31;91m_\[0;1;33;93m__[0;1;32;92m_|[0m"
|
||||
echo ""
|
||||
echo " $(ifconfig eth0 | awk '/inet addr/ {print $2}' | cut -d':' -f2)"
|
||||
echo " ${IPV4_ADDRESS}"
|
||||
echo ""
|
||||
uptime | cut -d' ' -f11-
|
||||
#uptime -p #Doesn't work on all versions of uptime
|
||||
@@ -98,51 +52,44 @@ function normalChrono(){
|
||||
# Uncomment to continually read the log file and display the current domain being blocked
|
||||
#tail -f /var/log/pihole.log | awk '/\/etc\/pihole\/gravity.list/ {if ($7 != "address" && $7 != "name" && $7 != "/etc/pihole/gravity.list") print $7; else;}'
|
||||
|
||||
#uncomment next 4 lines to use original query count calculation
|
||||
#today=$(date "+%b %e")
|
||||
#todaysQueryCount=$(cat /var/log/pihole.log | grep "$today" | awk '/query/ {print $7}' | wc -l)
|
||||
#todaysQueryCountV4=$(cat /var/log/pihole.log | grep "$today" | awk '/query/ && /\[A\]/ {print $7}' | wc -l)
|
||||
#todaysQueryCountV6=$(cat /var/log/pihole.log | grep "$today" | awk '/query/ && /\[AAAA\]/ {print $7}' | wc -l)
|
||||
json=$(curl -s -X GET http://127.0.0.1/admin/api.php?summaryRaw)
|
||||
|
||||
domains=$(printf "%'.f" $(GetJSONValue ${json} "domains_being_blocked")) #add commas in
|
||||
queries=$(printf "%'.f" $(GetJSONValue ${json} "dns_queries_today"))
|
||||
blocked=$(printf "%'.f" $(GetJSONValue ${json} "ads_blocked_today"))
|
||||
LC_NUMERIC=C percentage=$(printf "%0.2f\n" $(GetJSONValue ${json} "ads_percentage_today")) #2 decimal places
|
||||
|
||||
CalcQueriesToday
|
||||
CalcblockedToday
|
||||
CalcPercentBlockedToday
|
||||
echo "Blocking: ${domains}"
|
||||
echo "Queries: ${queries}"
|
||||
|
||||
CalcBlockedDomains
|
||||
|
||||
echo "Blocking: $blockedDomainsTotal"
|
||||
#below commented line does not add up to todaysQueryCount
|
||||
#echo "Queries: $todaysQueryCountV4 / $todaysQueryCountV6"
|
||||
echo "Queries: $queriesToday" #same total calculation as dashboard
|
||||
echo "Pi-holed: $blockedToday ($percentBlockedToday%)"
|
||||
echo "Pi-holed: ${blocked} (${percentage}%)"
|
||||
|
||||
sleep 5
|
||||
done
|
||||
}
|
||||
|
||||
function displayHelp(){
|
||||
echo "::: Displays stats about your piHole!"
|
||||
echo ":::"
|
||||
echo "::: Usage: sudo pihole -c [optional:-j]"
|
||||
echo "::: Note: If no option is passed, then stats are displayed on screen, updated every 5 seconds"
|
||||
echo ":::"
|
||||
echo "::: Options:"
|
||||
echo "::: -j, --json output stats as JSON formatted string"
|
||||
echo "::: -h, --help display this help text"
|
||||
|
||||
exit 1
|
||||
displayHelp() {
|
||||
cat << EOM
|
||||
::: Displays stats about your piHole!
|
||||
:::
|
||||
::: Usage: sudo pihole -c [optional:-j]
|
||||
::: Note: If no option is passed, then stats are displayed on screen, updated every 5 seconds
|
||||
:::
|
||||
::: Options:
|
||||
::: -j, --json output stats as JSON formatted string
|
||||
::: -h, --help display this help text
|
||||
EOM
|
||||
exit 0
|
||||
}
|
||||
|
||||
if [[ $# = 0 ]]; then
|
||||
normalChrono
|
||||
fi
|
||||
|
||||
for var in "$@"
|
||||
do
|
||||
case "$var" in
|
||||
"-j" | "--json" ) outputJSON;;
|
||||
"-h" | "--help" ) displayHelp;;
|
||||
* ) exit 1;;
|
||||
esac
|
||||
for var in "$@"; do
|
||||
case "$var" in
|
||||
"-j" | "--json" ) outputJSON;;
|
||||
"-h" | "--help" ) displayHelp;;
|
||||
* ) exit 1;;
|
||||
esac
|
||||
done
|
||||
|
231
advanced/Scripts/list.sh
Executable file
231
advanced/Scripts/list.sh
Executable file
@@ -0,0 +1,231 @@
|
||||
#!/usr/bin/env bash
|
||||
# Pi-hole: A black hole for Internet advertisements
|
||||
# (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
# Network-wide ad blocking via your own hardware.
|
||||
#
|
||||
# Whitelists and blacklists domains
|
||||
#
|
||||
# This file is copyright under the latest version of the EUPL.
|
||||
# Please see LICENSE file for your rights under this license.
|
||||
|
||||
|
||||
|
||||
#globals
|
||||
basename=pihole
|
||||
piholeDir=/etc/${basename}
|
||||
whitelist=${piholeDir}/whitelist.txt
|
||||
blacklist=${piholeDir}/blacklist.txt
|
||||
readonly wildcardlist="/etc/dnsmasq.d/03-pihole-wildcard.conf"
|
||||
reload=false
|
||||
addmode=true
|
||||
verbose=true
|
||||
|
||||
domList=()
|
||||
domToRemoveList=()
|
||||
|
||||
listMain=""
|
||||
listAlt=""
|
||||
|
||||
helpFunc() {
|
||||
|
||||
if [[ ${listMain} == ${whitelist} ]]; then
|
||||
letter="w"
|
||||
word="white"
|
||||
else
|
||||
letter="b"
|
||||
word="black"
|
||||
fi
|
||||
|
||||
cat << EOM
|
||||
::: Immediately ${word}lists one or more domains in the hosts file
|
||||
:::
|
||||
::: Usage: pihole -${letter} domain1 [domain2 ...]
|
||||
:::
|
||||
::: Options:
|
||||
::: -d, --delmode Remove domains from the ${word}list
|
||||
::: -nr, --noreload Update ${word}list without refreshing dnsmasq
|
||||
::: -q, --quiet Output is less verbose
|
||||
::: -h, --help Show this help dialog
|
||||
::: -l, --list Display your ${word}listed domains
|
||||
EOM
|
||||
if [[ "${letter}" == "b" ]]; then
|
||||
echo "::: -wild, --wildcard Add wildcard entry (only blacklist)"
|
||||
fi
|
||||
exit 0
|
||||
}
|
||||
|
||||
EscapeRegexp() {
|
||||
# This way we may safely insert an arbitrary
|
||||
# string in our regular expressions
|
||||
# Also remove leading "." if present
|
||||
echo $* | sed 's/^\.*//' | sed "s/[]\.|$(){}?+*^]/\\\\&/g" | sed "s/\\//\\\\\//g"
|
||||
}
|
||||
|
||||
HandleOther(){
|
||||
# First, convert everything to lowercase
|
||||
domain=$(sed -e "y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/" <<< "$1")
|
||||
|
||||
#check validity of domain
|
||||
validDomain=$(echo "${domain}" | perl -lne 'print if /(?!.*[^a-z0-9-\.].*)^((?=[a-z0-9-]{1,63}\.)(xn--)?[a-z0-9-]+\.)*[a-z]{2,63}/')
|
||||
if [ -z "${validDomain}" ]; then
|
||||
echo "::: $1 is not a valid argument or domain name"
|
||||
else
|
||||
domList=("${domList[@]}" ${validDomain})
|
||||
fi
|
||||
}
|
||||
|
||||
PoplistFile() {
|
||||
#check whitelist file exists, and if not, create it
|
||||
if [[ ! -f ${whitelist} ]]; then
|
||||
touch ${whitelist}
|
||||
fi
|
||||
for dom in "${domList[@]}"; do
|
||||
# Logic : If addmode then add to desired list and remove from the other; if delmode then remove from desired list but do not add to the other
|
||||
if ${addmode}; then
|
||||
AddDomain "${dom}" "${listMain}"
|
||||
RemoveDomain "${dom}" "${listAlt}"
|
||||
else
|
||||
RemoveDomain "${dom}" "${listMain}"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
AddDomain() {
|
||||
list="$2"
|
||||
domain=$(EscapeRegexp "$1")
|
||||
|
||||
if [[ "${list}" == "${whitelist}" || "${list}" == "${blacklist}" ]]; then
|
||||
|
||||
bool=true
|
||||
#Is the domain in the list we want to add it to?
|
||||
grep -Ex -q "${domain}" "${list}" > /dev/null 2>&1 || bool=false
|
||||
|
||||
if [[ "${bool}" == false ]]; then
|
||||
#domain not found in the whitelist file, add it!
|
||||
if [[ "${verbose}" == true ]]; then
|
||||
echo "::: Adding $1 to $list..."
|
||||
fi
|
||||
reload=true
|
||||
# Add it to the list we want to add it to
|
||||
echo "$1" >> "${list}"
|
||||
else
|
||||
if [[ "${verbose}" == true ]]; then
|
||||
echo "::: ${1} already exists in ${list}, no need to add!"
|
||||
fi
|
||||
fi
|
||||
|
||||
elif [[ "${list}" == "${wildcardlist}" ]]; then
|
||||
|
||||
source "${piholeDir}/setupVars.conf"
|
||||
#Remove the /* from the end of the IPv4addr.
|
||||
IPV4_ADDRESS=${IPV4_ADDRESS%/*}
|
||||
IPV6_ADDRESS=${IPV6_ADDRESS}
|
||||
|
||||
bool=true
|
||||
#Is the domain in the list?
|
||||
grep -e "address=\/${domain}\/" "${wildcardlist}" > /dev/null 2>&1 || bool=false
|
||||
|
||||
if [[ "${bool}" == false ]]; then
|
||||
if [[ "${verbose}" == true ]]; then
|
||||
echo "::: Adding $1 to wildcard blacklist..."
|
||||
fi
|
||||
reload=true
|
||||
echo "address=/$1/${IPV4_ADDRESS}" >> "${wildcardlist}"
|
||||
if [[ ${#IPV6_ADDRESS} > 0 ]] ; then
|
||||
echo "address=/$1/${IPV6_ADDRESS}" >> "${wildcardlist}"
|
||||
fi
|
||||
else
|
||||
if [[ "${verbose}" == true ]]; then
|
||||
echo "::: ${1} already exists in wildcard blacklist, no need to add!"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
RemoveDomain() {
|
||||
list="$2"
|
||||
domain=$(EscapeRegexp "$1")
|
||||
|
||||
if [[ "${list}" == "${whitelist}" || "${list}" == "${blacklist}" ]]; then
|
||||
|
||||
bool=true
|
||||
#Is it in the list? Logic follows that if its whitelisted it should not be blacklisted and vice versa
|
||||
grep -Ex -q "${domain}" "${list}" > /dev/null 2>&1 || bool=false
|
||||
if [[ "${bool}" == true ]]; then
|
||||
# Remove it from the other one
|
||||
echo "::: Removing $1 from $list..."
|
||||
# /I flag: search case-insensitive
|
||||
sed -i "/${domain}/Id" "${list}"
|
||||
reload=true
|
||||
else
|
||||
if [[ "${verbose}" == true ]]; then
|
||||
echo "::: ${1} does not exist in ${list}, no need to remove!"
|
||||
fi
|
||||
fi
|
||||
|
||||
elif [[ "${list}" == "${wildcardlist}" ]]; then
|
||||
|
||||
bool=true
|
||||
#Is it in the list?
|
||||
grep -e "address=\/${domain}\/" "${wildcardlist}" > /dev/null 2>&1 || bool=false
|
||||
if [[ "${bool}" == true ]]; then
|
||||
# Remove it from the other one
|
||||
echo "::: Removing $1 from $list..."
|
||||
# /I flag: search case-insensitive
|
||||
sed -i "/address=\/${domain}/Id" "${list}"
|
||||
reload=true
|
||||
else
|
||||
if [[ "${verbose}" == true ]]; then
|
||||
echo "::: ${1} does not exist in ${list}, no need to remove!"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
Reload() {
|
||||
# Reload hosts file
|
||||
pihole -g -sd
|
||||
}
|
||||
|
||||
Displaylist() {
|
||||
if [[ ${listMain} == ${whitelist} ]]; then
|
||||
string="gravity resistant domains"
|
||||
else
|
||||
string="domains caught in the sinkhole"
|
||||
fi
|
||||
verbose=false
|
||||
echo -e " Displaying $string \n"
|
||||
count=1
|
||||
while IFS= read -r RD; do
|
||||
echo "${count}: ${RD}"
|
||||
count=$((count+1))
|
||||
done < "${listMain}"
|
||||
exit 0;
|
||||
}
|
||||
|
||||
for var in "$@"; do
|
||||
case "${var}" in
|
||||
"-w" | "whitelist" ) listMain="${whitelist}"; listAlt="${blacklist}";;
|
||||
"-b" | "blacklist" ) listMain="${blacklist}"; listAlt="${whitelist}";;
|
||||
"-wild" | "wildcard" ) listMain="${wildcardlist}";;
|
||||
"-nr"| "--noreload" ) reload=false;;
|
||||
"-d" | "--delmode" ) addmode=false;;
|
||||
"-f" | "--force" ) force=true;;
|
||||
"-q" | "--quiet" ) verbose=false;;
|
||||
"-h" | "--help" ) helpFunc;;
|
||||
"-l" | "--list" ) Displaylist;;
|
||||
* ) HandleOther "${var}";;
|
||||
esac
|
||||
done
|
||||
|
||||
shift
|
||||
|
||||
if [[ $# = 0 ]]; then
|
||||
helpFunc
|
||||
fi
|
||||
|
||||
PoplistFile
|
||||
|
||||
if ${reload}; then
|
||||
Reload
|
||||
fi
|
@@ -1,361 +1,442 @@
|
||||
#!/usr/bin/env bash
|
||||
# Pi-hole: A black hole for Internet advertisements
|
||||
# (c) 2015, 2016 by Jacob Salmela
|
||||
# Network-wide ad blocking via your Raspberry Pi
|
||||
# http://pi-hole.net
|
||||
# Generates pihole_debug.log in /var/log/ to be used for troubleshooting.
|
||||
# (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
# Network-wide ad blocking via your own hardware.
|
||||
#
|
||||
# Pi-hole is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
# Generates pihole_debug.log to be used for troubleshooting.
|
||||
#
|
||||
# This file is copyright under the latest version of the EUPL.
|
||||
# Please see LICENSE file for your rights under this license.
|
||||
|
||||
|
||||
|
||||
set -o pipefail
|
||||
|
||||
######## GLOBAL VARS ########
|
||||
VARSFILE="/etc/pihole/setupVars.conf"
|
||||
DEBUG_LOG="/var/log/pihole_debug.log"
|
||||
DNSMASQFILE="/etc/dnsmasq.conf"
|
||||
PIHOLECONFFILE="/etc/dnsmasq.d/01-pihole.conf"
|
||||
DNSMASQCONFDIR="/etc/dnsmasq.d/*"
|
||||
LIGHTTPDFILE="/etc/lighttpd/lighttpd.conf"
|
||||
LIGHTTPDERRFILE="/var/log/lighttpd/error.log"
|
||||
GRAVITYFILE="/etc/pihole/gravity.list"
|
||||
HOSTSFILE="/etc/hosts"
|
||||
WHITELISTFILE="/etc/pihole/whitelist.txt"
|
||||
BLACKLISTFILE="/etc/pihole/blacklist.txt"
|
||||
ADLISTSFILE="/etc/pihole/adlists.list"
|
||||
ADLISTFILE="/etc/pihole/adlists.list"
|
||||
PIHOLELOG="/var/log/pihole.log"
|
||||
WHITELISTMATCHES="/tmp/whitelistmatches.list"
|
||||
|
||||
|
||||
######## FIRST CHECK ########
|
||||
# Must be root to debug
|
||||
if [[ $EUID -eq 0 ]]; then
|
||||
echo "::: You are root... Beginning debug!"
|
||||
else
|
||||
echo "::: Sudo will be used for debugging."
|
||||
# Check if sudo is actually installed
|
||||
if [ -x "$(command -v sudo)" ]; then
|
||||
export SUDO="sudo"
|
||||
else
|
||||
echo "::: Please install sudo or run this as root."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
TIMEOUT=60
|
||||
# Header info and introduction
|
||||
cat << EOM
|
||||
::: Beginning Pi-hole debug at $(date)!
|
||||
:::
|
||||
::: This process collects information from your Pi-hole, and optionally uploads
|
||||
::: it to a unique and random directory on tricorder.pi-hole.net.
|
||||
:::
|
||||
::: NOTE: All log files auto-delete after 48 hours and ONLY the Pi-hole developers
|
||||
::: can access your data via the given token. We have taken these extra steps to
|
||||
::: secure your data and will work to further reduce any personal information gathered.
|
||||
:::
|
||||
::: Please read and note any issues, and follow any directions advised during this process.
|
||||
EOM
|
||||
|
||||
# Ensure the file exists, create if not, clear if exists.
|
||||
if [ ! -f "$DEBUG_LOG" ]; then
|
||||
${SUDO} touch ${DEBUG_LOG}
|
||||
${SUDO} chmod 644 ${DEBUG_LOG}
|
||||
${SUDO} chown "$USER":root ${DEBUG_LOG}
|
||||
else
|
||||
truncate -s 0 ${DEBUG_LOG}
|
||||
fi
|
||||
truncate --size=0 "${DEBUG_LOG}"
|
||||
chmod 644 ${DEBUG_LOG}
|
||||
chown "$USER":pihole ${DEBUG_LOG}
|
||||
|
||||
source ${VARSFILE}
|
||||
|
||||
### Private functions exist here ###
|
||||
function versionCheck {
|
||||
echo "#######################################" >> ${DEBUG_LOG}
|
||||
echo "########## Versions Section ###########" >> ${DEBUG_LOG}
|
||||
echo "#######################################" >> ${DEBUG_LOG}
|
||||
|
||||
TMP=$(cd /etc/.pihole/ && git describe --tags --abbrev=0)
|
||||
echo "Pi-hole Version: $TMP" >> ${DEBUG_LOG}
|
||||
|
||||
TMP=$(cd /var/www/html/admin && git describe --tags --abbrev=0)
|
||||
echo "WebUI Version: $TMP" >> ${DEBUG_LOG}
|
||||
echo >> ${DEBUG_LOG}
|
||||
log_write() {
|
||||
echo "${1}" >> "${DEBUG_LOG}"
|
||||
}
|
||||
|
||||
function distroCheck {
|
||||
echo "#######################################" >> ${DEBUG_LOG}
|
||||
echo "######## Distribution Section #########" >> ${DEBUG_LOG}
|
||||
echo "#######################################" >> ${DEBUG_LOG}
|
||||
|
||||
TMP=$(cat /etc/*release || echo "Failed to find release")
|
||||
echo "Distribution Version: $TMP" >> ${DEBUG_LOG}
|
||||
}
|
||||
|
||||
function compareWhitelist {
|
||||
if [ ! -f "$WHITELISTMATCHES" ]; then
|
||||
${SUDO} touch ${WHITELISTMATCHES}
|
||||
${SUDO} chmod 644 ${WHITELISTMATCHES}
|
||||
${SUDO} chown "$USER":root ${WHITELISTMATCHES}
|
||||
else
|
||||
truncate -s 0 ${WHITELISTMATCHES}
|
||||
fi
|
||||
|
||||
echo "#######################################" >> ${DEBUG_LOG}
|
||||
echo "######## Whitelist Comparison #########" >> ${DEBUG_LOG}
|
||||
echo "#######################################" >> ${DEBUG_LOG}
|
||||
while read -r line; do
|
||||
TMP=$(grep -w ".* $line$" "$GRAVITYFILE")
|
||||
if [ ! -z "$TMP" ]; then
|
||||
echo "$TMP" >> ${DEBUG_LOG}
|
||||
echo "$TMP" >> ${WHITELISTMATCHES}
|
||||
fi
|
||||
done < "$WHITELISTFILE"
|
||||
echo >> ${DEBUG_LOG}
|
||||
log_echo() {
|
||||
case ${1} in
|
||||
-n)
|
||||
echo -n "::: ${2}"
|
||||
log_write "${2}"
|
||||
;;
|
||||
-r)
|
||||
echo "::: ${2}"
|
||||
log_write "${2}"
|
||||
;;
|
||||
-l)
|
||||
echo "${2}"
|
||||
log_write "${2}"
|
||||
;;
|
||||
*)
|
||||
echo "::: ${1}"
|
||||
log_write "${1}"
|
||||
esac
|
||||
}
|
||||
|
||||
function compareBlacklist {
|
||||
echo "#######################################" >> ${DEBUG_LOG}
|
||||
echo "######## Blacklist Comparison #########" >> ${DEBUG_LOG}
|
||||
echo "#######################################" >> ${DEBUG_LOG}
|
||||
while read -r line; do
|
||||
if [ ! -z "$line" ]; then
|
||||
grep -w ".* $line$" "$GRAVITYFILE" >> ${DEBUG_LOG}
|
||||
fi
|
||||
done < "$BLACKLISTFILE"
|
||||
echo >> ${DEBUG_LOG}
|
||||
header_write() {
|
||||
log_echo ""
|
||||
log_echo "${1}"
|
||||
log_write ""
|
||||
}
|
||||
|
||||
function testNslookup {
|
||||
TESTURL="doubleclick.com"
|
||||
echo "#######################################" >> ${DEBUG_LOG}
|
||||
echo "############ NSLookup Test ############" >> ${DEBUG_LOG}
|
||||
echo "#######################################" >> ${DEBUG_LOG}
|
||||
file_parse() {
|
||||
while read -r line; do
|
||||
if [ ! -z "${line}" ]; then
|
||||
[[ "${line}" =~ ^#.*$ || ! "${line}" ]] && continue
|
||||
log_write "${line}"
|
||||
fi
|
||||
done < "${1}"
|
||||
log_write ""
|
||||
}
|
||||
|
||||
block_parse() {
|
||||
log_write "${1}"
|
||||
}
|
||||
|
||||
lsof_parse() {
|
||||
local user
|
||||
local process
|
||||
|
||||
user=$(echo ${1} | cut -f 3 -d ' ' | cut -c 2-)
|
||||
process=$(echo ${1} | cut -f 2 -d ' ' | cut -c 2-)
|
||||
[[ ${2} -eq ${process} ]] \
|
||||
&& echo "::: Correctly configured." \
|
||||
|| log_echo "::: Failure: Incorrectly configured daemon."
|
||||
|
||||
log_write "Found user ${user} with process ${process}"
|
||||
}
|
||||
|
||||
|
||||
version_check() {
|
||||
header_write "Detecting Installed Package Versions:"
|
||||
|
||||
local error_found
|
||||
error_found=0
|
||||
|
||||
local pi_hole_ver="$(cd /etc/.pihole/ && git describe --tags --abbrev=0)" \
|
||||
&& log_echo -r "Pi-hole: $pi_hole_ver" || (log_echo "Pi-hole git repository not detected." && error_found=1)
|
||||
local admin_ver="$(cd /var/www/html/admin && git describe --tags --abbrev=0)" \
|
||||
&& log_echo -r "WebUI: $admin_ver" || (log_echo "Pi-hole Admin Pages git repository not detected." && error_found=1)
|
||||
local light_ver="$(lighttpd -v |& head -n1 | cut -d " " -f1)" \
|
||||
&& log_echo -r "${light_ver}" || (log_echo "lighttpd not installed." && error_found=1)
|
||||
local php_ver="$(php -v |& head -n1)" \
|
||||
&& log_echo -r "${php_ver}" || (log_echo "PHP not installed." && error_found=1)
|
||||
|
||||
(local pi_hole_branch="$(cd /etc/.pihole/ && git rev-parse --abbrev-ref HEAD)" && log_echo -r "Pi-hole branch: ${pi_hole_branch}") || log_echo "Unable to obtain Pi-hole branch"
|
||||
(local pi_hole_rev="$(cd /etc/.pihole/ && git describe --long --dirty --tags)" && log_echo -r "Pi-hole rev: ${pi_hole_rev}") || log_echo "Unable to obtain Pi-hole revision"
|
||||
|
||||
(local admin_branch="$(cd /var/www/html/admin && git rev-parse --abbrev-ref HEAD)" && log_echo -r "AdminLTE branch: ${admin_branch}") || log_echo "Unable to obtain AdminLTE branch"
|
||||
(local admin_rev="$(cd /var/www/html/admin && git describe --long --dirty --tags)" && log_echo -r "AdminLTE rev: ${admin_rev}") || log_echo "Unable to obtain AdminLTE revision"
|
||||
|
||||
return "${error_found}"
|
||||
}
|
||||
|
||||
dir_check() {
|
||||
header_write "Detecting contents of ${1}:"
|
||||
for file in $1*; do
|
||||
header_write "File ${file} found"
|
||||
echo -n "::: Parsing..."
|
||||
file_parse "${file}"
|
||||
echo "done"
|
||||
done
|
||||
echo ":::"
|
||||
}
|
||||
|
||||
files_check() {
|
||||
#Check non-zero length existence of ${1}
|
||||
header_write "Detecting existence of ${1}:"
|
||||
local search_file="${1}"
|
||||
if [[ -s ${search_file} ]]; then
|
||||
echo -n "::: File exists, parsing..."
|
||||
file_parse "${search_file}"
|
||||
echo "done"
|
||||
return 0
|
||||
else
|
||||
log_echo "${1} not found!"
|
||||
return 1
|
||||
fi
|
||||
echo ":::"
|
||||
}
|
||||
|
||||
source_file() {
|
||||
local file_found=$(files_check "${1}") \
|
||||
&& (source "${1}" &> /dev/null && echo "${file_found} and was successfully sourced") \
|
||||
|| log_echo -l "${file_found} and could not be sourced"
|
||||
}
|
||||
|
||||
distro_check() {
|
||||
local soft_fail
|
||||
header_write "Detecting installed OS Distribution"
|
||||
soft_fail=0
|
||||
local distro="$(cat /etc/*release)" && block_parse "${distro}" || (log_echo "Distribution details not found." && soft_fail=1)
|
||||
return "${soft_fail}"
|
||||
}
|
||||
|
||||
processor_check() {
|
||||
header_write "Checking processor variety"
|
||||
log_write $(uname -m) && return 0 || return 1
|
||||
}
|
||||
|
||||
ipv6_check() {
|
||||
# Check if system is IPv6 enabled, for use in other functions
|
||||
if [[ $IPV6_ADDRESS ]]; then
|
||||
ls /proc/net/if_inet6 &>/dev/null
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
ip_check() {
|
||||
local protocol=${1}
|
||||
local gravity=${2}
|
||||
|
||||
local ip_addr_list="$(ip -${protocol} addr show dev ${PIHOLE_INTERFACE} | awk -F ' ' '{ for(i=1;i<=NF;i++) if ($i ~ '/^inet/') print $(i+1) }')"
|
||||
if [[ -n ${ip_addr_list} ]]; then
|
||||
log_write "IPv${protocol} on ${PIHOLE_INTERFACE}"
|
||||
log_write "Gravity configured for: ${2:-NOT CONFIGURED}"
|
||||
log_write "----"
|
||||
log_write "${ip_addr_list}"
|
||||
echo "::: IPv${protocol} addresses located on ${PIHOLE_INTERFACE}"
|
||||
ip_ping_check ${protocol}
|
||||
return $(( 0 + $? ))
|
||||
else
|
||||
log_echo "No IPv${protocol} found on ${PIHOLE_INTERFACE}"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
ip_ping_check() {
|
||||
local protocol=${1}
|
||||
local cmd
|
||||
|
||||
if [[ ${protocol} == "6" ]]; then
|
||||
cmd="ping6"
|
||||
g_addr="2001:4860:4860::8888"
|
||||
else
|
||||
cmd="ping"
|
||||
g_addr="8.8.8.8"
|
||||
fi
|
||||
|
||||
local ip_def_gateway=$(ip -${protocol} route | grep default | cut -d ' ' -f 3)
|
||||
if [[ -n ${ip_def_gateway} ]]; then
|
||||
echo -n "::: Pinging default IPv${protocol} gateway: "
|
||||
if ! ping_gateway="$(${cmd} -q -W 3 -c 3 -n ${ip_def_gateway} -I ${PIHOLE_INTERFACE} | tail -n 3)"; then
|
||||
echo "Gateway did not respond."
|
||||
return 1
|
||||
else
|
||||
echo "Gateway responded."
|
||||
log_write "${ping_gateway}"
|
||||
fi
|
||||
echo -n "::: Pinging Internet via IPv${protocol}: "
|
||||
if ! ping_inet="$(${cmd} -q -W 3 -c 3 -n ${g_addr} -I ${PIHOLE_INTERFACE} | tail -n 3)"; then
|
||||
echo "Query did not respond."
|
||||
return 1
|
||||
else
|
||||
echo "Query responded."
|
||||
log_write "${ping_inet}"
|
||||
fi
|
||||
else
|
||||
log_echo " No gateway detected."
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
port_check() {
|
||||
local lsof_value
|
||||
|
||||
lsof_value=$(lsof -i ${1}:${2} -FcL | tr '\n' ' ') \
|
||||
&& lsof_parse "${lsof_value}" "${3}" \
|
||||
|| log_echo "Failure: IPv${1} Port not in use"
|
||||
}
|
||||
|
||||
daemon_check() {
|
||||
# Check for daemon ${1} on port ${2}
|
||||
header_write "Daemon Process Information"
|
||||
|
||||
echo "::: Checking ${2} port for ${1} listener."
|
||||
|
||||
if [[ ${IPV6_READY} ]]; then
|
||||
port_check 6 "${2}" "${1}"
|
||||
fi
|
||||
lsof_value=$(lsof -i 4:${2} -FcL | tr '\n' ' ') \
|
||||
port_check 4 "${2}" "${1}"
|
||||
}
|
||||
|
||||
testResolver() {
|
||||
header_write "Resolver Functions Check"
|
||||
|
||||
# Find a blocked url that has not been whitelisted.
|
||||
if [ -s "$WHITELISTMATCHES" ]; then
|
||||
TESTURL="doubleclick.com"
|
||||
if [ -s "${WHITELISTMATCHES}" ]; then
|
||||
while read -r line; do
|
||||
CUTURL=${line#*" "}
|
||||
if [ "$CUTURL" != "Pi-Hole.IsWorking.OK" ]; then
|
||||
if [ "${CUTURL}" != "Pi-Hole.IsWorking.OK" ]; then
|
||||
while read -r line2; do
|
||||
CUTURL2=${line2#*" "}
|
||||
if [ "$CUTURL" != "$CUTURL2" ]; then
|
||||
TESTURL="$CUTURL"
|
||||
if [ "${CUTURL}" != "${CUTURL2}" ]; then
|
||||
TESTURL="${CUTURL}"
|
||||
break 2
|
||||
fi
|
||||
done < "$WHITELISTMATCHES"
|
||||
done < "${WHITELISTMATCHES}"
|
||||
fi
|
||||
done < "$GRAVITYFILE"
|
||||
done < "${GRAVITYFILE}"
|
||||
fi
|
||||
|
||||
echo "NSLOOKUP of $TESTURL from PiHole:" >> ${DEBUG_LOG}
|
||||
nslookup "$TESTURL" >> ${DEBUG_LOG}
|
||||
echo >> ${DEBUG_LOG}
|
||||
echo "NSLOOKUP of $TESTURL from 8.8.8.8:" >> ${DEBUG_LOG}
|
||||
nslookup "$TESTURL" 8.8.8.8 >> ${DEBUG_LOG}
|
||||
echo >> ${DEBUG_LOG}
|
||||
log_write "Resolution of ${TESTURL} from Pi-hole:"
|
||||
LOCALDIG=$(dig "${TESTURL}" @127.0.0.1)
|
||||
if [[ $? = 0 ]]; then
|
||||
log_write "${LOCALDIG}"
|
||||
else
|
||||
log_write "Failed to resolve ${TESTURL} on Pi-hole"
|
||||
fi
|
||||
log_write ""
|
||||
|
||||
|
||||
log_write "Resolution of ${TESTURL} from 8.8.8.8:"
|
||||
REMOTEDIG=$(dig "${TESTURL}" @8.8.8.8)
|
||||
if [[ $? = 0 ]]; then
|
||||
log_write "${REMOTEDIG}"
|
||||
else
|
||||
log_write "Failed to resolve ${TESTURL} on 8.8.8.8"
|
||||
fi
|
||||
log_write ""
|
||||
|
||||
log_write "Pi-hole dnsmasq specific records lookups"
|
||||
log_write "Cache Size:"
|
||||
dig +short chaos txt cachesize.bind >> ${DEBUG_LOG}
|
||||
log_write "Upstream Servers:"
|
||||
dig +short chaos txt servers.bind >> ${DEBUG_LOG}
|
||||
log_write ""
|
||||
}
|
||||
|
||||
function checkProcesses {
|
||||
echo "#######################################" >> ${DEBUG_LOG}
|
||||
echo "########### Processes Check ###########" >> ${DEBUG_LOG}
|
||||
echo "#######################################" >> ${DEBUG_LOG}
|
||||
echo ":::"
|
||||
echo "::: Logging status of lighttpd and dnsmasq..."
|
||||
checkProcesses() {
|
||||
header_write "Processes Check"
|
||||
|
||||
echo "::: Logging status of lighttpd and dnsmasq..."
|
||||
PROCESSES=( lighttpd dnsmasq )
|
||||
for i in "${PROCESSES[@]}"
|
||||
do
|
||||
echo "" >> ${DEBUG_LOG}
|
||||
echo -n "$i" >> "$DEBUG_LOG"
|
||||
echo " processes status:" >> ${DEBUG_LOG}
|
||||
${SUDO} systemctl -l status "$i" >> "$DEBUG_LOG"
|
||||
for i in "${PROCESSES[@]}"; do
|
||||
log_write ""
|
||||
log_write "${i}"
|
||||
log_write " processes status:"
|
||||
systemctl -l status "${i}" >> "${DEBUG_LOG}"
|
||||
done
|
||||
log_write ""
|
||||
}
|
||||
|
||||
function debugLighttpd {
|
||||
echo "::: Writing lighttpd to debug log..."
|
||||
echo "#######################################" >> ${DEBUG_LOG}
|
||||
echo "############ lighttpd.conf ############" >> ${DEBUG_LOG}
|
||||
echo "#######################################" >> ${DEBUG_LOG}
|
||||
if [ -e "$LIGHTTPDFILE" ]
|
||||
then
|
||||
while read -r line; do
|
||||
if [ ! -z "$line" ]; then
|
||||
[[ "$line" =~ ^#.*$ ]] && continue
|
||||
echo "$line" >> ${DEBUG_LOG}
|
||||
fi
|
||||
done < "$LIGHTTPDFILE"
|
||||
echo >> ${DEBUG_LOG}
|
||||
else
|
||||
echo "No lighttpd.conf file found!" >> ${DEBUG_LOG}
|
||||
printf ":::\tNo lighttpd.conf file found\n"
|
||||
fi
|
||||
|
||||
if [ -e "$LIGHTTPDERRFILE" ]
|
||||
then
|
||||
echo "#######################################" >> ${DEBUG_LOG}
|
||||
echo "######### lighttpd error.log ##########" >> ${DEBUG_LOG}
|
||||
echo "#######################################" >> ${DEBUG_LOG}
|
||||
cat "$LIGHTTPDERRFILE" >> ${DEBUG_LOG}
|
||||
else
|
||||
echo "No lighttpd error.log file found!" >> ${DEBUG_LOG}
|
||||
printf ":::\tNo lighttpd error.log file found\n"
|
||||
fi
|
||||
echo >> ${DEBUG_LOG}
|
||||
debugLighttpd() {
|
||||
echo "::: Checking for necessary lighttpd files."
|
||||
files_check "${LIGHTTPDFILE}"
|
||||
files_check "${LIGHTTPDERRFILE}"
|
||||
echo ":::"
|
||||
}
|
||||
|
||||
countdown() {
|
||||
local tuvix
|
||||
tuvix=${TIMEOUT}
|
||||
printf "::: Logging will automatically teminate in %s seconds\n" "${TIMEOUT}"
|
||||
while [ $tuvix -ge 1 ]
|
||||
do
|
||||
printf ":::\t%s seconds left. " "${tuvix}"
|
||||
if [[ -z "${WEBCALL}" ]]; then
|
||||
printf "\r"
|
||||
else
|
||||
printf "\n"
|
||||
fi
|
||||
sleep 5
|
||||
tuvix=$(( tuvix - 5 ))
|
||||
done
|
||||
}
|
||||
### END FUNCTIONS ###
|
||||
|
||||
### Check Pi internet connections ###
|
||||
# Log the IP addresses of this Pi
|
||||
IPADDR=$(${SUDO} ifconfig | perl -nle 's/dr:(\S+)/print $1/e')
|
||||
echo "::: Writing local IPs to debug log"
|
||||
echo "IP Addresses of this Pi:" >> ${DEBUG_LOG}
|
||||
echo "$IPADDR" >> ${DEBUG_LOG}
|
||||
echo >> ${DEBUG_LOG}
|
||||
# Gather version of required packages / repositories
|
||||
version_check || echo "REQUIRED FILES MISSING"
|
||||
# Check for newer setupVars storage file
|
||||
source_file "/etc/pihole/setupVars.conf"
|
||||
# Gather information about the running distribution
|
||||
distro_check || echo "Distro Check soft fail"
|
||||
# Gather processor type
|
||||
processor_check || echo "Processor Check soft fail"
|
||||
|
||||
# Check if we can connect to the local gateway
|
||||
GATEWAY_CHECK=$(ping -q -w 1 -c 1 "$(ip r | grep default | cut -d ' ' -f 3)" > /dev/null && echo ok || echo error)
|
||||
echo "Gateway check:" >> ${DEBUG_LOG}
|
||||
echo "$GATEWAY_CHECK" >> ${DEBUG_LOG}
|
||||
echo >> ${DEBUG_LOG}
|
||||
ip_check 6 ${IPV6_ADDRESS}
|
||||
ip_check 4 ${IPV4_ADDRESS}
|
||||
|
||||
versionCheck
|
||||
distroCheck
|
||||
compareWhitelist
|
||||
compareBlacklist
|
||||
testNslookup
|
||||
daemon_check lighttpd http
|
||||
daemon_check dnsmasq domain
|
||||
checkProcesses
|
||||
testResolver
|
||||
debugLighttpd
|
||||
|
||||
echo "::: Writing dnsmasq.conf to debug log..."
|
||||
echo "#######################################" >> ${DEBUG_LOG}
|
||||
echo "############### Dnsmasq ###############" >> ${DEBUG_LOG}
|
||||
echo "#######################################" >> ${DEBUG_LOG}
|
||||
if [ -e "$DNSMASQFILE" ]
|
||||
then
|
||||
#cat $DNSMASQFILE >> $DEBUG_LOG
|
||||
while read -r line; do
|
||||
if [ ! -z "$line" ]; then
|
||||
[[ "$line" =~ ^#.*$ ]] && continue
|
||||
echo "$line" >> ${DEBUG_LOG}
|
||||
fi
|
||||
done < "$DNSMASQFILE"
|
||||
echo >> ${DEBUG_LOG}
|
||||
else
|
||||
echo "No dnsmasq.conf file found!" >> ${DEBUG_LOG}
|
||||
printf ":::\tNo dnsmasq.conf file found!\n"
|
||||
fi
|
||||
files_check "${DNSMASQFILE}"
|
||||
dir_check "${DNSMASQCONFDIR}"
|
||||
files_check "${WHITELISTFILE}"
|
||||
files_check "${BLACKLISTFILE}"
|
||||
files_check "${ADLISTFILE}"
|
||||
|
||||
echo "::: Writing 01-pihole.conf to debug log..."
|
||||
echo "#######################################" >> ${DEBUG_LOG}
|
||||
echo "########### 01-pihole.conf ############" >> ${DEBUG_LOG}
|
||||
echo "#######################################" >> ${DEBUG_LOG}
|
||||
if [ -e "$PIHOLECONFFILE" ]
|
||||
then
|
||||
while read -r line; do
|
||||
if [ ! -z "$line" ]; then
|
||||
[[ "$line" =~ ^#.*$ ]] && continue
|
||||
echo "$line" >> ${DEBUG_LOG}
|
||||
fi
|
||||
done < "$PIHOLECONFFILE"
|
||||
echo >> ${DEBUG_LOG}
|
||||
else
|
||||
echo "No 01-pihole.conf file found!" >> ${DEBUG_LOG}
|
||||
printf ":::\tNo 01-pihole.conf file found\n"
|
||||
fi
|
||||
|
||||
echo "::: Writing size of gravity.list to debug log..."
|
||||
echo "#######################################" >> ${DEBUG_LOG}
|
||||
echo "############ gravity.list #############" >> ${DEBUG_LOG}
|
||||
echo "#######################################" >> ${DEBUG_LOG}
|
||||
if [ -e "$GRAVITYFILE" ]
|
||||
then
|
||||
wc -l "$GRAVITYFILE" >> ${DEBUG_LOG}
|
||||
echo >> ${DEBUG_LOG}
|
||||
else
|
||||
echo "No gravity.list file found!" >> ${DEBUG_LOG}
|
||||
printf ":::\tNo gravity.list file found\n"
|
||||
fi
|
||||
header_write "Analyzing gravity.list"
|
||||
|
||||
# Write the hostname output to compare against entries in /etc/hosts, which is logged next
|
||||
echo "Hostname of this pihole is: " >> ${DEBUG_LOG}
|
||||
hostname >> ${DEBUG_LOG}
|
||||
gravity_length=$(grep -c ^ "${GRAVITYFILE}") \
|
||||
&& log_write "${GRAVITYFILE} is ${gravity_length} lines long." \
|
||||
|| log_echo "Warning: No gravity.list file found!"
|
||||
|
||||
echo "::: Writing hosts file to debug log..."
|
||||
echo "#######################################" >> ${DEBUG_LOG}
|
||||
echo "################ Hosts ################" >> ${DEBUG_LOG}
|
||||
echo "#######################################" >> ${DEBUG_LOG}
|
||||
if [ -e "$HOSTSFILE" ]
|
||||
then
|
||||
cat "$HOSTSFILE" >> ${DEBUG_LOG}
|
||||
echo >> ${DEBUG_LOG}
|
||||
else
|
||||
echo "No hosts file found!" >> ${DEBUG_LOG}
|
||||
printf ":::\tNo hosts file found!\n"
|
||||
fi
|
||||
header_write "Analyzing pihole.log"
|
||||
|
||||
### PiHole application specific logging ###
|
||||
echo "::: Writing whitelist to debug log..."
|
||||
echo "#######################################" >> ${DEBUG_LOG}
|
||||
echo "############## Whitelist ##############" >> ${DEBUG_LOG}
|
||||
echo "#######################################" >> ${DEBUG_LOG}
|
||||
if [ -e "$WHITELISTFILE" ]
|
||||
then
|
||||
cat "$WHITELISTFILE" >> ${DEBUG_LOG}
|
||||
echo >> ${DEBUG_LOG}
|
||||
else
|
||||
echo "No whitelist.txt file found!" >> ${DEBUG_LOG}
|
||||
printf ":::\tNo whitelist.txt file found!\n"
|
||||
fi
|
||||
pihole_length=$(grep -c ^ "${PIHOLELOG}") \
|
||||
&& log_write "${PIHOLELOG} is ${pihole_length} lines long." \
|
||||
|| log_echo "Warning: No pihole.log file found!"
|
||||
|
||||
echo "::: Writing blacklist to debug log..."
|
||||
echo "#######################################" >> ${DEBUG_LOG}
|
||||
echo "############## Blacklist ##############" >> ${DEBUG_LOG}
|
||||
echo "#######################################" >> ${DEBUG_LOG}
|
||||
if [ -e "$BLACKLISTFILE" ]
|
||||
then
|
||||
cat "$BLACKLISTFILE" >> ${DEBUG_LOG}
|
||||
echo >> ${DEBUG_LOG}
|
||||
else
|
||||
echo "No blacklist.txt file found!" >> ${DEBUG_LOG}
|
||||
printf ":::\tNo blacklist.txt file found!\n"
|
||||
fi
|
||||
|
||||
echo "::: Writing adlists.list to debug log..."
|
||||
echo "#######################################" >> ${DEBUG_LOG}
|
||||
echo "############ adlists.list #############" >> ${DEBUG_LOG}
|
||||
echo "#######################################" >> ${DEBUG_LOG}
|
||||
if [ -e "$ADLISTSFILE" ]
|
||||
then
|
||||
cat "$ADLISTSFILE" >> ${DEBUG_LOG}
|
||||
echo >> ${DEBUG_LOG}
|
||||
else
|
||||
echo "No adlists.list file found... using adlists.default!" >> ${DEBUG_LOG}
|
||||
printf ":::\tNo adlists.list file found... using adlists.default!\n"
|
||||
fi
|
||||
pihole_size=$(du -h "${PIHOLELOG}" | awk '{ print $1 }') \
|
||||
&& log_write "${PIHOLELOG} is ${pihole_size}." \
|
||||
|| log_echo "Warning: No pihole.log file found!"
|
||||
|
||||
|
||||
# Continuously append the pihole.log file to the pihole_debug.log file
|
||||
function dumpPiHoleLog {
|
||||
dumpPiHoleLog() {
|
||||
trap '{ echo -e "\n::: Finishing debug write from interrupt... Quitting!" ; exit 1; }' INT
|
||||
echo -e "::: Writing current pihole traffic to debug log...\n:::\tTry loading any/all sites that you are having trouble with now... \n:::\t(Press ctrl+C to finish)"
|
||||
echo "#######################################" >> ${DEBUG_LOG}
|
||||
echo "############# pihole.log ##############" >> ${DEBUG_LOG}
|
||||
echo "#######################################" >> ${DEBUG_LOG}
|
||||
if [ -e "$PIHOLELOG" ]
|
||||
then
|
||||
while true; do
|
||||
tail -f "$PIHOLELOG" >> ${DEBUG_LOG}
|
||||
echo >> ${DEBUG_LOG}
|
||||
done
|
||||
echo "::: "
|
||||
echo "::: --= User Action Required =--"
|
||||
echo -e "::: Try loading a site that you are having trouble with now from a client web browser.. \n:::\t(Press CTRL+C to finish logging.)"
|
||||
header_write "pihole.log"
|
||||
if [ -e "${PIHOLELOG}" ]; then
|
||||
# Dummy process to use for flagging down tail to terminate
|
||||
countdown &
|
||||
tail -n0 -f --pid=$! "${PIHOLELOG}" >> ${DEBUG_LOG}
|
||||
else
|
||||
echo "No pihole.log file found!" >> ${DEBUG_LOG}
|
||||
log_write "No pihole.log file found!"
|
||||
printf ":::\tNo pihole.log file found!\n"
|
||||
fi
|
||||
}
|
||||
|
||||
# Anything to be done after capturing of pihole.log terminates
|
||||
function finalWork {
|
||||
echo "::: Finshed debugging!"
|
||||
echo "::: The degug log can be uploaded to Termbin.com for easier sharing."
|
||||
read -r -p "::: Would you like to upload the log? [y/N] " response
|
||||
case ${response} in
|
||||
[yY][eE][sS]|[yY])
|
||||
TERMBIN=$(cat /var/log/pihole_debug.log | nc termbin.com 9999)
|
||||
;;
|
||||
*)
|
||||
echo "::: Log will NOT be uploaded to Termbin."
|
||||
;;
|
||||
esac
|
||||
|
||||
# Check if termbin.com is reachable. When it's not, point to local log instead
|
||||
if [ -n "$TERMBIN" ]
|
||||
then
|
||||
echo "::: Debug log can be found at : $TERMBIN"
|
||||
else
|
||||
echo "::: Debug log can be found at : /var/log/pihole_debug.log"
|
||||
fi
|
||||
finalWork() {
|
||||
local tricorder
|
||||
echo "::: Finshed debugging!"
|
||||
echo "::: The debug log can be uploaded to tricorder.pi-hole.net for sharing with developers only."
|
||||
if [[ "${AUTOMATED}" ]]; then
|
||||
echo "::: Debug script running in automated mode, uploading log to tricorder..."
|
||||
tricorder=$(cat /var/log/pihole_debug.log | nc tricorder.pi-hole.net 9999)
|
||||
else
|
||||
read -r -p "::: Would you like to upload the log? [y/N] " response
|
||||
case ${response} in
|
||||
[yY][eE][sS]|[yY])
|
||||
tricorder=$(cat /var/log/pihole_debug.log | nc tricorder.pi-hole.net 9999)
|
||||
;;
|
||||
*)
|
||||
echo "::: Log will NOT be uploaded to tricorder."
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
# Check if tricorder.pi-hole.net is reachable and provide token.
|
||||
if [ -n "${tricorder}" ]; then
|
||||
echo "::: ---=== Your debug token is : ${tricorder} Please make a note of it. ===---"
|
||||
echo "::: Contact the Pi-hole team with your token for assistance."
|
||||
echo "::: Thank you."
|
||||
else
|
||||
echo "::: There was an error uploading your debug log."
|
||||
echo "::: Please try again or contact the Pi-hole team for assistance."
|
||||
fi
|
||||
echo "::: A local copy of the Debug log can be found at : /var/log/pihole_debug.log"
|
||||
}
|
||||
|
||||
trap finalWork EXIT
|
||||
|
@@ -1,15 +1,20 @@
|
||||
#!/usr/bin/env bash
|
||||
# Pi-hole: A black hole for Internet advertisements
|
||||
# (c) 2015, 2016 by Jacob Salmela
|
||||
# Network-wide ad blocking via your Raspberry Pi
|
||||
# http://pi-hole.net
|
||||
# (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
# Network-wide ad blocking via your own hardware.
|
||||
#
|
||||
# Flushes /var/log/pihole.log
|
||||
#
|
||||
# Pi-hole is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
# This file is copyright under the latest version of the EUPL.
|
||||
# Please see LICENSE file for your rights under this license.
|
||||
|
||||
|
||||
|
||||
echo -n "::: Flushing /var/log/pihole.log ..."
|
||||
truncate -s 0 /var/log/pihole.log
|
||||
# Test if logrotate is available on this system
|
||||
if command -v /usr/sbin/logrotate &> /dev/null; then
|
||||
/usr/sbin/logrotate --force /etc/pihole/logrotate
|
||||
else
|
||||
echo " " > /var/log/pihole.log
|
||||
fi
|
||||
echo "... done!"
|
||||
|
@@ -1,57 +1,42 @@
|
||||
#!/usr/bin/env bash
|
||||
# Pi-hole: A black hole for Internet advertisements
|
||||
# (c) 2015 by Jacob Salmela
|
||||
# Network-wide ad blocking via your Raspberry Pi
|
||||
# http://pi-hole.net
|
||||
# (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
# Network-wide ad blocking via your own hardware.
|
||||
#
|
||||
# Automatically configures the Pi to use the 2.8 LCD screen to display stats on it (also works over ssh)
|
||||
#
|
||||
# Pi-hole is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
# This file is copyright under the latest version of the EUPL.
|
||||
# Please see LICENSE file for your rights under this license.
|
||||
|
||||
|
||||
|
||||
############ FUNCTIONS ###########
|
||||
# Run this script as root or under sudo
|
||||
echo ":::"
|
||||
if [[ $EUID -eq 0 ]];then
|
||||
echo "::: You are root."
|
||||
else
|
||||
echo "::: sudo will be used."
|
||||
# Check if it is actually installed
|
||||
# If it isn't, exit because the install cannot complete
|
||||
if [ -x "$(command -v sudo)" ];then
|
||||
export SUDO="sudo"
|
||||
else
|
||||
echo "::: Please install sudo or run this script as root."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Borrowed from adafruit-pitft-helper < borrowed from raspi-config
|
||||
# https://github.com/adafruit/Adafruit-PiTFT-Helper/blob/master/adafruit-pitft-helper#L324-L334
|
||||
getInitSys() {
|
||||
if command -v systemctl > /dev/null && systemctl | grep -q '\-\.mount'; then
|
||||
SYSTEMD=1
|
||||
elif [ -f /etc/init.d/cron ] && [ ! -h /etc/init.d/cron ]; then
|
||||
SYSTEMD=0
|
||||
else
|
||||
echo "Unrecognised init system"
|
||||
return 1
|
||||
fi
|
||||
if command -v systemctl > /dev/null && systemctl | grep -q '\-\.mount'; then
|
||||
SYSTEMD=1
|
||||
elif [ -f /etc/init.d/cron ] && [ ! -h /etc/init.d/cron ]; then
|
||||
SYSTEMD=0
|
||||
else
|
||||
echo "Unrecognised init system"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Borrowed from adafruit-pitft-helper:
|
||||
# https://github.com/adafruit/Adafruit-PiTFT-Helper/blob/master/adafruit-pitft-helper#L274-L285
|
||||
autoLoginPiToConsole() {
|
||||
if [ -e /etc/init.d/lightdm ]; then
|
||||
if [ ${SYSTEMD} -eq 1 ]; then
|
||||
${SUDO} systemctl set-default multi-user.target
|
||||
${SUDO} ln -fs /etc/systemd/system/autologin@.service /etc/systemd/system/getty.target.wants/getty@tty1.service
|
||||
else
|
||||
${SUDO} update-rc.d lightdm disable 2
|
||||
${SUDO} sed /etc/inittab -i -e "s/1:2345:respawn:\/sbin\/getty --noclear 38400 tty1/1:2345:respawn:\/bin\/login -f pi tty1 <\/dev\/tty1 >\/dev\/tty1 2>&1/"
|
||||
fi
|
||||
fi
|
||||
if [ -e /etc/init.d/lightdm ]; then
|
||||
if [ ${SYSTEMD} -eq 1 ]; then
|
||||
systemctl set-default multi-user.target
|
||||
ln -fs /etc/systemd/system/autologin@.service /etc/systemd/system/getty.target.wants/getty@tty1.service
|
||||
else
|
||||
update-rc.d lightdm disable 2
|
||||
sed /etc/inittab -i -e "s/1:2345:respawn:\/sbin\/getty --noclear 38400 tty1/1:2345:respawn:\/bin\/login -f pi tty1 <\/dev\/tty1 >\/dev\/tty1 2>&1/"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
######### SCRIPT ###########
|
||||
@@ -66,23 +51,23 @@ echo /usr/local/bin/chronometer.sh >> /home/pi/.bashrc
|
||||
|
||||
# Set up the LCD screen based on Adafruits instuctions:
|
||||
# https://learn.adafruit.com/adafruit-pitft-28-inch-resistive-touchscreen-display-raspberry-pi/easy-install
|
||||
curl -SLs https://apt.adafruit.com/add-pin | ${SUDO} bash
|
||||
${SUDO} apt-get -y install raspberrypi-bootloader
|
||||
${SUDO} apt-get -y install adafruit-pitft-helper
|
||||
${SUDO} adafruit-pitft-helper -t 28r
|
||||
curl -SLs https://apt.adafruit.com/add-pin | bash
|
||||
apt-get -y install raspberrypi-bootloader
|
||||
apt-get -y install adafruit-pitft-helper
|
||||
adafruit-pitft-helper -t 28r
|
||||
|
||||
# Download the cmdline.txt file that prevents the screen from going blank after a period of time
|
||||
${SUDO} mv /boot/cmdline.txt /boot/cmdline.orig
|
||||
${SUDO} curl -o /boot/cmdline.txt https://raw.githubusercontent.com/pi-hole/pi-hole/master/advanced/cmdline.txt
|
||||
mv /boot/cmdline.txt /boot/cmdline.orig
|
||||
curl -o /boot/cmdline.txt https://raw.githubusercontent.com/pi-hole/pi-hole/master/advanced/cmdline.txt
|
||||
|
||||
# Back up the original file and download the new one
|
||||
${SUDO} mv /etc/default/console-setup /etc/default/console-setup.orig
|
||||
${SUDO} curl -o /etc/default/console-setup https://raw.githubusercontent.com/pi-hole/pi-hole/master/advanced/console-setup
|
||||
mv /etc/default/console-setup /etc/default/console-setup.orig
|
||||
curl -o /etc/default/console-setup https://raw.githubusercontent.com/pi-hole/pi-hole/master/advanced/console-setup
|
||||
|
||||
# Instantly apply the font change to the LCD screen
|
||||
${SUDO} setupcon
|
||||
setupcon
|
||||
|
||||
${SUDO} reboot
|
||||
reboot
|
||||
|
||||
# Start showing the stats on the screen by running the command on another tty:
|
||||
# http://unix.stackexchange.com/questions/170063/start-a-process-on-a-different-tty
|
||||
|
181
advanced/Scripts/update.sh
Executable file
181
advanced/Scripts/update.sh
Executable file
@@ -0,0 +1,181 @@
|
||||
#!/usr/bin/env bash
|
||||
# Pi-hole: A black hole for Internet advertisements
|
||||
# (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
# Network-wide ad blocking via your own hardware.
|
||||
#
|
||||
# Check Pi-hole core and admin pages versions and determine what
|
||||
# upgrade (if any) is required. Automatically updates and reinstalls
|
||||
# application if update is detected.
|
||||
#
|
||||
# This file is copyright under the latest version of the EUPL.
|
||||
# Please see LICENSE file for your rights under this license.
|
||||
|
||||
|
||||
|
||||
# Variables
|
||||
|
||||
readonly ADMIN_INTERFACE_GIT_URL="https://github.com/pi-hole/AdminLTE.git"
|
||||
readonly ADMIN_INTERFACE_DIR="/var/www/html/admin"
|
||||
readonly PI_HOLE_GIT_URL="https://github.com/pi-hole/pi-hole.git"
|
||||
readonly PI_HOLE_FILES_DIR="/etc/.pihole"
|
||||
|
||||
PH_TEST=true
|
||||
source ${PI_HOLE_FILES_DIR}/automated\ install/basic-install.sh
|
||||
|
||||
# is_repo() sourced from basic-install.sh
|
||||
# make_repo() sourced from basic-install.sh
|
||||
# update_repo() source from basic-install.sh
|
||||
# getGitFiles() sourced from basic-install.sh
|
||||
|
||||
GitCheckUpdateAvail() {
|
||||
local directory="${1}"
|
||||
curdir=$PWD
|
||||
cd "${directory}"
|
||||
|
||||
# Fetch latest changes in this repo
|
||||
git fetch --quiet origin
|
||||
|
||||
# @ alone is a shortcut for HEAD. Older versions of git
|
||||
# need @{0}
|
||||
LOCAL="$(git rev-parse @{0})"
|
||||
|
||||
# The suffix @{upstream} to a branchname
|
||||
# (short form <branchname>@{u}) refers
|
||||
# to the branch that the branch specified
|
||||
# by branchname is set to build on top of#
|
||||
# (configured with branch.<name>.remote and
|
||||
# branch.<name>.merge). A missing branchname
|
||||
# defaults to the current one.
|
||||
REMOTE="$(git rev-parse @{upstream})"
|
||||
|
||||
if [[ ${#LOCAL} == 0 ]]; then
|
||||
echo "::: Error: Local revision could not be obtained, ask Pi-hole support."
|
||||
echo "::: Additional debugging output:"
|
||||
git status
|
||||
exit
|
||||
fi
|
||||
if [[ ${#REMOTE} == 0 ]]; then
|
||||
echo "::: Error: Remote revision could not be obtained, ask Pi-hole support."
|
||||
echo "::: Additional debugging output:"
|
||||
git status
|
||||
exit
|
||||
fi
|
||||
|
||||
# Change back to original directory
|
||||
cd "${curdir}"
|
||||
|
||||
if [[ "${LOCAL}" != "${REMOTE}" ]]; then
|
||||
# Local branch is behind remote branch -> Update
|
||||
return 0
|
||||
else
|
||||
# Local branch is up-to-date or in a situation
|
||||
# where this updater cannot be used (like on a
|
||||
# branch that exists only locally)
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
main() {
|
||||
local pihole_version_current
|
||||
local web_version_current
|
||||
|
||||
#This is unlikely
|
||||
if ! is_repo "${PI_HOLE_FILES_DIR}" ; then
|
||||
echo "::: Critical Error: Core Pi-Hole repo is missing from system!"
|
||||
echo "::: Please re-run install script from https://github.com/pi-hole/pi-hole"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
echo "::: Checking for updates..."
|
||||
|
||||
if GitCheckUpdateAvail "${PI_HOLE_FILES_DIR}" ; then
|
||||
core_update=true
|
||||
echo "::: Pi-hole Core: update available"
|
||||
else
|
||||
core_update=false
|
||||
echo "::: Pi-hole Core: up to date"
|
||||
fi
|
||||
|
||||
if [[ ${INSTALL_WEB} == true ]]; then
|
||||
if ! is_repo "${ADMIN_INTERFACE_DIR}" ; then
|
||||
echo "::: Critical Error: Web Admin repo is missing from system!"
|
||||
echo "::: Please re-run install script from https://github.com/pi-hole/pi-hole"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
if GitCheckUpdateAvail "${ADMIN_INTERFACE_DIR}" ; then
|
||||
web_update=true
|
||||
echo "::: Web Interface: update available"
|
||||
else
|
||||
web_update=false
|
||||
echo "::: Web Interface: up to date"
|
||||
fi
|
||||
|
||||
# Logic
|
||||
# If Core up to date AND web up to date:
|
||||
# Do nothing
|
||||
# If Core up to date AND web NOT up to date:
|
||||
# Pull web repo
|
||||
# If Core NOT up to date AND web up to date:
|
||||
# pull pihole repo, run install --unattended -- reconfigure
|
||||
# if Core NOT up to date AND web NOT up to date:
|
||||
# pull pihole repo run install --unattended
|
||||
|
||||
if ! ${core_update} && ! ${web_update} ; then
|
||||
echo ":::"
|
||||
echo "::: Everything is up to date!"
|
||||
exit 0
|
||||
|
||||
elif ! ${core_update} && ${web_update} ; then
|
||||
echo ":::"
|
||||
echo "::: Pi-hole Web Admin files out of date"
|
||||
getGitFiles "${ADMIN_INTERFACE_DIR}" "${ADMIN_INTERFACE_GIT_URL}"
|
||||
|
||||
elif ${core_update} && ! ${web_update} ; then
|
||||
echo ":::"
|
||||
echo "::: Pi-hole core files out of date"
|
||||
getGitFiles "${PI_HOLE_FILES_DIR}" "${PI_HOLE_GIT_URL}"
|
||||
${PI_HOLE_FILES_DIR}/automated\ install/basic-install.sh --reconfigure --unattended || echo "Unable to complete update, contact Pi-hole" && exit 1
|
||||
|
||||
elif ${core_update} && ${web_update} ; then
|
||||
echo ":::"
|
||||
echo "::: Updating Everything"
|
||||
getGitFiles "${PI_HOLE_FILES_DIR}" "${PI_HOLE_GIT_URL}"
|
||||
${PI_HOLE_FILES_DIR}/automated\ install/basic-install.sh --unattended || echo "Unable to complete update, contact Pi-hole" && exit 1
|
||||
else
|
||||
echo "*** Update script has malfunctioned, fallthrough reached. Please contact support"
|
||||
exit 1
|
||||
fi
|
||||
else # Web Admin not installed, so only verify if core is up to date
|
||||
if ! ${core_update}; then
|
||||
echo ":::"
|
||||
echo "::: Everything is up to date!"
|
||||
exit 0
|
||||
else
|
||||
echo ":::"
|
||||
echo "::: Pi-hole core files out of date"
|
||||
getGitFiles "${PI_HOLE_FILES_DIR}" "${PI_HOLE_GIT_URL}"
|
||||
${PI_HOLE_FILES_DIR}/automated\ install/basic-install.sh --reconfigure --unattended || echo "Unable to complete update, contact Pi-hole" && exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "${web_update}" == true ]]; then
|
||||
web_version_current="$(/usr/local/bin/pihole version --admin --current)"
|
||||
echo ":::"
|
||||
echo "::: Web Admin version is now at ${web_version_current}"
|
||||
echo "::: If you had made any changes in '/var/www/html/admin/', they have been stashed using 'git stash'"
|
||||
fi
|
||||
|
||||
if [[ "${core_update}" == true ]]; then
|
||||
pihole_version_current="$(/usr/local/bin/pihole version --pihole --current)"
|
||||
echo ":::"
|
||||
echo "::: Pi-hole version is now at ${pihole_version_current}"
|
||||
echo "::: If you had made any changes in '/etc/.pihole/', they have been stashed using 'git stash'"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
exit 0
|
||||
|
||||
}
|
||||
|
||||
main
|
@@ -1,69 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Pi-hole: A black hole for Internet advertisements
|
||||
# (c) 2015, 2016 by Jacob Salmela
|
||||
# Network-wide ad blocking via your Raspberry Pi
|
||||
# http://pi-hole.net
|
||||
# Updates the Pi-hole web interface
|
||||
#
|
||||
# Pi-hole is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
WEB_INTERFACE_GIT_URL="https://github.com/pi-hole/AdminLTE.git"
|
||||
WEB_INTERFACE_DIR="/var/www/html/admin"
|
||||
|
||||
main() {
|
||||
prerequisites
|
||||
if ! is_repo; then
|
||||
make_repo
|
||||
fi
|
||||
update_repo
|
||||
}
|
||||
|
||||
prerequisites() {
|
||||
|
||||
# must be root to update
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
sudo bash "$0" "$@"
|
||||
exit $?
|
||||
fi
|
||||
|
||||
# web interface must already exist. this is a (lazy)
|
||||
# check to make sure pihole is actually installed.
|
||||
if [ ! -d "$WEB_INTERFACE_DIR" ]; then
|
||||
echo "$WEB_INTERFACE_DIR not found. Exiting."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! type "git" > /dev/null; then
|
||||
apt-get -y install git
|
||||
fi
|
||||
}
|
||||
|
||||
is_repo() {
|
||||
# if the web interface directory does not have a .git folder
|
||||
# it means its using the master.zip archive from the install
|
||||
# script.
|
||||
if [ ! -d "$WEB_INTERFACE_DIR/.git" ]; then
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
# removes the web interface installed from the master.zip archive and
|
||||
# replaces it with the current master branch from github
|
||||
make_repo() {
|
||||
# remove the non-repod interface and clone the interface
|
||||
rm -rf ${WEB_INTERFACE_DIR}
|
||||
git clone "$WEB_INTERFACE_GIT_URL" "$WEB_INTERFACE_DIR"
|
||||
}
|
||||
|
||||
# pulls the latest master branch from github
|
||||
update_repo() {
|
||||
# pull the latest commits
|
||||
cd "$WEB_INTERFACE_DIR"
|
||||
git pull
|
||||
}
|
||||
|
||||
main
|
110
advanced/Scripts/version.sh
Normal file → Executable file
110
advanced/Scripts/version.sh
Normal file → Executable file
@@ -1,20 +1,102 @@
|
||||
#!/usr/bin/env bash
|
||||
# Pi-hole: A black hole for Internet advertisements
|
||||
# (c) 2015, 2016 by Jacob Salmela
|
||||
# Network-wide ad blocking via your Raspberry Pi
|
||||
# http://pi-hole.net
|
||||
# Whitelists domains
|
||||
# (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
# Network-wide ad blocking via your own hardware.
|
||||
#
|
||||
# Pi-hole is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
# shows version numbers
|
||||
#
|
||||
# This file is copyright under the latest version of the EUPL.
|
||||
# Please see LICENSE file for your rights under this license.
|
||||
|
||||
piholeVersion=$(cd /etc/.pihole/ && git describe --tags --abbrev=0)
|
||||
webVersion=$(cd /var/www/html/admin/ && git describe --tags --abbrev=0)
|
||||
|
||||
piholeVersionLatest=$(curl -s https://api.github.com/repos/pi-hole/pi-hole/releases/latest | grep -Po '"tag_name":.*?[^\\]",' | perl -pe 's/"tag_name": "//; s/^"//; s/",$//')
|
||||
webVersionLatest=$(curl -s https://api.github.com/repos/pi-hole/AdminLTE/releases/latest | grep -Po '"tag_name":.*?[^\\]",' | perl -pe 's/"tag_name": "//; s/^"//; s/",$//')
|
||||
|
||||
echo "::: Pi-hole version is $piholeVersion (Latest version is $piholeVersionLatest)"
|
||||
echo "::: Web-Admin version is $webVersion (Latest version is $webVersionLatest)"
|
||||
# Flags:
|
||||
latest=false
|
||||
current=false
|
||||
|
||||
DEFAULT="-1"
|
||||
|
||||
normalOutput() {
|
||||
piholeVersion=$(cd /etc/.pihole/ && git describe --tags --abbrev=0)
|
||||
webVersion=$(cd /var/www/html/admin/ && git describe --tags --abbrev=0)
|
||||
|
||||
piholeVersionLatest=$(curl -s https://api.github.com/repos/pi-hole/pi-hole/releases/latest | grep -Po '"tag_name":.*?[^\\]",' | perl -pe 's/"tag_name": "//; s/^"//; s/",$//')
|
||||
webVersionLatest=$(curl -s https://api.github.com/repos/pi-hole/AdminLTE/releases/latest | grep -Po '"tag_name":.*?[^\\]",' | perl -pe 's/"tag_name": "//; s/^"//; s/",$//')
|
||||
|
||||
echo "::: Pi-hole version is ${piholeVersion} (Latest version is ${piholeVersionLatest:-${DEFAULT}})"
|
||||
echo "::: Web-Admin version is ${webVersion} (Latest version is ${webVersionLatest:-${DEFAULT}})"
|
||||
}
|
||||
|
||||
webOutput() {
|
||||
for var in "$@"; do
|
||||
case "${var}" in
|
||||
"-l" | "--latest" ) latest=true;;
|
||||
"-c" | "--current" ) current=true;;
|
||||
* ) echo "::: Invalid Option!"; exit 1;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ "${latest}" == true && "${current}" == false ]]; then
|
||||
webVersionLatest=$(curl -s https://api.github.com/repos/pi-hole/AdminLTE/releases/latest | grep -Po '"tag_name":.*?[^\\]",' | perl -pe 's/"tag_name": "//; s/^"//; s/",$//')
|
||||
echo "${webVersionLatest:--1}"
|
||||
elif [[ "${latest}" == false && "${current}" == true ]]; then
|
||||
webVersion=$(cd /var/www/html/admin/ && git describe --tags --abbrev=0)
|
||||
echo "${webVersion}"
|
||||
else
|
||||
webVersion=$(cd /var/www/html/admin/ && git describe --tags --abbrev=0)
|
||||
webVersionLatest=$(curl -s https://api.github.com/repos/pi-hole/AdminLTE/releases/latest | grep -Po '"tag_name":.*?[^\\]",' | perl -pe 's/"tag_name": "//; s/^"//; s/",$//')
|
||||
echo "::: Web-Admin version is ${webVersion} (Latest version is ${webVersionLatest:-${DEFAULT}})"
|
||||
fi
|
||||
}
|
||||
|
||||
coreOutput() {
|
||||
for var in "$@"; do
|
||||
case "${var}" in
|
||||
"-l" | "--latest" ) latest=true;;
|
||||
"-c" | "--current" ) current=true;;
|
||||
* ) echo "::: Invalid Option!"; exit 1;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ "${latest}" == true && "${current}" == false ]]; then
|
||||
piholeVersionLatest=$(curl -s https://api.github.com/repos/pi-hole/pi-hole/releases/latest | grep -Po '"tag_name":.*?[^\\]",' | perl -pe 's/"tag_name": "//; s/^"//; s/",$//')
|
||||
echo "${piholeVersionLatest:--1}"
|
||||
elif [[ "${latest}" == false && "${current}" == true ]]; then
|
||||
piholeVersion=$(cd /etc/.pihole/ && git describe --tags --abbrev=0)
|
||||
echo "${piholeVersion}"
|
||||
else
|
||||
piholeVersion=$(cd /etc/.pihole/ && git describe --tags --abbrev=0)
|
||||
piholeVersionLatest=$(curl -s https://api.github.com/repos/pi-hole/pi-hole/releases/latest | grep -Po '"tag_name":.*?[^\\]",' | perl -pe 's/"tag_name": "//; s/^"//; s/",$//')
|
||||
echo "::: Pi-hole version is ${piholeVersion} (Latest version is ${piholeVersionLatest:-${DEFAULT}})"
|
||||
fi
|
||||
}
|
||||
|
||||
helpFunc() {
|
||||
cat << EOM
|
||||
:::
|
||||
::: Show Pi-hole/Web Admin versions
|
||||
:::
|
||||
::: Usage: pihole -v [ -a | -p ] [ -l | -c ]
|
||||
:::
|
||||
::: Options:
|
||||
::: -a, --admin Show both current and latest versions of web admin
|
||||
::: -p, --pihole Show both current and latest versions of Pi-hole core files
|
||||
::: -l, --latest (Only after -a | -p) Return only latest version
|
||||
::: -c, --current (Only after -a | -p) Return only current version
|
||||
::: -h, --help Show this help dialog
|
||||
:::
|
||||
EOM
|
||||
exit 0
|
||||
}
|
||||
|
||||
if [[ $# = 0 ]]; then
|
||||
normalOutput
|
||||
fi
|
||||
|
||||
for var in "$@"; do
|
||||
case "${var}" in
|
||||
"-a" | "--admin" ) shift; webOutput "$@";;
|
||||
"-p" | "--pihole" ) shift; coreOutput "$@" ;;
|
||||
"-h" | "--help" ) helpFunc;;
|
||||
esac
|
||||
done
|
||||
|
447
advanced/Scripts/webpage.sh
Executable file
447
advanced/Scripts/webpage.sh
Executable file
@@ -0,0 +1,447 @@
|
||||
#!/usr/bin/env bash
|
||||
# Pi-hole: A black hole for Internet advertisements
|
||||
# (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
# Network-wide ad blocking via your own hardware.
|
||||
#
|
||||
# Web interface settings
|
||||
#
|
||||
# This file is copyright under the latest version of the EUPL.
|
||||
# Please see LICENSE file for your rights under this license.
|
||||
|
||||
|
||||
readonly setupVars="/etc/pihole/setupVars.conf"
|
||||
readonly dnsmasqconfig="/etc/dnsmasq.d/01-pihole.conf"
|
||||
readonly dhcpconfig="/etc/dnsmasq.d/02-pihole-dhcp.conf"
|
||||
# 03 -> wildcards
|
||||
readonly dhcpstaticconfig="/etc/dnsmasq.d/04-pihole-static-dhcp.conf"
|
||||
|
||||
helpFunc() {
|
||||
cat << EOM
|
||||
::: Set admin options for the web interface of pihole
|
||||
:::
|
||||
::: Usage: pihole -a [options]
|
||||
:::
|
||||
::: Options:
|
||||
::: -p, password Set web interface password, an empty input will remove any previously set password
|
||||
::: -c, celsius Set Celsius temperature unit
|
||||
::: -f, fahrenheit Set Fahrenheit temperature unit
|
||||
::: -k, kelvin Set Kelvin temperature unit
|
||||
::: -h, --help Show this help dialog
|
||||
::: -i, interface Setup interface listening behavior of dnsmasq
|
||||
::: pihole -a -i local : Listen on all interfaces, but allow only queries from
|
||||
::: devices that are at most one hop away (local devices)
|
||||
::: pihole -a -i single : Listen only on one interface (see PIHOLE_INTERFACE)
|
||||
::: pihole -a -i all : Listen on all interfaces, permit all origins
|
||||
EOM
|
||||
exit 0
|
||||
}
|
||||
|
||||
add_setting() {
|
||||
echo "${1}=${2}" >> "${setupVars}"
|
||||
}
|
||||
|
||||
delete_setting() {
|
||||
sed -i "/${1}/d" "${setupVars}"
|
||||
}
|
||||
|
||||
change_setting() {
|
||||
delete_setting "${1}"
|
||||
add_setting "${1}" "${2}"
|
||||
}
|
||||
|
||||
add_dnsmasq_setting() {
|
||||
if [[ "${2}" != "" ]]; then
|
||||
echo "${1}=${2}" >> "${dnsmasqconfig}"
|
||||
else
|
||||
echo "${1}" >> "${dnsmasqconfig}"
|
||||
fi
|
||||
}
|
||||
|
||||
delete_dnsmasq_setting() {
|
||||
sed -i "/${1}/d" "${dnsmasqconfig}"
|
||||
}
|
||||
|
||||
SetTemperatureUnit(){
|
||||
|
||||
change_setting "TEMPERATUREUNIT" "${unit}"
|
||||
|
||||
}
|
||||
|
||||
SetWebPassword(){
|
||||
|
||||
if [ "${SUDO_USER}" == "www-data" ]; then
|
||||
echo "Security measure: user www-data is not allowed to change webUI password!"
|
||||
echo "Exiting"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "${SUDO_USER}" == "lighttpd" ]; then
|
||||
echo "Security measure: user lighttpd is not allowed to change webUI password!"
|
||||
echo "Exiting"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Set password only if there is one to be set
|
||||
if (( ${#args[2]} > 0 )) ; then
|
||||
# Compute password hash twice to avoid rainbow table vulnerability
|
||||
hash=$(echo -n ${args[2]} | sha256sum | sed 's/\s.*$//')
|
||||
hash=$(echo -n ${hash} | sha256sum | sed 's/\s.*$//')
|
||||
# Save hash to file
|
||||
change_setting "WEBPASSWORD" "${hash}"
|
||||
echo "New password set"
|
||||
else
|
||||
change_setting "WEBPASSWORD" ""
|
||||
echo "Password removed"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
ProcessDNSSettings() {
|
||||
source "${setupVars}"
|
||||
|
||||
delete_dnsmasq_setting "server"
|
||||
|
||||
COUNTER=1
|
||||
while [[ 1 ]]; do
|
||||
var=PIHOLE_DNS_${COUNTER}
|
||||
if [ -z "${!var}" ]; then
|
||||
break;
|
||||
fi
|
||||
add_dnsmasq_setting "server" "${!var}"
|
||||
let COUNTER=COUNTER+1
|
||||
done
|
||||
|
||||
delete_dnsmasq_setting "domain-needed"
|
||||
|
||||
if [[ "${DNS_FQDN_REQUIRED}" == true ]]; then
|
||||
add_dnsmasq_setting "domain-needed"
|
||||
fi
|
||||
|
||||
delete_dnsmasq_setting "bogus-priv"
|
||||
|
||||
if [[ "${DNS_BOGUS_PRIV}" == true ]]; then
|
||||
add_dnsmasq_setting "bogus-priv"
|
||||
fi
|
||||
|
||||
delete_dnsmasq_setting "dnssec"
|
||||
delete_dnsmasq_setting "trust-anchor="
|
||||
|
||||
if [[ "${DNSSEC}" == true ]]; then
|
||||
echo "dnssec
|
||||
trust-anchor=.,19036,8,2,49AAC11D7B6F6446702E54A1607371607A1A41855200FD2CE1CDDE32F24E8FB5
|
||||
" >> "${dnsmasqconfig}"
|
||||
fi
|
||||
|
||||
delete_dnsmasq_setting "host-record"
|
||||
|
||||
if [ ! -z "${HOSTRECORD+x}" ]; then
|
||||
add_dnsmasq_setting "host-record" "${HOSTRECORD}"
|
||||
fi
|
||||
|
||||
# Setup interface listening behavior of dnsmasq
|
||||
delete_dnsmasq_setting "interface"
|
||||
delete_dnsmasq_setting "local-service"
|
||||
|
||||
if [[ "${DNSMASQ_LISTENING}" == "all" ]]; then
|
||||
# Listen on all interfaces, permit all origins
|
||||
add_dnsmasq_setting "except-interface" "nonexisting"
|
||||
elif [[ "${DNSMASQ_LISTENING}" == "local" ]]; then
|
||||
# Listen only on all interfaces, but only local subnets
|
||||
add_dnsmasq_setting "local-service"
|
||||
else
|
||||
# Listen only on one interface
|
||||
add_dnsmasq_setting "interface" "${PIHOLE_INTERFACE}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
SetDNSServers(){
|
||||
|
||||
# Save setting to file
|
||||
delete_setting "PIHOLE_DNS"
|
||||
IFS=',' read -r -a array <<< "${args[2]}"
|
||||
for index in "${!array[@]}"
|
||||
do
|
||||
add_setting "PIHOLE_DNS_$((index+1))" "${array[index]}"
|
||||
done
|
||||
|
||||
if [[ "${args[3]}" == "domain-needed" ]]; then
|
||||
change_setting "DNS_FQDN_REQUIRED" "true"
|
||||
else
|
||||
change_setting "DNS_FQDN_REQUIRED" "false"
|
||||
fi
|
||||
|
||||
if [[ "${args[4]}" == "bogus-priv" ]]; then
|
||||
change_setting "DNS_BOGUS_PRIV" "true"
|
||||
else
|
||||
change_setting "DNS_BOGUS_PRIV" "false"
|
||||
fi
|
||||
|
||||
if [[ "${args[5]}" == "dnssec" ]]; then
|
||||
change_setting "DNSSEC" "true"
|
||||
else
|
||||
change_setting "DNSSEC" "false"
|
||||
fi
|
||||
|
||||
ProcessDNSSettings
|
||||
|
||||
# Restart dnsmasq to load new configuration
|
||||
RestartDNS
|
||||
|
||||
}
|
||||
|
||||
SetExcludeDomains(){
|
||||
|
||||
change_setting "API_EXCLUDE_DOMAINS" "${args[2]}"
|
||||
|
||||
}
|
||||
|
||||
SetExcludeClients(){
|
||||
|
||||
change_setting "API_EXCLUDE_CLIENTS" "${args[2]}"
|
||||
|
||||
}
|
||||
|
||||
Reboot(){
|
||||
|
||||
nohup bash -c "sleep 5; reboot" &> /dev/null </dev/null &
|
||||
|
||||
}
|
||||
|
||||
RestartDNS(){
|
||||
|
||||
if [ -x "$(command -v systemctl)" ]; then
|
||||
systemctl restart dnsmasq &> /dev/null
|
||||
else
|
||||
service dnsmasq restart &> /dev/null
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
SetQueryLogOptions(){
|
||||
|
||||
change_setting "API_QUERY_LOG_SHOW" "${args[2]}"
|
||||
|
||||
}
|
||||
|
||||
ProcessDHCPSettings() {
|
||||
|
||||
source "${setupVars}"
|
||||
|
||||
if [[ "${DHCP_ACTIVE}" == "true" ]]; then
|
||||
|
||||
interface=$(grep 'PIHOLE_INTERFACE=' /etc/pihole/setupVars.conf | sed "s/.*=//")
|
||||
|
||||
# Use eth0 as fallback interface
|
||||
if [ -z ${interface} ]; then
|
||||
interface="eth0"
|
||||
fi
|
||||
|
||||
if [[ "${PIHOLE_DOMAIN}" == "" ]]; then
|
||||
PIHOLE_DOMAIN="local"
|
||||
change_setting "PIHOLE_DOMAIN" "${PIHOLE_DOMAIN}"
|
||||
fi
|
||||
|
||||
if [[ "${DHCP_LEASETIME}" == "0" ]]; then
|
||||
leasetime="infinite"
|
||||
elif [[ "${DHCP_LEASETIME}" == "" ]]; then
|
||||
leasetime="24h"
|
||||
change_setting "DHCP_LEASETIME" "${leasetime}"
|
||||
else
|
||||
leasetime="${DHCP_LEASETIME}h"
|
||||
fi
|
||||
|
||||
# Write settings to file
|
||||
echo "###############################################################################
|
||||
# DHCP SERVER CONFIG FILE AUTOMATICALLY POPULATED BY PI-HOLE WEB INTERFACE. #
|
||||
# ANY CHANGES MADE TO THIS FILE WILL BE LOST ON CHANGE #
|
||||
###############################################################################
|
||||
dhcp-authoritative
|
||||
dhcp-range=${DHCP_START},${DHCP_END},${leasetime}
|
||||
dhcp-option=option:router,${DHCP_ROUTER}
|
||||
dhcp-leasefile=/etc/pihole/dhcp.leases
|
||||
#quiet-dhcp
|
||||
" > "${dhcpconfig}"
|
||||
|
||||
if [[ "${PIHOLE_DOMAIN}" != "none" ]]; then
|
||||
echo "domain=${PIHOLE_DOMAIN}" >> "${dhcpconfig}"
|
||||
fi
|
||||
|
||||
if [[ "${DHCP_IPv6}" == "true" ]]; then
|
||||
echo "#quiet-dhcp6
|
||||
#enable-ra
|
||||
dhcp-option=option6:dns-server,[::]
|
||||
dhcp-range=::100,::1ff,constructor:${interface},ra-names,slaac,${leasetime}
|
||||
ra-param=*,0,0
|
||||
" >> "${dhcpconfig}"
|
||||
fi
|
||||
|
||||
else
|
||||
rm "${dhcpconfig}" &> /dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
EnableDHCP(){
|
||||
|
||||
change_setting "DHCP_ACTIVE" "true"
|
||||
change_setting "DHCP_START" "${args[2]}"
|
||||
change_setting "DHCP_END" "${args[3]}"
|
||||
change_setting "DHCP_ROUTER" "${args[4]}"
|
||||
change_setting "DHCP_LEASETIME" "${args[5]}"
|
||||
change_setting "PIHOLE_DOMAIN" "${args[6]}"
|
||||
change_setting "DHCP_IPv6" "${args[7]}"
|
||||
|
||||
# Remove possible old setting from file
|
||||
delete_dnsmasq_setting "dhcp-"
|
||||
delete_dnsmasq_setting "quiet-dhcp"
|
||||
|
||||
ProcessDHCPSettings
|
||||
|
||||
RestartDNS
|
||||
}
|
||||
|
||||
DisableDHCP(){
|
||||
|
||||
change_setting "DHCP_ACTIVE" "false"
|
||||
|
||||
# Remove possible old setting from file
|
||||
delete_dnsmasq_setting "dhcp-"
|
||||
delete_dnsmasq_setting "quiet-dhcp"
|
||||
|
||||
ProcessDHCPSettings
|
||||
|
||||
RestartDNS
|
||||
}
|
||||
|
||||
SetWebUILayout(){
|
||||
|
||||
change_setting "WEBUIBOXEDLAYOUT" "${args[2]}"
|
||||
|
||||
}
|
||||
|
||||
SetPrivacyMode(){
|
||||
|
||||
if [[ "${args[2]}" == "true" ]] ; then
|
||||
change_setting "API_PRIVACY_MODE" "true"
|
||||
else
|
||||
change_setting "API_PRIVACY_MODE" "false"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
ResolutionSettings() {
|
||||
|
||||
typ="${args[2]}"
|
||||
state="${args[3]}"
|
||||
|
||||
if [[ "${typ}" == "forward" ]]; then
|
||||
change_setting "API_GET_UPSTREAM_DNS_HOSTNAME" "${state}"
|
||||
elif [[ "${typ}" == "clients" ]]; then
|
||||
change_setting "API_GET_CLIENT_HOSTNAME" "${state}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
AddDHCPStaticAddress() {
|
||||
|
||||
mac="${args[2]}"
|
||||
ip="${args[3]}"
|
||||
host="${args[4]}"
|
||||
|
||||
if [[ "${ip}" == "noip" ]]; then
|
||||
# Static host name
|
||||
echo "dhcp-host=${mac},${host}" >> "${dhcpstaticconfig}"
|
||||
elif [[ "${host}" == "nohost" ]]; then
|
||||
# Static IP
|
||||
echo "dhcp-host=${mac},${ip}" >> "${dhcpstaticconfig}"
|
||||
else
|
||||
# Full info given
|
||||
echo "dhcp-host=${mac},${ip},${host}" >> "${dhcpstaticconfig}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
RemoveDHCPStaticAddress() {
|
||||
|
||||
mac="${args[2]}"
|
||||
sed -i "/dhcp-host=${mac}.*/d" "${dhcpstaticconfig}"
|
||||
|
||||
}
|
||||
|
||||
SetHostRecord(){
|
||||
|
||||
if [ -n "${args[3]}" ]; then
|
||||
change_setting "HOSTRECORD" "${args[2]},${args[3]}"
|
||||
echo "Setting host record for ${args[2]} -> ${args[3]}"
|
||||
else
|
||||
change_setting "HOSTRECORD" ""
|
||||
echo "Removing host record"
|
||||
fi
|
||||
|
||||
ProcessDNSSettings
|
||||
|
||||
# Restart dnsmasq to load new configuration
|
||||
RestartDNS
|
||||
|
||||
}
|
||||
|
||||
SetListeningMode(){
|
||||
|
||||
source "${setupVars}"
|
||||
|
||||
if [[ "${args[2]}" == "all" ]] ; then
|
||||
echo "Listening on all interfaces, permiting all origins, hope you have a firewall!"
|
||||
change_setting "DNSMASQ_LISTENING" "all"
|
||||
elif [[ "${args[2]}" == "local" ]] ; then
|
||||
echo "Listening on all interfaces, permitting only origins that are at most one hop away (local devices)"
|
||||
change_setting "DNSMASQ_LISTENING" "local"
|
||||
else
|
||||
echo "Listening only on interface ${PIHOLE_INTERFACE}"
|
||||
change_setting "DNSMASQ_LISTENING" "single"
|
||||
fi
|
||||
|
||||
# Don't restart DNS server yet because other settings
|
||||
# will be applied afterwards if "-web" is set
|
||||
if [[ "${args[3]}" != "-web" ]]; then
|
||||
ProcessDNSSettings
|
||||
# Restart dnsmasq to load new configuration
|
||||
RestartDNS
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
main() {
|
||||
|
||||
args=("$@")
|
||||
|
||||
case "${args[1]}" in
|
||||
"-p" | "password" ) SetWebPassword;;
|
||||
"-c" | "celsius" ) unit="C"; SetTemperatureUnit;;
|
||||
"-f" | "fahrenheit" ) unit="F"; SetTemperatureUnit;;
|
||||
"-k" | "kelvin" ) unit="K"; SetTemperatureUnit;;
|
||||
"setdns" ) SetDNSServers;;
|
||||
"setexcludedomains" ) SetExcludeDomains;;
|
||||
"setexcludeclients" ) SetExcludeClients;;
|
||||
"reboot" ) Reboot;;
|
||||
"restartdns" ) RestartDNS;;
|
||||
"setquerylog" ) SetQueryLogOptions;;
|
||||
"enabledhcp" ) EnableDHCP;;
|
||||
"disabledhcp" ) DisableDHCP;;
|
||||
"layout" ) SetWebUILayout;;
|
||||
"-h" | "--help" ) helpFunc;;
|
||||
"privacymode" ) SetPrivacyMode;;
|
||||
"resolve" ) ResolutionSettings;;
|
||||
"addstaticdhcp" ) AddDHCPStaticAddress;;
|
||||
"removestaticdhcp" ) RemoveDHCPStaticAddress;;
|
||||
"hostrecord" ) SetHostRecord;;
|
||||
"-i" | "interface" ) SetListeningMode;;
|
||||
* ) helpFunc;;
|
||||
esac
|
||||
|
||||
shift
|
||||
|
||||
if [[ $# = 0 ]]; then
|
||||
helpFunc
|
||||
fi
|
||||
|
||||
}
|
@@ -1,254 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Pi-hole: A black hole for Internet advertisements
|
||||
# (c) 2015, 2016 by Jacob Salmela
|
||||
# Network-wide ad blocking via your Raspberry Pi
|
||||
# http://pi-hole.net
|
||||
# Whitelists domains
|
||||
#
|
||||
# Pi-hole is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
#rootcheck
|
||||
if [[ $EUID -eq 0 ]];then
|
||||
echo "::: You are root."
|
||||
else
|
||||
echo "::: sudo will be used."
|
||||
# Check if it is actually installed
|
||||
# If it isn't, exit because the install cannot complete
|
||||
if [ -x "$(command -v sudo)" ];then
|
||||
export SUDO="sudo"
|
||||
else
|
||||
echo "::: Please install sudo or run this script as root."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
function helpFunc()
|
||||
{
|
||||
echo "::: Immediately whitelists one or more domains in the hosts file"
|
||||
echo ":::"
|
||||
echo "::: Usage: pihole -w domain1 [domain2 ...]"
|
||||
echo ":::"
|
||||
echo "::: Options:"
|
||||
echo "::: -d, --delmode Remove domains from the whitelist"
|
||||
echo "::: -nr, --noreload Update Whitelist without refreshing dnsmasq"
|
||||
echo "::: -f, --force Force updating of the hosts files, even if there are no changes"
|
||||
echo "::: -q, --quiet output is less verbose"
|
||||
echo "::: -h, --help Show this help dialog"
|
||||
echo "::: -l, --list Display your whitelisted domains"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [[ $# = 0 ]]; then
|
||||
helpFunc
|
||||
fi
|
||||
|
||||
#globals
|
||||
basename=pihole
|
||||
piholeDir=/etc/${basename}
|
||||
adList=${piholeDir}/gravity.list
|
||||
whitelist=${piholeDir}/whitelist.txt
|
||||
reload=true
|
||||
addmode=true
|
||||
force=false
|
||||
verbose=true
|
||||
|
||||
domList=()
|
||||
domToRemoveList=()
|
||||
|
||||
piholeIPfile=/etc/pihole/piholeIP
|
||||
piholeIPv6file=/etc/pihole/.useIPv6
|
||||
|
||||
if [[ -f ${piholeIPfile} ]];then
|
||||
# If the file exists, it means it was exported from the installation script and we should use that value instead of detecting it in this script
|
||||
piholeIP=$(cat ${piholeIPfile})
|
||||
#rm $piholeIPfile
|
||||
else
|
||||
# Otherwise, the IP address can be taken directly from the machine, which will happen when the script is run by the user and not the installation script
|
||||
IPv4dev=$(ip route get 8.8.8.8 | awk '{for(i=1;i<=NF;i++)if($i~/dev/)print $(i+1)}')
|
||||
piholeIPCIDR=$(ip -o -f inet addr show dev "$IPv4dev" | awk '{print $4}' | awk 'END {print}')
|
||||
piholeIP=${piholeIPCIDR%/*}
|
||||
fi
|
||||
|
||||
modifyHost=false
|
||||
|
||||
# After setting defaults, check if there's local overrides
|
||||
if [[ -r ${piholeDir}/pihole.conf ]];then
|
||||
echo "::: Local calibration requested..."
|
||||
. ${piholeDir}/pihole.conf
|
||||
fi
|
||||
|
||||
if [[ -f ${piholeIPv6file} ]];then
|
||||
# If the file exists, then the user previously chose to use IPv6 in the automated installer
|
||||
piholeIPv6=$(ip -6 route get 2001:4860:4860::8888 | awk -F " " '{ for(i=1;i<=NF;i++) if ($i == "src") print $(i+1) }')
|
||||
fi
|
||||
|
||||
function HandleOther(){
|
||||
#check validity of domain
|
||||
validDomain=$(echo "$1" | perl -ne'print if /\b((?=[a-z0-9-]{1,63}\.)(xn--)?[a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,63}\b/')
|
||||
if [ -z "$validDomain" ]; then
|
||||
echo "::: $1 is not a valid argument or domain name"
|
||||
else
|
||||
domList=("${domList[@]}" ${validDomain})
|
||||
fi
|
||||
}
|
||||
|
||||
function PopWhitelistFile(){
|
||||
#check whitelist file exists, and if not, create it
|
||||
if [[ ! -f ${whitelist} ]];then
|
||||
touch ${whitelist}
|
||||
fi
|
||||
for dom in "${domList[@]}"
|
||||
do
|
||||
if ${addmode}; then
|
||||
AddDomain "$dom"
|
||||
else
|
||||
RemoveDomain "$dom"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
function AddDomain(){
|
||||
#| sed 's/\./\\./g'
|
||||
bool=false
|
||||
|
||||
grep -Ex -q "$1" ${whitelist} || bool=true
|
||||
if ${bool}; then
|
||||
#domain not found in the whitelist file, add it!
|
||||
if ${verbose}; then
|
||||
echo -n "::: Adding $1 to $whitelist..."
|
||||
fi
|
||||
echo "$1" >> ${whitelist}
|
||||
modifyHost=true
|
||||
if ${verbose}; then
|
||||
echo " done!"
|
||||
fi
|
||||
else
|
||||
if ${verbose}; then
|
||||
echo "::: $1 already exists in $whitelist, no need to add!"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function RemoveDomain(){
|
||||
|
||||
bool=false
|
||||
grep -Ex -q "$1" ${whitelist} || bool=true
|
||||
if ${bool}; then
|
||||
#Domain is not in the whitelist file, no need to Remove
|
||||
if ${verbose}; then
|
||||
echo "::: $1 is NOT whitelisted! No need to remove"
|
||||
fi
|
||||
else
|
||||
#Domain is in the whitelist file, add to a temporary array and remove from whitelist file
|
||||
#if $verbose; then
|
||||
#echo "::: Un-whitelisting $dom..."
|
||||
#fi
|
||||
domToRemoveList=("${domToRemoveList[@]}" $1)
|
||||
modifyHost=true
|
||||
fi
|
||||
}
|
||||
|
||||
function ModifyHostFile(){
|
||||
if ${addmode}; then
|
||||
#remove domains in from hosts file
|
||||
if [[ -r ${whitelist} ]];then
|
||||
# Remove whitelist entries
|
||||
numberOf=$(cat ${whitelist} | sed '/^\s*$/d' | wc -l)
|
||||
plural=; [[ "$numberOf" != "1" ]] && plural=s
|
||||
echo ":::"
|
||||
echo -n "::: Modifying HOSTS file to whitelist $numberOf domain${plural}..."
|
||||
awk -F':' '{print $1}' ${whitelist} | while read -r line; do echo "$piholeIP $line"; done > /etc/pihole/whitelist.tmp
|
||||
awk -F':' '{print $1}' ${whitelist} | while read -r line; do echo "$piholeIPv6 $line"; done >> /etc/pihole/whitelist.tmp
|
||||
echo "l" >> /etc/pihole/whitelist.tmp
|
||||
grep -F -x -v -f ${piholeDir}/whitelist.tmp ${adList} > ${piholeDir}/gravity.tmp
|
||||
rm ${adList}
|
||||
mv ${piholeDir}/gravity.tmp ${adList}
|
||||
rm ${piholeDir}/whitelist.tmp
|
||||
echo " done!"
|
||||
|
||||
fi
|
||||
else
|
||||
#we need to add the removed domains to the hosts file
|
||||
echo ":::"
|
||||
echo "::: Modifying HOSTS file to un-whitelist domains..."
|
||||
for rdom in "${domToRemoveList[@]}"
|
||||
do
|
||||
if grep -q "$rdom" /etc/pihole/*.domains; then
|
||||
echo "::: AdLists contain $rdom, re-adding block"
|
||||
if [[ -n ${piholeIPv6} ]];then
|
||||
echo -n "::: Restoring block for $rdom on IPv4 and IPv6..."
|
||||
echo "$rdom" | awk -v ipv4addr="$piholeIP" -v ipv6addr="$piholeIPv6" '{sub(/\r$/,""); print ipv4addr" "$0"\n"ipv6addr" "$0}' >> ${adList}
|
||||
echo " done!"
|
||||
else
|
||||
echo -n "::: Restoring block for $rdom on IPv4..."
|
||||
echo "$rdom" | awk -v ipv4addr="$piholeIP" '{sub(/\r$/,""); print ipv4addr" "$0}' >>${adList}
|
||||
echo " done!"
|
||||
fi
|
||||
fi
|
||||
echo -n "::: Removing $rdom from $whitelist..."
|
||||
echo "$rdom" | sed 's/\./\\./g' | xargs -I {} perl -i -ne'print unless /'{}'(?!.)/;' ${whitelist}
|
||||
echo " done!"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
function Reload() {
|
||||
# Reload hosts file
|
||||
echo ":::"
|
||||
echo -n "::: Refresh lists in dnsmasq..."
|
||||
dnsmasqPid=$(pidof dnsmasq)
|
||||
|
||||
if [[ ${dnsmasqPid} ]]; then
|
||||
# service already running - reload config
|
||||
${SUDO} killall -s HUP dnsmasq
|
||||
else
|
||||
# service not running, start it up
|
||||
${SUDO} service dnsmasq start
|
||||
fi
|
||||
echo " done!"
|
||||
}
|
||||
|
||||
function DisplayWlist() {
|
||||
verbose=false
|
||||
echo -e " Displaying Gravity Resistant Domains \n"
|
||||
count=1
|
||||
while IFS= read -r RD
|
||||
do
|
||||
echo "${count}: $RD"
|
||||
count=$((count+1))
|
||||
done < "$whitelist"
|
||||
}
|
||||
|
||||
###################################################
|
||||
|
||||
for var in "$@"
|
||||
do
|
||||
case "$var" in
|
||||
"-nr"| "--noreload" ) reload=false;;
|
||||
"-d" | "--delmode" ) addmode=false;;
|
||||
"-f" | "--force" ) force=true;;
|
||||
"-q" | "--quiet" ) verbose=false;;
|
||||
"-h" | "--help" ) helpFunc;;
|
||||
"-l" | "--list" ) DisplayWlist;;
|
||||
* ) HandleOther "$var";;
|
||||
esac
|
||||
done
|
||||
|
||||
PopWhitelistFile
|
||||
|
||||
if ${modifyHost} || ${force}; then
|
||||
ModifyHostFile
|
||||
else
|
||||
if ${verbose}; then
|
||||
echo ":::"
|
||||
echo "::: No changes need to be made"
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ${reload}; then
|
||||
Reload
|
||||
fi
|
@@ -1,12 +1,11 @@
|
||||
_pihole()
|
||||
{
|
||||
local cur prev opts
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
opts="whitelist blacklist debug flush updateDashboard updateGravity setupLCD chronometer uninstall help"
|
||||
_pihole() {
|
||||
local cur prev opts
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
opts="admin blacklist chronometer debug disable enable flush help logging query reconfigure restartdns setupLCD status tail uninstall updateGravity updatePihole version whitelist"
|
||||
|
||||
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
||||
return 0
|
||||
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
||||
return 0
|
||||
}
|
||||
complete -F _pihole pihole
|
||||
complete -F _pihole pihole
|
||||
|
136
advanced/blockingpage.css
Normal file
136
advanced/blockingpage.css
Normal file
@@ -0,0 +1,136 @@
|
||||
/* CSS Reset */
|
||||
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video { margin: 0; padding: 0; border: 0; font-size: 100%; font: inherit; vertical-align: baseline; }
|
||||
article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section { display: block; }
|
||||
body { line-height: 1; }
|
||||
ol, ul { list-style: none; }
|
||||
blockquote, q { quotes: none; }
|
||||
blockquote:before, blockquote:after, q:before, q:after { content: ''; content: none; }
|
||||
table { border-collapse: collapse; border-spacing: 0; }
|
||||
html { height: 100%; overflow-x: hidden; }
|
||||
|
||||
/* General Style */
|
||||
a { color: rgba(0,60,120,0.95); text-decoration: none; } /* 1E3C5A */
|
||||
a:hover { color: rgba(210,120,0,0.95); transition-duration: .2s; } /* 255, 128, 0 */
|
||||
divs a { border-bottom: 1px dashed rgba(30,60,90,0.3); }
|
||||
b { font-weight: bold; }
|
||||
i { font-style: italic; }
|
||||
|
||||
footer, pre, td { font-family: monospace; padding-left: 15px; }
|
||||
/*body, header { background: #E1E1E1; }*/
|
||||
|
||||
body {
|
||||
background-image: -webkit-linear-gradient(top, rgba(240,240,240,0.95), rgba(190,190,190,0.95));
|
||||
background-image: linear-gradient(to bottom, rgba(240,240,240,0.95), rgba(190,190,190,0.95));
|
||||
background-attachment: fixed;
|
||||
color: rgba(64,64,64,0.95);
|
||||
font: 14px, sans-serif;
|
||||
line-height: 1em;
|
||||
}
|
||||
|
||||
header {
|
||||
min-width: 320px;
|
||||
width: 100%;
|
||||
text-shadow: 0 1px rgba(255,255,255,0.6);
|
||||
display: table;
|
||||
table-layout: fixed;
|
||||
border: 1px solid rgba(0,0,0,0.25);
|
||||
border-top-color: rgba(255,255,255,0.85);
|
||||
border-style: solid none;
|
||||
background-image: -webkit-linear-gradient(top, rgba(240,240,240,0.95), rgba(220,220,220,0.95));
|
||||
background-image: linear-gradient(to bottom, rgba(240,240,240,0.95), rgba(220,220,220,0.95));
|
||||
box-shadow: 0 0 1px 1px rgba(0,0,0,0.04);
|
||||
}
|
||||
|
||||
header h1, header div {
|
||||
display: table-cell;
|
||||
color: inherit;
|
||||
font-weight: bold;
|
||||
vertical-align: middle;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
header h1 {
|
||||
font-size: 22px;
|
||||
font-weight: bold;
|
||||
width: 100%;
|
||||
padding: 8px 0;
|
||||
text-indent: 32px;
|
||||
background: url("http://pi.hole/admin/img/logo.svg") left no-repeat;
|
||||
background-size: 30px 22px;
|
||||
}
|
||||
|
||||
header h1 a, h1 a:hover { color: inherit; }
|
||||
header .alt { width: 85px; font-size: 0.8em; padding-right: 4px; text-align: right; line-height: 1.25em; }
|
||||
.active { color: green; }
|
||||
.inactive { color: red; }
|
||||
|
||||
main {
|
||||
display: block;
|
||||
width: 80%;
|
||||
padding: 10px;
|
||||
font-size: 1em;
|
||||
background-color: rgba(255,255,255,0.85);
|
||||
margin: 8px auto;
|
||||
box-sizing: border-box;
|
||||
border: 1px solid rgba(0,0,0,0.25);
|
||||
box-shadow: 4px 4px rgba(0,0,0,0.1);
|
||||
line-height: 1.2em;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
h2 { /* Rgba is shared with .transparent th */
|
||||
font: 1.15em sans-serif;
|
||||
background-color: rgba(255,0,0,0.4);
|
||||
text-shadow: none;
|
||||
line-height: 1.1em;
|
||||
padding-bottom: 1px;
|
||||
margin-top: 8px;
|
||||
margin-bottom: 4px;
|
||||
background: -webkit-linear-gradient(left, rgba(0,0,0,0.25), transparent 80%) no-repeat;
|
||||
background: linear-gradient(to right, rgba(0,0,0,0.25), transparent 80%) no-repeat;
|
||||
background-size: 100% 1px;
|
||||
background-position: 0 17px;
|
||||
}
|
||||
|
||||
h2:first-child { margin-top: 0; }
|
||||
h2 ~ *:not(h2) { margin-left: 4px; }
|
||||
li { padding: 2px 0; }
|
||||
li::before { content: "\00BB\00a0"; }
|
||||
li a { position: relative; top: 1px; } /* Center bullet-point arrows */
|
||||
|
||||
/* Button Style */
|
||||
.buttons a, button, input, .transparent th a { /* Swapped rgba is shared with input[type='url'] */
|
||||
display: inline-block;
|
||||
color: rgba(32,32,32,0.9);
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
text-shadow: 0 1px rgba(255,255,255,0.2);
|
||||
line-height: 0.86em;
|
||||
font-size: 1em;
|
||||
padding: 4px 8px;
|
||||
background: #FAFAFA;
|
||||
background-image: -webkit-linear-gradient(top, rgba(255,255,255,0.05), rgba(0,0,0,0.05));
|
||||
background-image: linear-gradient(to bottom, rgba(255,255,255,0.05), rgba(0,0,0,0.05));
|
||||
border: 1px solid rgba(0,0,0,0.25);
|
||||
border-radius: 4px;
|
||||
box-shadow: 0 1px 0 rgba(0,0,0,0.04);
|
||||
}
|
||||
|
||||
.buttons { white-space: nowrap; width: 100%; display: table; }
|
||||
.buttons33 { white-space: nowrap; width: 33.333%; display: table; text-align: center; margin-left: 33.333% }
|
||||
.mini a { width: 50%; }
|
||||
a.safe { background-color: rgba(0,220,0,0.5); }
|
||||
button.safe { background-color: rgba(0,220,0,0.5); }
|
||||
a.warn { background-color: rgba(220,0,0,0.5); }
|
||||
|
||||
.blocked a, .mini a { display: table-cell; }
|
||||
.blocked a.safe50 { width: 50%; background-color: rgba(0,220,0,0.5); }
|
||||
.blocked a.safe33 { width: 33.333%; background-color: rgba(0,220,0,0.5); }
|
||||
|
||||
/* Types of text */
|
||||
.msg { white-space: pre; overflow: auto; -webkit-overflow-scrolling: touch; display: block; line-height: 1.2em; font-weight: bold; font-size: 1.15em; margin: 4px 8px 8px 8px; white-space: pre-line; }
|
||||
|
||||
footer { font-size: 0.8em; text-align: center; width: 87%; margin: 4px auto; }
|
@@ -1,12 +0,0 @@
|
||||
# Pi-hole: A black hole for Internet advertisements
|
||||
# (c) 2015, 2016 by Jacob Salmela
|
||||
# Network-wide ad blocking via your Raspberry Pi
|
||||
# http://pi-hole.net
|
||||
# Swap file config
|
||||
#
|
||||
# Pi-hole is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
CONF_SWAPSIZE=500
|
@@ -1,7 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<script>window.close();</script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
183
advanced/index.php
Normal file
183
advanced/index.php
Normal file
@@ -0,0 +1,183 @@
|
||||
<?php
|
||||
/* Detailed Pi-Hole Block Page: Show "Website Blocked" if user browses to site, but not to image/file requests based on the work of WaLLy3K for DietPi & Pi-Hole */
|
||||
|
||||
$uri = escapeshellcmd($_SERVER['REQUEST_URI']);
|
||||
$serverName = escapeshellcmd($_SERVER['SERVER_NAME']);
|
||||
|
||||
// Retrieve server URI extension (EG: jpg, exe, php)
|
||||
$uriExt = pathinfo($uri, PATHINFO_EXTENSION);
|
||||
|
||||
// Define which URL extensions get rendered as "Website Blocked"
|
||||
$webExt = array('asp', 'htm', 'html', 'php', 'rss', 'xml');
|
||||
|
||||
if(in_array($uriExt, $webExt) || empty($uriExt))
|
||||
{
|
||||
// Requested resource has an extension listed in $webExt
|
||||
// or no extension (index access to some folder incl. the root dir)
|
||||
$showPage = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Something else
|
||||
$showPage = false;
|
||||
}
|
||||
|
||||
// Handle incoming URI types
|
||||
if (!$showPage)
|
||||
{
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<script>window.close();</script></head>
|
||||
<body>
|
||||
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7">
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
die();
|
||||
}
|
||||
|
||||
// Get Pi-Hole version
|
||||
$piHoleVersion = exec('cd /etc/.pihole/ && git describe --tags --abbrev=0');
|
||||
|
||||
// Don't show the URI if it is the root directory
|
||||
if($uri == "/")
|
||||
{
|
||||
$uri = "";
|
||||
}
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<head>
|
||||
<meta charset='UTF-8'/>
|
||||
<title>Website Blocked</title>
|
||||
<link rel='stylesheet' href='http://pi.hole/pihole/blockingpage.css'/>
|
||||
<link rel='shortcut icon' href='http://pi.hole/admin/img/favicon.png' type='image/png'/>
|
||||
<meta name='viewport' content='width=device-width,initial-scale=1.0,maximum-scale=1.0, user-scalable=no'/>
|
||||
<meta name='robots' content='noindex,nofollow'/>
|
||||
</head>
|
||||
<body id="body">
|
||||
<header>
|
||||
<h1><a href='/'>Website Blocked</a></h1>
|
||||
</header>
|
||||
<main>
|
||||
<div>Access to the following site has been blocked:<br/>
|
||||
<span class='pre msg'><?php echo $serverName.$uri; ?></span></div>
|
||||
<div>If you have an ongoing use for this website, please ask the owner of the Pi-hole in your network to have it whitelisted.</div>
|
||||
<input id="domain" type="hidden" value="<?php echo $serverName; ?>">
|
||||
<input id="quiet" type="hidden" value="yes">
|
||||
<button id="btnSearch" class="buttons blocked" type="button" style="visibility: hidden;"></button>
|
||||
This page is blocked because it is explicitly contained within the following block list(s):
|
||||
<pre id="output" style="width: 100%; height: 100%;" hidden="true"></pre><br/>
|
||||
<div class='buttons blocked'>
|
||||
<a class='safe33' href='javascript:history.back()'>Go back</a>
|
||||
<a class='safe33' id="whitelisting">Whitelist this page</a>
|
||||
<a class='safe33' href='javascript:window.close()'>Close window</a>
|
||||
</div>
|
||||
<div style="width: 98%; text-align: center; padding: 10px;" hidden="true" id="whitelistingform">
|
||||
<p>Note that whitelisting domains which are blocked using the wildcard method won't work.</p>
|
||||
<p>Password required!</p><br/>
|
||||
<form>
|
||||
<input name="list" type="hidden" value="white"><br/>
|
||||
Domain:<br/>
|
||||
<input name="domain" value="<?php echo $serverName ?>" disabled><br/><br/>
|
||||
Password:<br/>
|
||||
<input type="password" id="pw" name="pw"><br/><br/>
|
||||
<button class="buttons33 safe" id="btnAdd" type="button">Whitelist</button>
|
||||
</form><br/>
|
||||
<pre id="whitelistingoutput" style="width: 100%; height: 100%; padding: 5px;" hidden="true"></pre><br/>
|
||||
</div>
|
||||
</main>
|
||||
<footer>Generated <?php echo date('D g:i A, M d'); ?> by Pi-hole <?php echo $piHoleVersion; ?></footer>
|
||||
<script src="http://pi.hole/admin/scripts/vendor/jquery.min.js"></script>
|
||||
<script>
|
||||
// Create event for when the output is appended to
|
||||
(function($) {
|
||||
var origAppend = $.fn.append;
|
||||
|
||||
$.fn.append = function () {
|
||||
return origAppend.apply(this, arguments).trigger("append");
|
||||
};
|
||||
})(jQuery);
|
||||
</script>
|
||||
<script src="http://pi.hole/admin/scripts/pi-hole/js/queryads.js"></script>
|
||||
<script>
|
||||
function inIframe () {
|
||||
try {
|
||||
return window.self !== window.top;
|
||||
} catch (e) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Try to detect if page is loaded within iframe
|
||||
if(inIframe())
|
||||
{
|
||||
// Within iframe
|
||||
// hide content of page
|
||||
$('#body').hide();
|
||||
// remove background
|
||||
document.body.style.backgroundImage = "none";
|
||||
}
|
||||
else
|
||||
{
|
||||
// Query adlists
|
||||
$( "#btnSearch" ).click();
|
||||
}
|
||||
|
||||
$( "#whitelisting" ).on( "click", function(){ $( "#whitelistingform" ).removeAttr( "hidden" ); });
|
||||
|
||||
// Remove whitelist functionality if the domain was blocked because of a wildcard
|
||||
$( "#output" ).bind("append", function(){
|
||||
if($( "#output" ).contents()[0].data.indexOf("Wildcard blocking") !== -1)
|
||||
{
|
||||
$( "#whitelisting" ).hide();
|
||||
$( "#whitelistingform" ).hide();
|
||||
}
|
||||
});
|
||||
|
||||
function add() {
|
||||
var domain = $("#domain");
|
||||
var pw = $("#pw");
|
||||
if(domain.val().length === 0){
|
||||
return;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: "admin/scripts/pi-hole/php/add.php",
|
||||
method: "post",
|
||||
data: {"domain":domain.val(), "list":"white", "pw":pw.val()},
|
||||
success: function(response) {
|
||||
$( "#whitelistingoutput" ).removeAttr( "hidden" );
|
||||
if(response.indexOf("Pi-hole blocking") !== -1)
|
||||
{
|
||||
// Reload page after 5 seconds
|
||||
setTimeout(function(){window.location.reload(1);}, 5000);
|
||||
$( "#whitelistingoutput" ).html("---> Success <---<br/>You may have to flush your DNS cache");
|
||||
}
|
||||
else
|
||||
{
|
||||
$( "#whitelistingoutput" ).html("---> "+response+" <---");
|
||||
}
|
||||
|
||||
},
|
||||
error: function(jqXHR, exception) {
|
||||
$( "#whitelistingoutput" ).removeAttr( "hidden" );
|
||||
$( "#whitelistingoutput" ).html("---> Unknown Error <---");
|
||||
}
|
||||
});
|
||||
}
|
||||
// Handle enter button for adding domains
|
||||
$(document).keypress(function(e) {
|
||||
if(e.which === 13 && $("#pw").is(":focus")) {
|
||||
add();
|
||||
}
|
||||
});
|
||||
|
||||
// Handle buttons
|
||||
$("#btnAdd").on("click", function() {
|
||||
add();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@@ -1,17 +1,26 @@
|
||||
# Pi-hole: A black hole for Internet advertisements
|
||||
# (c) 2015, 2016 by Jacob Salmela
|
||||
# Network-wide ad blocking via your Raspberry Pi
|
||||
# http://pi-hole.net
|
||||
# (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
# Network-wide ad blocking via your own hardware.
|
||||
#
|
||||
# lighttpd config for Pi-hole
|
||||
#
|
||||
# Pi-hole is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
# This file is copyright under the latest version of the EUPL.
|
||||
# Please see LICENSE file for your rights under this license.
|
||||
|
||||
|
||||
|
||||
###############################################################################
|
||||
# FILE AUTOMATICALLY OVERWRITTEN BY PI-HOLE INSTALL/UPDATE PROCEDURE. #
|
||||
# ANY CHANGES MADE TO THIS FILE AFTER INSTALL WILL BE LOST ON THE NEXT UPDATE #
|
||||
# #
|
||||
# CHANGES SHOULD BE MADE IN A SEPERATE CONFIG FILE: #
|
||||
# /etc/lighttpd/external.conf #
|
||||
###############################################################################
|
||||
|
||||
server.modules = (
|
||||
"mod_access",
|
||||
"mod_accesslog",
|
||||
"mod_auth",
|
||||
"mod_expire",
|
||||
"mod_compress",
|
||||
"mod_redirect",
|
||||
@@ -20,15 +29,15 @@ server.modules = (
|
||||
)
|
||||
|
||||
server.document-root = "/var/www/html"
|
||||
server.error-handler-404 = "pihole/index.html"
|
||||
server.error-handler-404 = "pihole/index.php"
|
||||
server.upload-dirs = ( "/var/cache/lighttpd/uploads" )
|
||||
server.errorlog = "/var/log/lighttpd/error.log"
|
||||
server.pid-file = "/var/run/lighttpd.pid"
|
||||
server.username = "www-data"
|
||||
server.groupname = "www-data"
|
||||
server.port = 80
|
||||
accesslog.filename = "/var/log/lighttpd/access.log"
|
||||
accesslog.format = "%{%s}t|%V|%r|%s|%b"
|
||||
accesslog.filename = "/var/log/lighttpd/access.log"
|
||||
accesslog.format = "%{%s}t|%V|%r|%s|%b"
|
||||
|
||||
|
||||
index-file.names = ( "index.php", "index.html", "index.lighttpd.html" )
|
||||
@@ -52,10 +61,21 @@ $HTTP["url"] =~ "^/admin/" {
|
||||
)
|
||||
}
|
||||
|
||||
# Rewite js requests, must be out of $HTTP block due to bug #2526
|
||||
url.rewrite = ( "^(?!/admin/).*\.js$" => "pihole/index.js" )
|
||||
|
||||
# If the URL does not start with /admin, then it is a query for an ad domain
|
||||
$HTTP["url"] =~ "^(?!/admin)/.*" {
|
||||
# Create a response header for debugging using curl -I
|
||||
setenv.add-response-header = ( "X-Pi-hole" => "A black hole for Internet advertisements." )
|
||||
# rewrite only js requests
|
||||
url.rewrite = ("(.*).js" => "pihole/index.js")
|
||||
}
|
||||
|
||||
# Entering just "pi.hole" into a browser redirects to "pi.hole/admin/"
|
||||
$HTTP["host"] == "pi.hole" {
|
||||
$HTTP["url"] == "/" {
|
||||
url.redirect = ( "" => "/admin/" )
|
||||
}
|
||||
}
|
||||
|
||||
# Add user chosen options held in external file
|
||||
include_shell "cat external.conf 2>/dev/null"
|
||||
|
@@ -1,16 +1,25 @@
|
||||
# Pi-hole: A black hole for Internet advertisements
|
||||
# (c) 2015, 2016 by Jacob Salmela
|
||||
# Network-wide ad blocking via your Raspberry Pi
|
||||
# http://pi-hole.net
|
||||
# (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
# Network-wide ad blocking via your own hardware.
|
||||
#
|
||||
# lighttpd config for Pi-hole
|
||||
#
|
||||
# Pi-hole is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
# This file is copyright under the latest version of the EUPL.
|
||||
# Please see LICENSE file for your rights under this license.
|
||||
|
||||
|
||||
|
||||
###############################################################################
|
||||
# FILE AUTOMATICALLY OVERWRITTEN BY PI-HOLE INSTALL/UPDATE PROCEDURE. #
|
||||
# ANY CHANGES MADE TO THIS FILE AFTER INSTALL WILL BE LOST ON THE NEXT UPDATE #
|
||||
# #
|
||||
# CHANGES SHOULD BE MADE IN A SEPERATE CONFIG FILE: #
|
||||
# /etc/lighttpd/external.conf #
|
||||
###############################################################################
|
||||
|
||||
server.modules = (
|
||||
"mod_access",
|
||||
"mod_auth",
|
||||
"mod_fastcgi",
|
||||
"mod_accesslog",
|
||||
"mod_expire",
|
||||
@@ -21,15 +30,15 @@ server.modules = (
|
||||
)
|
||||
|
||||
server.document-root = "/var/www/html"
|
||||
server.error-handler-404 = "pihole/index.html"
|
||||
server.error-handler-404 = "pihole/index.php"
|
||||
server.upload-dirs = ( "/var/cache/lighttpd/uploads" )
|
||||
server.errorlog = "/var/log/lighttpd/error.log"
|
||||
server.pid-file = "/var/run/lighttpd.pid"
|
||||
server.username = "lighttpd"
|
||||
server.groupname = "lighttpd"
|
||||
server.port = 80
|
||||
accesslog.filename = "/var/log/lighttpd/access.log"
|
||||
accesslog.format = "%{%s}t|%V|%r|%s|%b"
|
||||
accesslog.filename = "/var/log/lighttpd/access.log"
|
||||
accesslog.format = "%{%s}t|%V|%r|%s|%b"
|
||||
|
||||
|
||||
index-file.names = ( "index.php", "index.html", "index.lighttpd.html" )
|
||||
@@ -46,7 +55,8 @@ mimetype.assign = ( ".png" => "image/png",
|
||||
".css" => "text/css; charset=utf-8",
|
||||
".js" => "application/javascript",
|
||||
".json" => "application/json",
|
||||
".txt" => "text/plain" )
|
||||
".txt" => "text/plain",
|
||||
".svg" => "image/svg+xml" )
|
||||
|
||||
# default listening port for IPv6 falls back to the IPv4 port
|
||||
#include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port
|
||||
@@ -68,10 +78,21 @@ $HTTP["url"] =~ "^/admin/" {
|
||||
setenv.add-response-header = ( "X-Pi-hole" => "The Pi-hole Web interface is working!" )
|
||||
}
|
||||
|
||||
# Rewite js requests, must be out of $HTTP block due to bug #2526
|
||||
url.rewrite = ( "^(?!/admin/).*\.js$" => "pihole/index.js" )
|
||||
|
||||
# If the URL does not start with /admin, then it is a query for an ad domain
|
||||
$HTTP["url"] =~ "^(?!/admin)/.*" {
|
||||
# Create a response header for debugging using curl -I
|
||||
setenv.add-response-header = ( "X-Pi-hole" => "A black hole for Internet advertisements." )
|
||||
# rewrite only js requests
|
||||
url.rewrite = ("(.*).js" => "pihole/index.js")
|
||||
}
|
||||
|
||||
# Entering just "pi.hole" into a browser redirects to "pi.hole/admin/"
|
||||
$HTTP["host"] == "pi.hole" {
|
||||
$HTTP["url"] == "/" {
|
||||
url.redirect = ( "" => "/admin/" )
|
||||
}
|
||||
}
|
||||
|
||||
# Add user chosen options held in external file
|
||||
include_shell "cat external.conf 2>/dev/null"
|
||||
|
10
advanced/logrotate
Normal file
10
advanced/logrotate
Normal file
@@ -0,0 +1,10 @@
|
||||
/var/log/pihole.log {
|
||||
# su #
|
||||
daily
|
||||
copytruncate
|
||||
rotate 5
|
||||
compress
|
||||
delaycompress
|
||||
notifempty
|
||||
nomail
|
||||
}
|
@@ -1,26 +1,29 @@
|
||||
# Pi-hole: A black hole for Internet advertisements
|
||||
# (c) 2015, 2016 by Jacob Salmela
|
||||
# Network-wide ad blocking via your Raspberry Pi
|
||||
# http://pi-hole.net
|
||||
# (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
# Network-wide ad blocking via your own hardware.
|
||||
#
|
||||
# Updates ad sources every week
|
||||
#
|
||||
# Pi-hole is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
# This file is copyright under the latest version of the EUPL.
|
||||
# Please see LICENSE file for your rights under this license.
|
||||
#
|
||||
#
|
||||
#
|
||||
# This file is under source-control of the Pi-hole installation and update
|
||||
# scripts, any changes made to this file will be overwritten when the softare
|
||||
# is updated or re-installed. Please make any changes to the appropriate crontab
|
||||
# or other cron file snippets.
|
||||
|
||||
# Pi-hole: Update the ad sources once a week on Sunday at 01:59
|
||||
# Download any updates from the adlists
|
||||
59 1 * * 7 root /usr/local/bin/pihole updateGravity
|
||||
59 1 * * 7 root PATH="$PATH:/usr/local/bin/" pihole updateGravity
|
||||
|
||||
# Pi-hole: Update the Web interface shortly after gravity runs
|
||||
# This should also update the version number if it is changed in the dashboard repo
|
||||
30 2 * * 7 root /usr/local/bin/pihole updateDashboard
|
||||
# Pi-hole: Update Pi-hole! Uncomment to enable auto update
|
||||
#30 2 * * 7 root PATH="$PATH:/usr/local/bin/" pihole updatePihole
|
||||
|
||||
# Pi-hole: Parse the log file before it is flushed and save the stats to a database
|
||||
# This will be used for a historical view of your Pi-hole's performance
|
||||
#50 23 * * * root /usr/local/bin/dailyLog.sh # note: this is outdated
|
||||
|
||||
# Pi-hole: Flush the log daily at 11:58 so it doesn't get out of control
|
||||
# Pi-hole: Flush the log daily at 00:00 so it doesn't get out of control
|
||||
# Stats will be viewable in the Web interface thanks to the cron job above
|
||||
58 23 * * * root /usr/local/bin/pihole flush
|
||||
# The flush script will use logrotate if available
|
||||
00 00 * * * root PATH="$PATH:/usr/local/bin/" pihole flush
|
||||
|
||||
@reboot root /usr/sbin/logrotate /etc/pihole/logrotate
|
||||
|
@@ -1,12 +1,9 @@
|
||||
# Pi-hole: A black hole for Internet advertisements
|
||||
# (c) 2015, 2016 by Jacob Salmela
|
||||
# Network-wide ad blocking via your Raspberry Pi
|
||||
# http://pi-hole.net
|
||||
# (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
# Network-wide ad blocking via your own hardware.
|
||||
#
|
||||
# Allows the WebUI to use Pi-hole commands
|
||||
#
|
||||
# Pi-hole is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
www-data ALL=NOPASSWD: /usr/local/bin/pihole
|
||||
# This file is copyright under the latest version of the EUPL.
|
||||
# Please see LICENSE file for your rights under this license.
|
||||
#
|
||||
|
@@ -1,87 +0,0 @@
|
||||
module pihole 1.0;
|
||||
|
||||
require {
|
||||
type var_log_t;
|
||||
type unconfined_t;
|
||||
type init_t;
|
||||
type auditd_t;
|
||||
type syslogd_t;
|
||||
type NetworkManager_t;
|
||||
type mdadm_t;
|
||||
type tuned_t;
|
||||
type avahi_t;
|
||||
type irqbalance_t;
|
||||
type system_dbusd_t;
|
||||
type kernel_t;
|
||||
type httpd_sys_script_t;
|
||||
type systemd_logind_t;
|
||||
type httpd_t;
|
||||
type policykit_t;
|
||||
type dnsmasq_t;
|
||||
type udev_t;
|
||||
type postfix_pickup_t;
|
||||
type sshd_t;
|
||||
type crond_t;
|
||||
type getty_t;
|
||||
type lvm_t;
|
||||
type postfix_qmgr_t;
|
||||
type postfix_master_t;
|
||||
class dir { getattr search };
|
||||
class file { read open setattr };
|
||||
}
|
||||
|
||||
#============= dnsmasq_t ==============
|
||||
allow dnsmasq_t var_log_t:file { open setattr };
|
||||
|
||||
#============= httpd_t ==============
|
||||
allow httpd_t var_log_t:file { read open };
|
||||
|
||||
#============= httpd_sys_script_t (class: dir) ==============
|
||||
allow httpd_sys_script_t NetworkManager_t:dir { getattr search };
|
||||
allow httpd_sys_script_t auditd_t:dir { getattr search };
|
||||
allow httpd_sys_script_t avahi_t:dir { getattr search };
|
||||
allow httpd_sys_script_t crond_t:dir { getattr search };
|
||||
allow httpd_sys_script_t dnsmasq_t:dir { getattr search };
|
||||
allow httpd_sys_script_t getty_t:dir { getattr search };
|
||||
allow httpd_sys_script_t httpd_t:dir { getattr search };
|
||||
allow httpd_sys_script_t init_t:dir { getattr search };
|
||||
allow httpd_sys_script_t irqbalance_t:dir { getattr search };
|
||||
allow httpd_sys_script_t kernel_t:dir { getattr search };
|
||||
allow httpd_sys_script_t lvm_t:dir { getattr search };
|
||||
allow httpd_sys_script_t mdadm_t:dir { getattr search };
|
||||
allow httpd_sys_script_t policykit_t:dir { getattr search };
|
||||
allow httpd_sys_script_t postfix_master_t:dir { getattr search };
|
||||
allow httpd_sys_script_t postfix_pickup_t:dir { getattr search };
|
||||
allow httpd_sys_script_t postfix_qmgr_t:dir { getattr search };
|
||||
allow httpd_sys_script_t sshd_t:dir { getattr search };
|
||||
allow httpd_sys_script_t syslogd_t:dir { getattr search };
|
||||
allow httpd_sys_script_t system_dbusd_t:dir { getattr search };
|
||||
allow httpd_sys_script_t systemd_logind_t:dir { getattr search };
|
||||
allow httpd_sys_script_t tuned_t:dir { getattr search };
|
||||
allow httpd_sys_script_t udev_t:dir { getattr search };
|
||||
allow httpd_sys_script_t unconfined_t:dir { getattr search };
|
||||
|
||||
#============= httpd_sys_script_t (class: file) ==============
|
||||
allow httpd_sys_script_t NetworkManager_t:file { read open };
|
||||
allow httpd_sys_script_t auditd_t:file { read open };
|
||||
allow httpd_sys_script_t avahi_t:file { read open };
|
||||
allow httpd_sys_script_t crond_t:file { read open };
|
||||
allow httpd_sys_script_t dnsmasq_t:file { read open };
|
||||
allow httpd_sys_script_t getty_t:file { read open };
|
||||
allow httpd_sys_script_t httpd_t:file { read open };
|
||||
allow httpd_sys_script_t init_t:file { read open };
|
||||
allow httpd_sys_script_t irqbalance_t:file { read open };
|
||||
allow httpd_sys_script_t kernel_t:file { read open };
|
||||
allow httpd_sys_script_t lvm_t:file { read open };
|
||||
allow httpd_sys_script_t mdadm_t:file { read open };
|
||||
allow httpd_sys_script_t policykit_t:file { read open };
|
||||
allow httpd_sys_script_t postfix_master_t:file { read open };
|
||||
allow httpd_sys_script_t postfix_pickup_t:file { read open };
|
||||
allow httpd_sys_script_t postfix_qmgr_t:file { read open };
|
||||
allow httpd_sys_script_t sshd_t:file { read open };
|
||||
allow httpd_sys_script_t syslogd_t:file { read open };
|
||||
allow httpd_sys_script_t system_dbusd_t:file { read open };
|
||||
allow httpd_sys_script_t systemd_logind_t:file { read open };
|
||||
allow httpd_sys_script_t tuned_t:file { read open };
|
||||
allow httpd_sys_script_t udev_t:file { read open };
|
||||
allow httpd_sys_script_t unconfined_t:file { read open };
|
File diff suppressed because it is too large
Load Diff
@@ -1,39 +1,39 @@
|
||||
#!/usr/bin/env bash
|
||||
# Pi-hole: A black hole for Internet advertisements
|
||||
# (c) 2015, 2016 by Jacob Salmela
|
||||
# Network-wide ad blocking via your Raspberry Pi
|
||||
# http://pi-hole.net
|
||||
# (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
# Network-wide ad blocking via your own hardware.
|
||||
#
|
||||
# Completely uninstalls Pi-hole
|
||||
#
|
||||
# Pi-hole is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
# This file is copyright under the latest version of the EUPL.
|
||||
# Please see LICENSE file for your rights under this license.
|
||||
|
||||
|
||||
|
||||
# Must be root to uninstall
|
||||
if [[ $EUID -eq 0 ]];then
|
||||
if [[ ${EUID} -eq 0 ]]; then
|
||||
echo "::: You are root."
|
||||
else
|
||||
echo "::: Sudo will be used for the uninstall."
|
||||
# Check if it is actually installed
|
||||
# If it isn't, exit because the unnstall cannot complete
|
||||
if [ -x "$(command -v sudo)" ];then
|
||||
# Check if it is actually installed
|
||||
# If it isn't, exit because the unnstall cannot complete
|
||||
if [ -x "$(command -v sudo)" ]; then
|
||||
export SUDO="sudo"
|
||||
else
|
||||
echo "::: Please install sudo or run this as root."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "::: Please install sudo or run this as root."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Compatability
|
||||
if [ -x "$(command -v rpm)" ];then
|
||||
if [ -x "$(command -v rpm)" ]; then
|
||||
# Fedora Family
|
||||
if [ -x "$(command -v dnf)" ];then
|
||||
if [ -x "$(command -v dnf)" ]; then
|
||||
PKG_MANAGER="dnf"
|
||||
else
|
||||
PKG_MANAGER="yum"
|
||||
fi
|
||||
PKG_REMOVE="$PKG_MANAGER remove -y"
|
||||
PKG_REMOVE="${PKG_MANAGER} remove -y"
|
||||
PIHOLE_DEPS=( bind-utils bc dnsmasq lighttpd lighttpd-fastcgi php-common git curl unzip wget findutils )
|
||||
package_check() {
|
||||
rpm -qa | grep ^$1- > /dev/null
|
||||
@@ -41,10 +41,10 @@ if [ -x "$(command -v rpm)" ];then
|
||||
package_cleanup() {
|
||||
${SUDO} ${PKG_MANAGER} -y autoremove
|
||||
}
|
||||
elif [ -x "$(command -v apt-get)" ];then
|
||||
elif [ -x "$(command -v apt-get)" ]; then
|
||||
# Debian Family
|
||||
PKG_MANAGER="apt-get"
|
||||
PKG_REMOVE="$PKG_MANAGER -y remove --purge"
|
||||
PKG_REMOVE="${PKG_MANAGER} -y remove --purge"
|
||||
PIHOLE_DEPS=( dnsutils bc dnsmasq lighttpd php5-common git curl unzip wget )
|
||||
package_check() {
|
||||
dpkg-query -W -f='${Status}' "$1" 2>/dev/null | grep -c "ok installed"
|
||||
@@ -58,37 +58,36 @@ else
|
||||
exit
|
||||
fi
|
||||
|
||||
spinner()
|
||||
{
|
||||
local pid=$1
|
||||
local delay=0.50
|
||||
local spinstr='/-\|'
|
||||
while [ "$(ps a | awk '{print $1}' | grep "$pid")" ]; do
|
||||
local temp=${spinstr#?}
|
||||
printf " [%c] " "$spinstr"
|
||||
local spinstr=${temp}${spinstr%"$temp"}
|
||||
sleep ${delay}
|
||||
printf "\b\b\b\b\b\b"
|
||||
done
|
||||
printf " \b\b\b\b"
|
||||
spinner() {
|
||||
local pid=$1
|
||||
local delay=0.50
|
||||
local spinstr='/-\|'
|
||||
while [ "$(ps a | awk '{print $1}' | grep "${pid}")" ]; do
|
||||
local temp=${spinstr#?}
|
||||
printf " [%c] " "${spinstr}"
|
||||
local spinstr=${temp}${spinstr%"$temp}"}
|
||||
sleep ${delay}
|
||||
printf "\b\b\b\b\b\b"
|
||||
done
|
||||
printf " \b\b\b\b"
|
||||
}
|
||||
|
||||
function removeAndPurge {
|
||||
removeAndPurge() {
|
||||
# Purge dependencies
|
||||
echo ":::"
|
||||
echo ":::"
|
||||
for i in "${PIHOLE_DEPS[@]}"; do
|
||||
package_check ${i} > /dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
while true; do
|
||||
read -rp "::: Do you wish to remove $i from your system? [y/n]: " yn
|
||||
read -rp "::: Do you wish to remove ${i} from your system? [y/n]: " yn
|
||||
case ${yn} in
|
||||
[Yy]* ) printf ":::\tRemoving %s..." "$i"; ${SUDO} ${PKG_REMOVE} "$i" &> /dev/null & spinner $!; printf "done!\n"; break;;
|
||||
[Nn]* ) printf ":::\tSkipping %s" "$i\n"; break;;
|
||||
[Yy]* ) printf ":::\tRemoving %s..." "${i}"; ${SUDO} ${PKG_REMOVE} "${i}" &> /dev/null & spinner $!; printf "done!\n"; break;;
|
||||
[Nn]* ) printf ":::\tSkipping %s\n" "${i}"; break;;
|
||||
* ) printf "::: You must answer yes or no!\n";;
|
||||
esac
|
||||
done
|
||||
else
|
||||
printf ":::\tPackage %s not installed... Not removing.\n" "$i"
|
||||
printf ":::\tPackage %s not installed... Not removing.\n" "${i}"
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -104,7 +103,7 @@ echo ":::"
|
||||
removeNoPurge
|
||||
}
|
||||
|
||||
function removeNoPurge {
|
||||
removeNoPurge() {
|
||||
echo ":::"
|
||||
# Only web directories/files that are created by pihole should be removed.
|
||||
echo "::: Removing the Pi-hole Web server files..."
|
||||
@@ -137,7 +136,7 @@ function removeNoPurge {
|
||||
fi
|
||||
|
||||
echo "::: Removing config files and scripts..."
|
||||
package_check ${i} > /dev/null
|
||||
package_check lighttpd > /dev/null
|
||||
if [ $? -eq 1 ]; then
|
||||
${SUDO} rm -rf /etc/lighttpd/ &> /dev/null
|
||||
else
|
||||
@@ -156,10 +155,16 @@ function removeNoPurge {
|
||||
${SUDO} rm /etc/bash_completion.d/pihole &> /dev/null
|
||||
${SUDO} rm /etc/sudoers.d/pihole &> /dev/null
|
||||
|
||||
# If the pihole user exists, then remove
|
||||
if id "pihole" >/dev/null 2>&1; then
|
||||
echo "::: Removing pihole user..."
|
||||
${SUDO} userdel -r pihole
|
||||
fi
|
||||
|
||||
echo ":::"
|
||||
printf "::: Finished removing PiHole from your system. Sorry to see you go!\n"
|
||||
printf "::: Reach out to us at https://github.com/pi-hole/pi-hole/issues if you need help\n"
|
||||
printf "::: Reinstall by simpling running\n:::\n:::\tcurl -L https://install.pi-hole.net | bash\n:::\n::: at any time!\n:::\n"
|
||||
printf "::: Reinstall by simpling running\n:::\n:::\tcurl -sSL https://install.pi-hole.net | bash\n:::\n::: at any time!\n:::\n"
|
||||
printf "::: PLEASE RESET YOUR DNS ON YOUR ROUTER/CLIENTS TO RESTORE INTERNET CONNECTIVITY!\n"
|
||||
}
|
||||
|
||||
@@ -170,7 +175,7 @@ while true; do
|
||||
read -rp "::: Do you wish to purge PiHole's dependencies from your OS? (You will be prompted for each package) [y/n]: " yn
|
||||
case ${yn} in
|
||||
[Yy]* ) removeAndPurge; break;;
|
||||
|
||||
|
||||
[Nn]* ) removeNoPurge; break;;
|
||||
esac
|
||||
done
|
||||
|
437
gravity.sh
437
gravity.sh
@@ -1,92 +1,75 @@
|
||||
#!/usr/bin/env bash
|
||||
# Pi-hole: A black hole for Internet advertisements
|
||||
# (c) 2015 by Jacob Salmela
|
||||
# Network-wide ad blocking via your Raspberry Pi
|
||||
# http://pi-hole.net
|
||||
# (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
# Network-wide ad blocking via your own hardware.
|
||||
#
|
||||
# Compiles a list of ad-serving domains by downloading them from multiple sources
|
||||
#
|
||||
# Pi-hole is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
# This file is copyright under the latest version of the EUPL.
|
||||
# Please see LICENSE file for your rights under this license.
|
||||
|
||||
|
||||
|
||||
# Run this script as root or under sudo
|
||||
echo ":::"
|
||||
|
||||
if [[ $EUID -eq 0 ]];then
|
||||
echo "::: You are root."
|
||||
else
|
||||
echo "::: sudo will be used."
|
||||
# Check if it is actually installed
|
||||
# If it isn't, exit because the install cannot complete
|
||||
if [ -x "$(command -v sudo)" ];then
|
||||
export SUDO="sudo"
|
||||
else
|
||||
echo "::: Please install sudo or run this script as root."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
function helpFunc()
|
||||
{
|
||||
echo "::: Pull in domains from adlists"
|
||||
echo ":::"
|
||||
echo "::: Usage: pihole -g"
|
||||
echo ":::"
|
||||
echo "::: Options:"
|
||||
echo "::: -f, --force Force lists to be downloaded, even if they don't need updating."
|
||||
echo "::: -h, --help Show this help dialog"
|
||||
exit 1
|
||||
helpFunc() {
|
||||
cat << EOM
|
||||
::: Pull in domains from adlists
|
||||
:::
|
||||
::: Usage: pihole -g
|
||||
:::
|
||||
::: Options:
|
||||
::: -f, --force Force lists to be downloaded, even if they don't need updating.
|
||||
::: -h, --help Show this help dialog
|
||||
EOM
|
||||
exit 0
|
||||
}
|
||||
|
||||
piholeIPfile=/etc/pihole/piholeIP
|
||||
piholeIPv6file=/etc/pihole/.useIPv6
|
||||
|
||||
adListFile=/etc/pihole/adlists.list
|
||||
adListDefault=/etc/pihole/adlists.default
|
||||
whitelistScript=/opt/pihole/whitelist.sh
|
||||
blacklistScript=/opt/pihole/blacklist.sh
|
||||
whitelistScript="pihole -w"
|
||||
whitelistFile=/etc/pihole/whitelist.txt
|
||||
blacklistFile=/etc/pihole/blacklist.txt
|
||||
readonly wildcardlist="/etc/dnsmasq.d/03-pihole-wildcard.conf"
|
||||
|
||||
if [[ -f ${piholeIPfile} ]];then
|
||||
# If the file exists, it means it was exported from the installation script and we should use that value instead of detecting it in this script
|
||||
piholeIP=$(cat ${piholeIPfile})
|
||||
#rm $piholeIPfile
|
||||
#Source the setupVars from install script for the IP
|
||||
setupVars=/etc/pihole/setupVars.conf
|
||||
if [[ -f ${setupVars} ]];then
|
||||
. /etc/pihole/setupVars.conf
|
||||
else
|
||||
# Otherwise, the IP address can be taken directly from the machine, which will happen when the script is run by the user and not the installation script
|
||||
IPv4dev=$(ip route get 8.8.8.8 | awk '{for(i=1;i<=NF;i++)if($i~/dev/)print $(i+1)}')
|
||||
piholeIPCIDR=$(ip -o -f inet addr show dev "$IPv4dev" | awk '{print $4}' | awk 'END {print}')
|
||||
piholeIP=${piholeIPCIDR%/*}
|
||||
echo "::: WARNING: /etc/pihole/setupVars.conf missing. Possible installation failure."
|
||||
echo "::: Please run 'pihole -r', and choose the 'reconfigure' option to reconfigure."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -f ${piholeIPv6file} ]];then
|
||||
# If the file exists, then the user previously chose to use IPv6 in the automated installer
|
||||
piholeIPv6=$(ip -6 route get 2001:4860:4860::8888 | awk -F " " '{ for(i=1;i<=NF;i++) if ($i == "src") print $(i+1) }')
|
||||
fi
|
||||
#Remove the /* from the end of the IPv4addr.
|
||||
IPV4_ADDRESS=${IPV4_ADDRESS%/*}
|
||||
IPV6_ADDRESS=${IPV6_ADDRESS}
|
||||
|
||||
# Variables for various stages of downloading and formatting the list
|
||||
## Nate 3/26/2016 - Commented unused variables
|
||||
basename=pihole
|
||||
piholeDir=/etc/${basename}
|
||||
adList=${piholeDir}/gravity.list
|
||||
#blacklist=$piholeDir/blacklist.txt
|
||||
#whitelist=$piholeDir/whitelist.txt
|
||||
#latentWhitelist=$piholeDir/latentWhitelist.txt
|
||||
localList=${piholeDir}/local.list
|
||||
justDomainsExtension=domains
|
||||
matterandlight=${basename}.0.matterandlight.txt
|
||||
matterAndLight=${basename}.0.matterandlight.txt
|
||||
supernova=${basename}.1.supernova.txt
|
||||
eventHorizon=${basename}.2.eventHorizon.txt
|
||||
preEventHorizon=list.preEventHorizon
|
||||
eventHorizon=${basename}.2.supernova.txt
|
||||
accretionDisc=${basename}.3.accretionDisc.txt
|
||||
#eyeOfTheNeedle=$basename.4.wormhole.txt
|
||||
|
||||
# After setting defaults, check if there's local overrides
|
||||
if [[ -r ${piholeDir}/pihole.conf ]];then
|
||||
echo "::: Local calibration requested..."
|
||||
. ${piholeDir}/pihole.conf
|
||||
skipDownload=false
|
||||
|
||||
# Warn users still using pihole.conf that it no longer has any effect (I imagine about 2 people use it)
|
||||
if [[ -r ${piholeDir}/pihole.conf ]]; then
|
||||
echo "::: pihole.conf file no longer supported. Over-rides in this file are ignored."
|
||||
fi
|
||||
|
||||
###########################
|
||||
# collapse - begin formation of pihole
|
||||
function gravity_collapse() {
|
||||
gravity_collapse() {
|
||||
echo "::: Neutrino emissions detected..."
|
||||
echo ":::"
|
||||
#Decide if we're using a custom ad block list, or defaults.
|
||||
@@ -94,7 +77,7 @@ function gravity_collapse() {
|
||||
#custom file found, use this instead of default
|
||||
echo -n "::: Custom adList file detected. Reading..."
|
||||
sources=()
|
||||
while read -r line; do
|
||||
while IFS= read -r line || [[ -n "$line" ]]; do
|
||||
#Do not read commented out or blank lines
|
||||
if [[ ${line} = \#* ]] || [[ ! ${line} ]]; then
|
||||
echo "" > /dev/null
|
||||
@@ -107,7 +90,7 @@ function gravity_collapse() {
|
||||
#no custom file found, use defaults!
|
||||
echo -n "::: No custom adlist file detected, reading from default file..."
|
||||
sources=()
|
||||
while read -r line; do
|
||||
while IFS= read -r line || [[ -n "$line" ]]; do
|
||||
#Do not read commented out or blank lines
|
||||
if [[ ${line} = \#* ]] || [[ ! ${line} ]]; then
|
||||
echo "" > /dev/null
|
||||
@@ -117,40 +100,40 @@ function gravity_collapse() {
|
||||
done < ${adListDefault}
|
||||
echo " done!"
|
||||
fi
|
||||
|
||||
# Create the pihole resource directory if it doesn't exist. Future files will be stored here
|
||||
if [[ -d ${piholeDir} ]];then
|
||||
# Temporary hack to allow non-root access to pihole directory
|
||||
# Will update later, needed for existing installs, new installs should
|
||||
# create this directory as non-root
|
||||
${SUDO} chmod 777 ${piholeDir}
|
||||
echo ":::"
|
||||
echo "::: Existing pihole directory found"
|
||||
else
|
||||
echo "::: Creating pihole directory..."
|
||||
mkdir ${piholeDir}
|
||||
${SUDO} chmod 777 ${piholeDir}
|
||||
fi
|
||||
}
|
||||
|
||||
# patternCheck - check to see if curl downloaded any new files.
|
||||
function gravity_patternCheck() {
|
||||
gravity_patternCheck() {
|
||||
patternBuffer=$1
|
||||
# check if the patternbuffer is a non-zero length file
|
||||
if [[ -s "$patternBuffer" ]];then
|
||||
# Some of the blocklists are copyright, they need to be downloaded
|
||||
# and stored as is. They can be processed for content after they
|
||||
# have been saved.
|
||||
cp "$patternBuffer" "$saveLocation"
|
||||
echo " List updated, transport successful!"
|
||||
success=$2
|
||||
error=$3
|
||||
if [ $success = true ]; then
|
||||
# check if download was successful but list has not been modified
|
||||
if [ "${error}" == "304" ]; then
|
||||
echo "::: No changes detected, transport skipped!"
|
||||
# check if the patternbuffer is a non-zero length file
|
||||
elif [[ -s "${patternBuffer}" ]]; then
|
||||
# Some of the blocklists are copyright, they need to be downloaded
|
||||
# and stored as is. They can be processed for content after they
|
||||
# have been saved.
|
||||
mv "${patternBuffer}" "${saveLocation}"
|
||||
echo "::: List updated, transport successful!"
|
||||
else
|
||||
# Empty file -> use previously downloaded list
|
||||
echo "::: Received empty file, using cached one (list not updated!)"
|
||||
fi
|
||||
else
|
||||
# curl didn't download any host files, probably because of the date check
|
||||
echo " No changes detected, transport skipped!"
|
||||
# check if cached list exists
|
||||
if [[ -r "${saveLocation}" ]]; then
|
||||
echo "::: List download failed, using cached list (list not updated!)"
|
||||
else
|
||||
echo "::: Download failed and no cached list available (list will not be considered)"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# transport - curl the specified url with any needed command extentions
|
||||
function gravity_transport() {
|
||||
gravity_transport() {
|
||||
url=$1
|
||||
cmd_ext=$2
|
||||
agent=$3
|
||||
@@ -160,210 +143,284 @@ function gravity_transport() {
|
||||
heisenbergCompensator=""
|
||||
if [[ -r ${saveLocation} ]]; then
|
||||
# if domain has been saved, add file for date check to only download newer
|
||||
heisenbergCompensator="-z $saveLocation"
|
||||
heisenbergCompensator="-z ${saveLocation}"
|
||||
fi
|
||||
|
||||
# Silently curl url
|
||||
curl -s -L ${cmd_ext} ${heisenbergCompensator} -A "$agent" ${url} > ${patternBuffer}
|
||||
# Check for list updates
|
||||
gravity_patternCheck "$patternBuffer"
|
||||
# Cleanup
|
||||
rm -f "$patternBuffer"
|
||||
err=$(curl -s -L ${cmd_ext} ${heisenbergCompensator} -w %{http_code} -A "${agent}" ${url} -o ${patternBuffer})
|
||||
|
||||
echo " done"
|
||||
# Analyze http response
|
||||
echo -n "::: Status: "
|
||||
case "$err" in
|
||||
"200" ) echo "Success (OK)"; success=true;;
|
||||
"304" ) echo "Not modified"; success=true;;
|
||||
"403" ) echo "Forbidden"; success=false;;
|
||||
"404" ) echo "Not found"; success=false;;
|
||||
"408" ) echo "Time-out"; success=false;;
|
||||
"451" ) echo "Unavailable For Legal Reasons"; success=false;;
|
||||
"521" ) echo "Web Server Is Down (Cloudflare)"; success=false;;
|
||||
"522" ) echo "Connection Timed Out (Cloudflare)"; success=false;;
|
||||
"500" ) echo "Internal Server Error"; success=false;;
|
||||
* ) echo "Status $err"; success=false;;
|
||||
esac
|
||||
|
||||
# Process result
|
||||
gravity_patternCheck "${patternBuffer}" ${success} "${err}"
|
||||
|
||||
}
|
||||
|
||||
# spinup - main gravity function
|
||||
function gravity_spinup() {
|
||||
gravity_spinup() {
|
||||
echo ":::"
|
||||
# Loop through domain list. Download each one and remove commented lines (lines beginning with '# 'or '/') and # blank lines
|
||||
for ((i = 0; i < "${#sources[@]}"; i++))
|
||||
do
|
||||
url=${sources[$i]}
|
||||
# Get just the domain from the URL
|
||||
domain=$(echo "$url" | cut -d'/' -f3)
|
||||
for ((i = 0; i < "${#sources[@]}"; i++)); do
|
||||
url=${sources[$i]}
|
||||
# Get just the domain from the URL
|
||||
domain=$(echo "${url}" | cut -d'/' -f3)
|
||||
|
||||
# Save the file as list.#.domain
|
||||
saveLocation=${piholeDir}/list.${i}.${domain}.${justDomainsExtension}
|
||||
activeDomains[$i]=${saveLocation}
|
||||
# Save the file as list.#.domain
|
||||
saveLocation=${piholeDir}/list.${i}.${domain}.${justDomainsExtension}
|
||||
activeDomains[$i]=${saveLocation}
|
||||
|
||||
agent="Mozilla/10.0"
|
||||
agent="Mozilla/10.0"
|
||||
|
||||
echo -n "::: Getting $domain list..."
|
||||
# Use a case statement to download lists that need special cURL commands
|
||||
# to complete properly and reset the user agent when required
|
||||
case "${domain}" in
|
||||
"adblock.mahakala.is")
|
||||
agent='Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36'
|
||||
cmd_ext="-e http://forum.xda-developers.com/"
|
||||
;;
|
||||
|
||||
# Use a case statement to download lists that need special cURL commands
|
||||
# to complete properly and reset the user agent when required
|
||||
case "$domain" in
|
||||
"adblock.mahakala.is")
|
||||
agent='Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36'
|
||||
cmd_ext="-e http://forum.xda-developers.com/"
|
||||
;;
|
||||
|
||||
"pgl.yoyo.org")
|
||||
cmd_ext="-d mimetype=plaintext -d hostformat=hosts"
|
||||
;;
|
||||
"pgl.yoyo.org")
|
||||
cmd_ext="-d mimetype=plaintext -d hostformat=hosts"
|
||||
;;
|
||||
|
||||
# Default is a simple request
|
||||
*) cmd_ext=""
|
||||
esac
|
||||
gravity_transport "$url" "$cmd_ext" "$agent"
|
||||
if [[ "${skipDownload}" == false ]]; then
|
||||
echo -n "::: Getting $domain list..."
|
||||
gravity_transport "$url" "$cmd_ext" "$agent"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Schwarzchild - aggregate domains to one list and add blacklisted domains
|
||||
function gravity_Schwarzchild() {
|
||||
gravity_Schwarzchild() {
|
||||
echo "::: "
|
||||
# Find all active domains and compile them into one file and remove CRs
|
||||
echo -n "::: Aggregating list of domains..."
|
||||
truncate -s 0 ${piholeDir}/${matterandlight}
|
||||
for i in "${activeDomains[@]}"
|
||||
do
|
||||
cat "$i" | tr -d '\r' >> ${piholeDir}/${matterandlight}
|
||||
truncate -s 0 ${piholeDir}/${matterAndLight}
|
||||
for i in "${activeDomains[@]}"; do
|
||||
# Only assimilate list if it is available (download might have faild permanently)
|
||||
if [[ -r "${i}" ]]; then
|
||||
cat "${i}" | tr -d '\r' >> ${piholeDir}/${matterAndLight}
|
||||
fi
|
||||
done
|
||||
echo " done!"
|
||||
}
|
||||
|
||||
function gravity_Blacklist(){
|
||||
# Append blacklist entries if they exist
|
||||
echo -n "::: Running blacklist script to update HOSTS file...."
|
||||
${blacklistScript} -f -nr -q > /dev/null
|
||||
gravity_Blacklist() {
|
||||
# Append blacklist entries to eventHorizon if they exist
|
||||
if [[ -f "${blacklistFile}" ]]; then
|
||||
numBlacklisted=$(wc -l < "${blacklistFile}")
|
||||
plural=; [[ "$numBlacklisted" != "1" ]] && plural=s
|
||||
echo -n "::: Blacklisting $numBlacklisted domain${plural}..."
|
||||
cat ${blacklistFile} >> ${piholeDir}/${eventHorizon}
|
||||
echo " done!"
|
||||
else
|
||||
echo "::: Nothing to blacklist!"
|
||||
fi
|
||||
|
||||
numBlacklisted=$(wc -l < "/etc/pihole/blacklist.txt")
|
||||
plural=; [[ "$numBlacklisted" != "1" ]] && plural=s
|
||||
echo " $numBlacklisted domain${plural} blacklisted!"
|
||||
}
|
||||
|
||||
function gravity_Whitelist() {
|
||||
gravity_Wildcard() {
|
||||
# Return number of wildcards in output - don't actually handle wildcards
|
||||
if [[ -f "${wildcardlist}" ]]; then
|
||||
numWildcards=$(grep -c ^ "${wildcardlist}")
|
||||
if [[ -n "${IPV4_ADDRESS}" && -n "${IPV6_ADDRESS}" ]];then
|
||||
let numWildcards/=2
|
||||
fi
|
||||
plural=; [[ "$numWildcards" != "1" ]] && plural=s
|
||||
echo "::: Wildcard blocked domain${plural}: $numWildcards"
|
||||
else
|
||||
echo "::: No wildcards used!"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
gravity_Whitelist() {
|
||||
#${piholeDir}/${eventHorizon})
|
||||
echo ":::"
|
||||
# Prevent our sources from being pulled into the hole
|
||||
plural=; [[ "${sources[@]}" != "1" ]] && plural=s
|
||||
echo -n "::: Adding ${#sources[@]} adlist source${plural} to the whitelist..."
|
||||
echo -n "::: Adding adlist source${plural} to the whitelist..."
|
||||
|
||||
urls=()
|
||||
for url in "${sources[@]}"
|
||||
do
|
||||
tmp=$(echo "$url" | awk -F '/' '{print $3}')
|
||||
urls=("${urls[@]}" ${tmp})
|
||||
for url in "${sources[@]}"; do
|
||||
tmp=$(echo "${url}" | awk -F '/' '{print $3}')
|
||||
urls=("${urls[@]}" ${tmp})
|
||||
done
|
||||
echo " done!"
|
||||
|
||||
echo -n "::: Running whitelist script to update HOSTS file...."
|
||||
${whitelistScript} -f -nr -q "${urls[@]}" > /dev/null
|
||||
numWhitelisted=$(wc -l < "/etc/pihole/whitelist.txt")
|
||||
plural=; [[ "$numWhitelisted" != "1" ]] && plural=s
|
||||
echo " $numWhitelisted domain${plural} whitelisted!"
|
||||
# Ensure adlist domains are in whitelist.txt
|
||||
${whitelistScript} -nr -q "${urls[@]}" > /dev/null
|
||||
|
||||
# Check whitelist.txt exists.
|
||||
if [[ -f "${whitelistFile}" ]]; then
|
||||
# Remove anything in whitelist.txt from the Event Horizon
|
||||
numWhitelisted=$(wc -l < "${whitelistFile}")
|
||||
plural=; [[ "$numWhitelisted" != "1" ]] && plural=s
|
||||
echo -n "::: Whitelisting $numWhitelisted domain${plural}..."
|
||||
#print everything from preEventHorizon into eventHorizon EXCEPT domains in whitelist.txt
|
||||
grep -F -x -v -f ${whitelistFile} ${piholeDir}/${preEventHorizon} > ${piholeDir}/${eventHorizon}
|
||||
echo " done!"
|
||||
else
|
||||
echo "::: Nothing to whitelist!"
|
||||
fi
|
||||
}
|
||||
|
||||
function gravity_unique() {
|
||||
gravity_unique() {
|
||||
# Sort and remove duplicates
|
||||
echo -n "::: Removing duplicate domains...."
|
||||
sort -u ${piholeDir}/${supernova} > ${piholeDir}/${eventHorizon}
|
||||
sort -u ${piholeDir}/${supernova} > ${piholeDir}/${preEventHorizon}
|
||||
echo " done!"
|
||||
numberOf=$(wc -l < ${piholeDir}/${eventHorizon})
|
||||
numberOf=$(wc -l < ${piholeDir}/${preEventHorizon})
|
||||
echo "::: $numberOf unique domains trapped in the event horizon."
|
||||
}
|
||||
|
||||
function gravity_hostFormat() {
|
||||
gravity_hostFormat() {
|
||||
# Format domain list as "192.168.x.x domain.com"
|
||||
echo "::: Formatting domains into a HOSTS file..."
|
||||
hostname=$(</etc/hostname)
|
||||
# If there is a value in the $piholeIPv6, then IPv6 will be used, so the awk command modified to create a line for both protocols
|
||||
if [[ -n ${piholeIPv6} ]];then
|
||||
# Add hostname and dummy domain to the top of gravity.list to make ping result return a friendlier looking domain! Also allows for an easy way to access the Pi-hole admin console (pi.hole/admin)
|
||||
echo -e "$piholeIP $hostname\n$piholeIPv6 $hostname\n$piholeIP pi.hole\n$piholeIPv6 pi.hole" > ${piholeDir}/${accretionDisc}
|
||||
cat ${piholeDir}/${eventHorizon} | awk -v ipv4addr="$piholeIP" -v ipv6addr="$piholeIPv6" '{sub(/\r$/,""); print ipv4addr" "$0"\n"ipv6addr" "$0}' >> ${piholeDir}/${accretionDisc}
|
||||
echo -n "::: Formatting domains into a HOSTS file..."
|
||||
|
||||
if [[ -f /etc/hostname ]]; then
|
||||
hostname=$(</etc/hostname)
|
||||
elif [ -x "$(command -v hostname)" ]; then
|
||||
hostname=$(hostname -f)
|
||||
else
|
||||
# Otherwise, just create gravity.list as normal using IPv4
|
||||
# Add hostname and dummy domain to the top of gravity.list to make ping result return a friendlier looking domain! Also allows for an easy way to access the Pi-hole admin console (pi.hole/admin)
|
||||
echo -e "$piholeIP $hostname\n$piholeIP pi.hole" > ${piholeDir}/${accretionDisc}
|
||||
cat ${piholeDir}/${eventHorizon} | awk -v ipv4addr="$piholeIP" '{sub(/\r$/,""); print ipv4addr" "$0}' >> ${piholeDir}/${accretionDisc}
|
||||
echo "::: Error: Unable to determine fully qualified domain name of host"
|
||||
fi
|
||||
# Check vars from setupVars.conf to see if we're using IPv4, IPv6, Or both.
|
||||
if [[ -n "${IPV4_ADDRESS}" && -n "${IPV6_ADDRESS}" ]];then
|
||||
|
||||
echo -e "${IPV4_ADDRESS} ${hostname}\n${IPV6_ADDRESS} ${hostname}\n${IPV4_ADDRESS} pi.hole\n${IPV6_ADDRESS} pi.hole" > ${localList}
|
||||
# Both IPv4 and IPv6
|
||||
cat ${piholeDir}/${eventHorizon} | awk -v ipv4addr="$IPV4_ADDRESS" -v ipv6addr="$IPV6_ADDRESS" '{sub(/\r$/,""); print ipv4addr" "$0"\n"ipv6addr" "$0}' >> ${piholeDir}/${accretionDisc}
|
||||
|
||||
elif [[ -n "${IPV4_ADDRESS}" && -z "${IPV6_ADDRESS}" ]];then
|
||||
|
||||
echo -e "${IPV4_ADDRESS} ${hostname}\n${IPV4_ADDRESS} pi.hole" > ${localList}
|
||||
# Only IPv4
|
||||
cat ${piholeDir}/${eventHorizon} | awk -v ipv4addr="$IPV4_ADDRESS" '{sub(/\r$/,""); print ipv4addr" "$0}' >> ${piholeDir}/${accretionDisc}
|
||||
|
||||
elif [[ -z "${IPV4_ADDRESS}" && -n "${IPV6_ADDRESS}" ]];then
|
||||
|
||||
echo -e "${IPV6_ADDRESS} ${hostname}\n${IPV6_ADDRESS} pi.hole" > ${localList}
|
||||
# Only IPv6
|
||||
cat ${piholeDir}/${eventHorizon} | awk -v ipv6addr="$IPV6_ADDRESS" '{sub(/\r$/,""); print ipv6addr" "$0}' >> ${piholeDir}/${accretionDisc}
|
||||
|
||||
elif [[ -z "${IPV4_ADDRESS}" && -z "${IPV6_ADDRESS}" ]];then
|
||||
echo "::: No IP Values found! Please run 'pihole -r' and choose reconfigure to restore values"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Copy the file over as /etc/pihole/gravity.list so dnsmasq can use it
|
||||
cp ${piholeDir}/${accretionDisc} ${adList}
|
||||
echo " done!"
|
||||
}
|
||||
|
||||
# blackbody - remove any remnant files from script processes
|
||||
function gravity_blackbody() {
|
||||
gravity_blackbody() {
|
||||
# Loop through list files
|
||||
for file in ${piholeDir}/*.${justDomainsExtension}
|
||||
do
|
||||
for file in ${piholeDir}/*.${justDomainsExtension}; do
|
||||
# If list is in active array then leave it (noop) else rm the list
|
||||
if [[ " ${activeDomains[@]} " =~ ${file} ]]; then
|
||||
:
|
||||
else
|
||||
rm -f "$file"
|
||||
rm -f "${file}"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
function gravity_advanced() {
|
||||
gravity_advanced() {
|
||||
# Remove comments and print only the domain name
|
||||
# Most of the lists downloaded are already in hosts file format but the spacing/formating is not contigious
|
||||
# This helps with that and makes it easier to read
|
||||
# It also helps with debugging so each stage of the script can be researched more in depth
|
||||
echo -n "::: Formatting list of domains to remove comments...."
|
||||
awk '($1 !~ /^#/) { if (NF>1) {print $2} else {print $1}}' ${piholeDir}/${matterandlight} | sed -nr -e 's/\.{2,}/./g' -e '/\./p' > ${piholeDir}/${supernova}
|
||||
#awk '($1 !~ /^#/) { if (NF>1) {print $2} else {print $1}}' ${piholeDir}/${matterAndLight} | sed -nr -e 's/\.{2,}/./g' -e '/\./p' > ${piholeDir}/${supernova}
|
||||
#Above line does not correctly grab domains where comment is on the same line (e.g 'addomain.com #comment')
|
||||
#Awk -F splits on given IFS, we grab the right hand side (chops trailing #coments and /'s to grab the domain only.
|
||||
#Last awk command takes non-commented lines and if they have 2 fields, take the left field (the domain) and leave
|
||||
#+ the right (IP address), otherwise grab the single field.
|
||||
cat ${piholeDir}/${matterAndLight} | \
|
||||
awk -F '#' '{print $1}' | \
|
||||
awk -F '/' '{print $1}' | \
|
||||
awk '($1 !~ /^#/) { if (NF>1) {print $2} else {print $1}}' | \
|
||||
sed -nr -e 's/\.{2,}/./g' -e '/\./p' > ${piholeDir}/${supernova}
|
||||
echo " done!"
|
||||
|
||||
numberOf=$(wc -l < ${piholeDir}/${supernova})
|
||||
echo "::: $numberOf domains being pulled in by gravity..."
|
||||
echo "::: ${numberOf} domains being pulled in by gravity..."
|
||||
|
||||
gravity_unique
|
||||
}
|
||||
|
||||
function gravity_reload() {
|
||||
gravity_reload() {
|
||||
#Clear no longer needed files...
|
||||
echo ":::"
|
||||
echo -n "::: Cleaning up un-needed files..."
|
||||
${SUDO} rm ${piholeDir}/pihole.*.txt
|
||||
rm ${piholeDir}/pihole.*.txt
|
||||
echo " done!"
|
||||
|
||||
# Reload hosts file
|
||||
echo ":::"
|
||||
echo -n "::: Refresh lists in dnsmasq..."
|
||||
|
||||
|
||||
#ensure /etc/dnsmasq.d/01-pihole.conf is pointing at the correct list!
|
||||
#First escape forward slashes in the path:
|
||||
adList=${adList//\//\\\/}
|
||||
#Now replace the line in dnsmasq file
|
||||
${SUDO} sed -i "s/^addn-hosts.*/addn-hosts=$adList/" /etc/dnsmasq.d/01-pihole.conf
|
||||
dnsmasqPid=$(pidof dnsmasq)
|
||||
# sed -i "s/^addn-hosts.*/addn-hosts=$adList/" /etc/dnsmasq.d/01-pihole.conf
|
||||
|
||||
find "$piholeDir" -type f -exec ${SUDO} chmod 666 {} \;
|
||||
|
||||
if [[ ${dnsmasqPid} ]]; then
|
||||
# service already running - reload config
|
||||
${SUDO} killall -s HUP dnsmasq
|
||||
else
|
||||
# service not running, start it up
|
||||
${SUDO} service dnsmasq start
|
||||
fi
|
||||
pihole restartdns
|
||||
echo " done!"
|
||||
}
|
||||
|
||||
|
||||
for var in "$@"
|
||||
do
|
||||
case "$var" in
|
||||
"-f" | "--force" ) forceGrav=true;;
|
||||
"-h" | "--help" ) helpFunc;;
|
||||
esac
|
||||
for var in "$@"; do
|
||||
case "${var}" in
|
||||
"-f" | "--force" ) forceGrav=true;;
|
||||
"-h" | "--help" ) helpFunc;;
|
||||
"-sd" | "--skip-download" ) skipDownload=true;;
|
||||
esac
|
||||
done
|
||||
|
||||
#Overwrite adlists.default from /etc/.pihole in case any changes have been made. Changes should be saved in /etc/adlists.list
|
||||
|
||||
if [[ ${forceGrav} == true ]]; then
|
||||
if [[ "${forceGrav}" == true ]]; then
|
||||
echo -n "::: Deleting exising list cache..."
|
||||
${SUDO} rm /etc/pihole/list.*
|
||||
rm /etc/pihole/list.*
|
||||
echo " done!"
|
||||
fi
|
||||
|
||||
${SUDO} cp /etc/.pihole/adlists.default /etc/pihole/adlists.default
|
||||
#Overwrite adlists.default from /etc/.pihole in case any changes have been made. Changes should be saved in /etc/adlists.list
|
||||
cp /etc/.pihole/adlists.default /etc/pihole/adlists.default
|
||||
gravity_collapse
|
||||
gravity_spinup
|
||||
gravity_Schwarzchild
|
||||
gravity_advanced
|
||||
gravity_hostFormat
|
||||
gravity_blackbody
|
||||
if [[ "${skipDownload}" == false ]]; then
|
||||
gravity_Schwarzchild
|
||||
gravity_advanced
|
||||
else
|
||||
echo "::: Using cached Event Horizon list..."
|
||||
numberOf=$(wc -l < ${piholeDir}/${preEventHorizon})
|
||||
echo "::: $numberOf unique domains trapped in the event horizon."
|
||||
fi
|
||||
gravity_Whitelist
|
||||
gravity_Blacklist
|
||||
gravity_Wildcard
|
||||
|
||||
gravity_hostFormat
|
||||
gravity_blackbody
|
||||
|
||||
gravity_reload
|
||||
pihole status
|
||||
|
392
pihole
392
pihole
@@ -1,139 +1,345 @@
|
||||
#!/bin/bash
|
||||
# Pi-hole: A black hole for Internet advertisements
|
||||
# (c) 2015, 2016 by Jacob Salmela
|
||||
# Network-wide ad blocking via your Raspberry Pi
|
||||
# http://pi-hole.net
|
||||
# (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
# Network-wide ad blocking via your own hardware.
|
||||
#
|
||||
# Controller for all pihole scripts and functions.
|
||||
#
|
||||
# Pi-hole is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
# This file is copyright under the latest version of the EUPL.
|
||||
# Please see LICENSE file for your rights under this license.
|
||||
|
||||
|
||||
|
||||
PI_HOLE_SCRIPT_DIR="/opt/pihole"
|
||||
readonly wildcardlist="/etc/dnsmasq.d/03-pihole-wildcard.conf"
|
||||
# Must be root to use this tool
|
||||
if [[ ! $EUID -eq 0 ]];then
|
||||
#echo "::: You are root."
|
||||
#else
|
||||
#echo "::: Sudo will be used for this tool."
|
||||
# Check if it is actually installed
|
||||
# If it isn't, exit because the pihole cannot be invoked without privileges.
|
||||
if [ -x "$(command -v sudo)" ];then
|
||||
export SUDO="sudo"
|
||||
exec sudo bash "$0" "$@"
|
||||
exit $?
|
||||
else
|
||||
echo "::: Please install sudo or run this as root."
|
||||
echo "::: sudo is needed to run pihole commands. Please run this script as root or install sudo."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
function whitelistFunc {
|
||||
shift
|
||||
${SUDO} /opt/pihole/whitelist.sh "$@"
|
||||
exit 1
|
||||
webpageFunc() {
|
||||
source /opt/pihole/webpage.sh
|
||||
main "$@"
|
||||
exit 0
|
||||
}
|
||||
|
||||
function blacklistFunc {
|
||||
shift
|
||||
${SUDO} /opt/pihole/blacklist.sh "$@"
|
||||
exit 1
|
||||
whitelistFunc() {
|
||||
"${PI_HOLE_SCRIPT_DIR}"/list.sh "$@"
|
||||
exit 0
|
||||
}
|
||||
|
||||
function debugFunc {
|
||||
${SUDO} /opt/pihole/piholeDebug.sh
|
||||
exit 1
|
||||
blacklistFunc() {
|
||||
"${PI_HOLE_SCRIPT_DIR}"/list.sh "$@"
|
||||
exit 0
|
||||
}
|
||||
|
||||
function flushFunc {
|
||||
${SUDO} /opt/pihole/piholeLogFlush.sh
|
||||
exit 1
|
||||
wildcardFunc() {
|
||||
"${PI_HOLE_SCRIPT_DIR}"/list.sh "$@"
|
||||
exit 0
|
||||
}
|
||||
|
||||
function updateDashboardFunc {
|
||||
${SUDO} /opt/pihole/updateDashboard.sh
|
||||
exit 1
|
||||
debugFunc() {
|
||||
local automated
|
||||
local web
|
||||
|
||||
# Pull off the `debug` leaving passed call augmentation flags in $1
|
||||
shift
|
||||
if [[ "$@" == *"-a"* ]]; then
|
||||
automated="true"
|
||||
fi
|
||||
if [[ "$@" == *"-w"* ]]; then
|
||||
web="true"
|
||||
fi
|
||||
|
||||
AUTOMATED=${automated:-} WEBCALL=${web:-} "${PI_HOLE_SCRIPT_DIR}"/piholeDebug.sh
|
||||
exit 0
|
||||
}
|
||||
|
||||
function updatePiholeFunc {
|
||||
echo "::: Fetching latest changes from Github..."
|
||||
cd /etc/.pihole
|
||||
${SUDO} git pull
|
||||
${SUDO} /etc/.pihole/automated\ install/basic-install.sh pihole
|
||||
exit 1
|
||||
flushFunc() {
|
||||
"${PI_HOLE_SCRIPT_DIR}"/piholeLogFlush.sh
|
||||
exit 0
|
||||
}
|
||||
|
||||
function updateGravityFunc {
|
||||
${SUDO} /opt/pihole/gravity.sh "$@"
|
||||
exit 1
|
||||
updatePiholeFunc() {
|
||||
"${PI_HOLE_SCRIPT_DIR}"/update.sh
|
||||
exit 0
|
||||
}
|
||||
|
||||
function setupLCDFunction {
|
||||
${SUDO} /opt/pihole/setupLCD.sh
|
||||
exit 1
|
||||
reconfigurePiholeFunc() {
|
||||
/etc/.pihole/automated\ install/basic-install.sh --reconfigure
|
||||
exit 0;
|
||||
}
|
||||
|
||||
function queryFunc {
|
||||
domain=$2
|
||||
for list in /etc/pihole/list.*;do echo $list;grep ${domain} $list;done
|
||||
exit 1
|
||||
updateGravityFunc() {
|
||||
"${PI_HOLE_SCRIPT_DIR}"/gravity.sh "$@"
|
||||
exit 0
|
||||
}
|
||||
|
||||
function chronometerFunc {
|
||||
shift
|
||||
${SUDO} /opt/pihole/chronometer.sh "$@"
|
||||
exit 1
|
||||
scanList(){
|
||||
domain="${1}"
|
||||
list="${2}"
|
||||
method="${3}"
|
||||
if [[ ${method} == "-exact" ]] ; then
|
||||
grep -i -E "(^|\s)${domain}($|\s)" "${list}"
|
||||
else
|
||||
grep -i "${domain}" "${list}"
|
||||
fi
|
||||
}
|
||||
|
||||
processWildcards() {
|
||||
IFS="." read -r -a array <<< "${1}"
|
||||
for (( i=${#array[@]}-1; i>=0; i-- )); do
|
||||
ar=""
|
||||
for (( j=${#array[@]}-1; j>${#array[@]}-i-2; j-- )); do
|
||||
if [[ $j == $((${#array[@]}-1)) ]]; then
|
||||
ar="${array[$j]}"
|
||||
else
|
||||
ar="${array[$j]}.${ar}"
|
||||
fi
|
||||
done
|
||||
echo "${ar}"
|
||||
done
|
||||
}
|
||||
|
||||
queryFunc() {
|
||||
domain="${2}"
|
||||
method="${3}"
|
||||
lists=( /etc/pihole/list.* /etc/pihole/blacklist.txt)
|
||||
for list in ${lists[@]}; do
|
||||
if [ -e "${list}" ]; then
|
||||
result=$(scanList ${domain} ${list} ${method})
|
||||
# Remove empty lines before couting number of results
|
||||
count=$(sed '/^\s*$/d' <<< "$result" | wc -l)
|
||||
echo "::: ${list} (${count} results)"
|
||||
if [[ ${count} > 0 ]]; then
|
||||
echo "${result}"
|
||||
fi
|
||||
echo ""
|
||||
else
|
||||
echo "::: ${list} does not exist"
|
||||
echo ""
|
||||
fi
|
||||
done
|
||||
|
||||
# Scan for possible wildcard matches
|
||||
local wildcards=($(processWildcards "${domain}"))
|
||||
for domain in ${wildcards[@]}; do
|
||||
result=$(scanList "\/${domain}\/" ${wildcardlist})
|
||||
# Remove empty lines before couting number of results
|
||||
count=$(sed '/^\s*$/d' <<< "$result" | wc -l)
|
||||
if [[ ${count} > 0 ]]; then
|
||||
echo "::: Wildcard blocking ${domain} (${count} results)"
|
||||
echo "${result}"
|
||||
echo ""
|
||||
fi
|
||||
done
|
||||
exit 0
|
||||
}
|
||||
|
||||
chronometerFunc() {
|
||||
shift
|
||||
"${PI_HOLE_SCRIPT_DIR}"/chronometer.sh "$@"
|
||||
exit 0
|
||||
}
|
||||
|
||||
|
||||
function uninstallFunc {
|
||||
${SUDO} /opt/pihole/uninstall.sh
|
||||
exit 1
|
||||
uninstallFunc() {
|
||||
"${PI_HOLE_SCRIPT_DIR}"/uninstall.sh
|
||||
exit 0
|
||||
}
|
||||
|
||||
function versionFunc {
|
||||
${SUDO} /opt/pihole/version.sh
|
||||
exit 1
|
||||
versionFunc() {
|
||||
shift
|
||||
"${PI_HOLE_SCRIPT_DIR}"/version.sh "$@"
|
||||
exit 0
|
||||
}
|
||||
|
||||
function helpFunc {
|
||||
echo "::: Control all PiHole specific functions!"
|
||||
echo ":::"
|
||||
echo "::: Usage: pihole [options]"
|
||||
echo "::: Add -h after -w (whitelist), -b (blacklist), or -c (chronometer) for more information on usage"
|
||||
echo ":::"
|
||||
echo "::: Options:"
|
||||
echo "::: -w, whitelist Whitelist domains"
|
||||
echo "::: -b, blacklist Blacklist domains"
|
||||
echo "::: -d, debug Start a debugging session if having trouble"
|
||||
echo "::: -f, flush Flush the pihole.log file"
|
||||
echo "::: -ud, updateDashboard Update the web dashboard manually"
|
||||
echo "::: -up, updatePihole Update Pi-hole"
|
||||
echo "::: -g, updateGravity Update the list of ad-serving domains"
|
||||
echo "::: -s, setupLCD Automatically configures the Pi to use the 2.8 LCD screen to display stats on it"
|
||||
echo "::: -c, chronometer Calculates stats and displays to an LCD"
|
||||
echo "::: -h, help Show this help dialog"
|
||||
echo "::: -v, version Show current versions"
|
||||
echo "::: -q, query Query the adlists for a specific domain"
|
||||
echo "::: uninstall Uninstall Pi-Hole from your system :(!"
|
||||
restartDNS() {
|
||||
dnsmasqPid=$(pidof dnsmasq)
|
||||
if [[ ${dnsmasqPid} ]]; then
|
||||
# service already running - reload config
|
||||
if [ -x "$(command -v systemctl)" ]; then
|
||||
systemctl restart dnsmasq
|
||||
else
|
||||
service dnsmasq restart
|
||||
fi
|
||||
else
|
||||
# service not running, start it up
|
||||
if [ -x "$(command -v systemctl)" ]; then
|
||||
systemctl start dnsmasq
|
||||
else
|
||||
service dnsmasq start
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
piholeEnable() {
|
||||
if [[ "${1}" == "0" ]] ; then
|
||||
#Disable Pihole
|
||||
sed -i 's/^addn-hosts=\/etc\/pihole\/gravity.list/#addn-hosts=\/etc\/pihole\/gravity.list/' /etc/dnsmasq.d/01-pihole.conf
|
||||
echo "::: Blocking has been disabled!"
|
||||
if [[ $# > 1 ]] ; then
|
||||
if [[ ${2} == *"s"* ]] ; then
|
||||
tt=${2%"s"}
|
||||
echo "::: Blocking will be re-enabled in ${tt} seconds"
|
||||
nohup bash -c "sleep ${tt}; pihole enable" </dev/null &>/dev/null &
|
||||
elif [[ ${2} == *"m"* ]] ; then
|
||||
tt=${2%"m"}
|
||||
echo "::: Blocking will be re-enabled in ${tt} minutes"
|
||||
tt=$((${tt}*60))
|
||||
nohup bash -c "sleep ${tt}; pihole enable" </dev/null &>/dev/null &
|
||||
else
|
||||
echo "::: Unknown format for delayed reactivation of the blocking!"
|
||||
echo "::: Example:"
|
||||
echo "::: pihole disable 5s - will disable blocking for 5 seconds"
|
||||
echo "::: pihole disable 7m - will disable blocking for 7 minutes"
|
||||
echo "::: Blocking will not automatically be re-enabled!"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
#Enable pihole
|
||||
echo "::: Blocking has been enabled!"
|
||||
sed -i 's/^#addn-hosts/addn-hosts/' /etc/dnsmasq.d/01-pihole.conf
|
||||
fi
|
||||
restartDNS
|
||||
}
|
||||
|
||||
piholeLogging() {
|
||||
shift
|
||||
|
||||
if [[ "${1}" == "off" ]] ; then
|
||||
#Disable Logging
|
||||
sed -i 's/^log-queries/#log-queries/' /etc/dnsmasq.d/01-pihole.conf
|
||||
sed -i 's/^QUERY_LOGGING=true/QUERY_LOGGING=false/' /etc/pihole/setupVars.conf
|
||||
pihole -f
|
||||
echo "::: Logging has been disabled!"
|
||||
elif [[ "${1}" == "on" ]] ; then
|
||||
#Enable logging
|
||||
sed -i 's/^#log-queries/log-queries/' /etc/dnsmasq.d/01-pihole.conf
|
||||
sed -i 's/^QUERY_LOGGING=false/QUERY_LOGGING=true/' /etc/pihole/setupVars.conf
|
||||
echo "::: Logging has been enabled!"
|
||||
else
|
||||
echo "::: Invalid option passed, please pass 'on' or 'off'"
|
||||
exit 1
|
||||
fi
|
||||
restartDNS
|
||||
}
|
||||
|
||||
piholeStatus() {
|
||||
if [[ $(netstat -plnt | grep -c ':53 ') > 0 ]]; then
|
||||
if [[ "${1}" != "web" ]] ; then
|
||||
echo "::: DNS service is running"
|
||||
fi
|
||||
else
|
||||
if [[ "${1}" == "web" ]] ; then
|
||||
echo "-1";
|
||||
else
|
||||
echo "::: DNS service is NOT running"
|
||||
fi
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ $(grep -i "^#addn-hosts=/" /etc/dnsmasq.d/01-pihole.conf) ]] ; then
|
||||
#list is commented out
|
||||
if [[ "${1}" == "web" ]] ; then
|
||||
echo 0;
|
||||
else
|
||||
echo "::: Pi-hole blocking is Disabled";
|
||||
fi
|
||||
elif [[ $(grep -i "^addn-hosts=/" /etc/dnsmasq.d/01-pihole.conf) ]] ; then
|
||||
#list set
|
||||
if [[ "${1}" == "web" ]] ; then
|
||||
echo 1;
|
||||
else
|
||||
echo "::: Pi-hole blocking is Enabled";
|
||||
fi
|
||||
else
|
||||
#addn-host not found
|
||||
if [[ "${1}" == "web" ]] ; then
|
||||
echo 99
|
||||
else
|
||||
echo "::: No hosts file linked to dnsmasq, adding it in enabled state"
|
||||
fi
|
||||
#add addn-host= to dnsmasq
|
||||
echo "addn-hosts=/etc/pihole/gravity.list" >> /etc/dnsmasq.d/01-pihole.conf
|
||||
restartDNS
|
||||
fi
|
||||
}
|
||||
|
||||
tailFunc() {
|
||||
echo "Press Ctrl-C to exit"
|
||||
tail -F /var/log/pihole.log
|
||||
exit 0
|
||||
}
|
||||
|
||||
helpFunc() {
|
||||
cat << EOM
|
||||
::: Control all PiHole specific functions!
|
||||
:::
|
||||
::: Usage: pihole [options]
|
||||
::: Add -h after -w (whitelist), -b (blacklist), -c (chronometer), or -a (admin) for more information on usage
|
||||
:::
|
||||
::: Options:
|
||||
::: -w, whitelist Whitelist domain(s)
|
||||
::: -b, blacklist Blacklist domain(s) (exact match)
|
||||
::: -wild, wildcard Blacklist whole domain(s) (wildcard)
|
||||
::: -d, debug Start a debugging session
|
||||
::: Automated debugging can be enabled with `-a`.
|
||||
::: 'pihole -d -a'
|
||||
::: -f, flush Flush the 'pihole.log' file
|
||||
::: -t, tail Output the last lines of the 'pihole.log' file. Lines are appended as the file grows
|
||||
::: -up, updatePihole Update Pi-hole components
|
||||
::: -r, reconfigure Reconfigure or Repair Pi-hole
|
||||
::: -g, updateGravity Update the list of ad-serving domains
|
||||
::: -c, chronometer Calculates stats and displays to an LCD
|
||||
::: -h, help Show this help dialog
|
||||
::: -v, version Show installed versions of Pi-Hole and Web-Admin
|
||||
::: -q, query Query the adlists for a specific domain
|
||||
::: 'pihole -q domain -exact' shows exact matches only
|
||||
::: -l, logging Enable or Disable logging (pass 'on' or 'off')
|
||||
::: -a, admin Admin webpage options
|
||||
::: uninstall Uninstall Pi-Hole from your system :(!
|
||||
::: status Is Pi-Hole Enabled or Disabled
|
||||
::: enable Enable Pi-Hole DNS Blocking
|
||||
::: disable Disable Pi-Hole DNS Blocking
|
||||
::: Blocking can also be disabled only temporarily, e.g.,
|
||||
::: 'pihole disable 5m' - will disable blocking for 5 minutes
|
||||
::: restartdns Restart dnsmasq
|
||||
EOM
|
||||
exit 0
|
||||
}
|
||||
|
||||
if [[ $# = 0 ]]; then
|
||||
helpFunc
|
||||
helpFunc
|
||||
fi
|
||||
|
||||
# Handle redirecting to specific functions based on arguments
|
||||
case "$1" in
|
||||
"-w" | "whitelist" ) whitelistFunc "$@";;
|
||||
"-b" | "blacklist" ) blacklistFunc "$@";;
|
||||
"-d" | "debug" ) debugFunc;;
|
||||
"-f" | "flush" ) flushFunc;;
|
||||
"-ud" | "updateDashboard" ) updateDashboardFunc;;
|
||||
"-up" | "updatePihole" ) updatePiholeFunc;;
|
||||
"-g" | "updateGravity" ) updateGravityFunc "$@";;
|
||||
"-s" | "setupLCD" ) setupLCDFunction;;
|
||||
"-c" | "chronometer" ) chronometerFunc "$@";;
|
||||
"-h" | "help" ) helpFunc;;
|
||||
"-v" | "version" ) versionFunc;;
|
||||
"-q" | "query" ) queryFunc "$@";;
|
||||
"uninstall" ) uninstallFunc;;
|
||||
* ) helpFunc;;
|
||||
case "${1}" in
|
||||
"-w" | "whitelist" ) whitelistFunc "$@";;
|
||||
"-b" | "blacklist" ) blacklistFunc "$@";;
|
||||
"-wild" | "wildcard" ) wildcardFunc "$@";;
|
||||
"-d" | "debug" ) debugFunc "$@";;
|
||||
"-f" | "flush" ) flushFunc;;
|
||||
"-up" | "updatePihole" ) updatePiholeFunc;;
|
||||
"-r" | "reconfigure" ) reconfigurePiholeFunc;;
|
||||
"-g" | "updateGravity" ) updateGravityFunc "$@";;
|
||||
"-c" | "chronometer" ) chronometerFunc "$@";;
|
||||
"-h" | "help" ) helpFunc;;
|
||||
"-v" | "version" ) versionFunc "$@";;
|
||||
"-q" | "query" ) queryFunc "$@";;
|
||||
"-l" | "logging" ) piholeLogging "$@";;
|
||||
"uninstall" ) uninstallFunc;;
|
||||
"enable" ) piholeEnable 1;;
|
||||
"disable" ) piholeEnable 0 $2;;
|
||||
"status" ) piholeStatus "$2";;
|
||||
"restartdns" ) restartDNS;;
|
||||
"-a" | "admin" ) webpageFunc "$@";;
|
||||
"-t" | "tail" ) tailFunc;;
|
||||
* ) helpFunc;;
|
||||
esac
|
||||
|
5
requirements.txt
Normal file
5
requirements.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
docker-compose
|
||||
pytest
|
||||
pytest-xdist
|
||||
pytest-cov
|
||||
testinfra
|
0
test/__init__.py
Normal file
0
test/__init__.py
Normal file
16
test/centos.Dockerfile
Normal file
16
test/centos.Dockerfile
Normal file
@@ -0,0 +1,16 @@
|
||||
FROM centos:7
|
||||
|
||||
ENV GITDIR /etc/.pihole
|
||||
ENV SCRIPTDIR /opt/pihole
|
||||
|
||||
RUN mkdir -p $GITDIR $SCRIPTDIR /etc/pihole
|
||||
ADD . $GITDIR
|
||||
RUN cp $GITDIR/advanced/Scripts/*.sh $GITDIR/gravity.sh $GITDIR/pihole $GITDIR/automated\ install/*.sh $SCRIPTDIR/
|
||||
ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$SCRIPTDIR
|
||||
|
||||
RUN true && \
|
||||
chmod +x $SCRIPTDIR/*
|
||||
|
||||
ENV PH_TEST true
|
||||
|
||||
#sed '/# Start the installer/Q' /opt/pihole/basic-install.sh > /opt/pihole/stub_basic-install.sh && \
|
61
test/conftest.py
Normal file
61
test/conftest.py
Normal file
@@ -0,0 +1,61 @@
|
||||
import pytest
|
||||
import testinfra
|
||||
|
||||
check_output = testinfra.get_backend(
|
||||
"local://"
|
||||
).get_module("Command").check_output
|
||||
|
||||
@pytest.fixture
|
||||
def Pihole(Docker):
|
||||
''' used to contain some script stubbing, now pretty much an alias.
|
||||
Also provides bash as the default run function shell '''
|
||||
def run_bash(self, command, *args, **kwargs):
|
||||
cmd = self.get_command(command, *args)
|
||||
if self.user is not None:
|
||||
out = self.run_local(
|
||||
"docker exec -u %s %s /bin/bash -c %s",
|
||||
self.user, self.name, cmd)
|
||||
else:
|
||||
out = self.run_local(
|
||||
"docker exec %s /bin/bash -c %s", self.name, cmd)
|
||||
out.command = self.encode(cmd)
|
||||
return out
|
||||
|
||||
funcType = type(Docker.run)
|
||||
Docker.run = funcType(run_bash, Docker, testinfra.backend.docker.DockerBackend)
|
||||
return Docker
|
||||
|
||||
@pytest.fixture
|
||||
def Docker(request, args, image, cmd):
|
||||
''' combine our fixtures into a docker run command and setup finalizer to cleanup '''
|
||||
assert 'docker' in check_output('id'), "Are you in the docker group?"
|
||||
docker_run = "docker run {} {} {}".format(args, image, cmd)
|
||||
docker_id = check_output(docker_run)
|
||||
|
||||
def teardown():
|
||||
check_output("docker rm -f %s", docker_id)
|
||||
request.addfinalizer(teardown)
|
||||
|
||||
docker_container = testinfra.get_backend("docker://" + docker_id)
|
||||
docker_container.id = docker_id
|
||||
return docker_container
|
||||
|
||||
@pytest.fixture
|
||||
def args(request):
|
||||
''' -t became required when tput began being used '''
|
||||
return '-t -d'
|
||||
|
||||
@pytest.fixture(params=['debian', 'centos'])
|
||||
def tag(request):
|
||||
''' consumed by image to make the test matrix '''
|
||||
return request.param
|
||||
|
||||
@pytest.fixture()
|
||||
def image(request, tag):
|
||||
''' built by test_000_build_containers.py '''
|
||||
return 'pytest_pihole:{}'.format(tag)
|
||||
|
||||
@pytest.fixture()
|
||||
def cmd(request):
|
||||
''' default to doing nothing by tailing null, but don't exit '''
|
||||
return 'tail -f /dev/null'
|
16
test/debian.Dockerfile
Normal file
16
test/debian.Dockerfile
Normal file
@@ -0,0 +1,16 @@
|
||||
FROM debian:jessie
|
||||
|
||||
ENV GITDIR /etc/.pihole
|
||||
ENV SCRIPTDIR /opt/pihole
|
||||
|
||||
RUN mkdir -p $GITDIR $SCRIPTDIR /etc/pihole
|
||||
ADD . $GITDIR
|
||||
RUN cp $GITDIR/advanced/Scripts/*.sh $GITDIR/gravity.sh $GITDIR/pihole $GITDIR/automated\ install/*.sh $SCRIPTDIR/
|
||||
ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$SCRIPTDIR
|
||||
|
||||
RUN true && \
|
||||
chmod +x $SCRIPTDIR/*
|
||||
|
||||
ENV PH_TEST true
|
||||
|
||||
#sed '/# Start the installer/Q' /opt/pihole/basic-install.sh > /opt/pihole/stub_basic-install.sh && \
|
18
test/test_000_build_containers.py
Normal file
18
test/test_000_build_containers.py
Normal file
@@ -0,0 +1,18 @@
|
||||
''' This file starts with 000 to make it run first '''
|
||||
import pytest
|
||||
import testinfra
|
||||
|
||||
run_local = testinfra.get_backend(
|
||||
"local://"
|
||||
).get_module("Command").run
|
||||
|
||||
@pytest.mark.parametrize("image,tag", [
|
||||
( 'test/debian.Dockerfile', 'pytest_pihole:debian' ),
|
||||
( 'test/centos.Dockerfile', 'pytest_pihole:centos' ),
|
||||
])
|
||||
def test_build_pihole_image(image, tag):
|
||||
build_cmd = run_local('docker build -f {} -t {} .'.format(image, tag))
|
||||
if build_cmd.rc != 0:
|
||||
print build_cmd.stdout
|
||||
print build_cmd.stderr
|
||||
assert build_cmd.rc == 0
|
325
test/test_automated_install.py
Normal file
325
test/test_automated_install.py
Normal file
@@ -0,0 +1,325 @@
|
||||
import pytest
|
||||
from textwrap import dedent
|
||||
|
||||
SETUPVARS = {
|
||||
'PIHOLE_INTERFACE' : 'eth99',
|
||||
'IPV4_ADDRESS' : '1.1.1.1',
|
||||
'IPV6_ADDRESS' : 'FE80::240:D0FF:FE48:4672',
|
||||
'PIHOLE_DNS_1' : '4.2.2.1',
|
||||
'PIHOLE_DNS_2' : '4.2.2.2'
|
||||
}
|
||||
|
||||
def test_setupVars_are_sourced_to_global_scope(Pihole):
|
||||
''' currently update_dialogs sources setupVars with a dot,
|
||||
then various other functions use the variables.
|
||||
This confirms the sourced variables are in scope between functions '''
|
||||
setup_var_file = 'cat <<EOF> /etc/pihole/setupVars.conf\n'
|
||||
for k,v in SETUPVARS.iteritems():
|
||||
setup_var_file += "{}={}\n".format(k, v)
|
||||
setup_var_file += "EOF\n"
|
||||
Pihole.run(setup_var_file)
|
||||
|
||||
script = dedent('''\
|
||||
set -e
|
||||
printSetupVars() {
|
||||
# Currently debug test function only
|
||||
echo "Outputting sourced variables"
|
||||
echo "PIHOLE_INTERFACE=${PIHOLE_INTERFACE}"
|
||||
echo "IPV4_ADDRESS=${IPV4_ADDRESS}"
|
||||
echo "IPV6_ADDRESS=${IPV6_ADDRESS}"
|
||||
echo "PIHOLE_DNS_1=${PIHOLE_DNS_1}"
|
||||
echo "PIHOLE_DNS_2=${PIHOLE_DNS_2}"
|
||||
}
|
||||
update_dialogs() {
|
||||
. /etc/pihole/setupVars.conf
|
||||
}
|
||||
update_dialogs
|
||||
printSetupVars
|
||||
''')
|
||||
|
||||
output = run_script(Pihole, script).stdout
|
||||
|
||||
for k,v in SETUPVARS.iteritems():
|
||||
assert "{}={}".format(k, v) in output
|
||||
|
||||
def test_setupVars_saved_to_file(Pihole):
|
||||
''' confirm saved settings are written to a file for future updates to re-use '''
|
||||
set_setup_vars = '\n' # dedent works better with this and padding matching script below
|
||||
for k,v in SETUPVARS.iteritems():
|
||||
set_setup_vars += " {}={}\n".format(k, v)
|
||||
Pihole.run(set_setup_vars).stdout
|
||||
|
||||
script = dedent('''\
|
||||
set -e
|
||||
echo start
|
||||
TERM=xterm
|
||||
source /opt/pihole/basic-install.sh
|
||||
{}
|
||||
finalExports
|
||||
cat /etc/pihole/setupVars.conf
|
||||
'''.format(set_setup_vars))
|
||||
|
||||
output = run_script(Pihole, script).stdout
|
||||
|
||||
for k,v in SETUPVARS.iteritems():
|
||||
assert "{}={}".format(k, v) in output
|
||||
|
||||
def test_configureFirewall_firewalld_running_no_errors(Pihole):
|
||||
''' confirms firewalld rules are applied when firewallD is running '''
|
||||
# firewallD returns 'running' as status
|
||||
mock_command('firewall-cmd', {'*':('running', 0)}, Pihole)
|
||||
# Whiptail dialog returns Ok for user prompt
|
||||
mock_command('whiptail', {'*':('', 0)}, Pihole)
|
||||
configureFirewall = Pihole.run('''
|
||||
source /opt/pihole/basic-install.sh
|
||||
configureFirewall
|
||||
''')
|
||||
expected_stdout = 'Configuring FirewallD for httpd and dnsmasq.'
|
||||
assert expected_stdout in configureFirewall.stdout
|
||||
firewall_calls = Pihole.run('cat /var/log/firewall-cmd').stdout
|
||||
assert 'firewall-cmd --state' in firewall_calls
|
||||
assert 'firewall-cmd --permanent --add-port=80/tcp --add-port=53/tcp --add-port=53/udp' in firewall_calls
|
||||
assert 'firewall-cmd --reload' in firewall_calls
|
||||
|
||||
def test_configureFirewall_firewalld_disabled_no_errors(Pihole):
|
||||
''' confirms firewalld rules are not applied when firewallD is not running '''
|
||||
# firewallD returns non-running status
|
||||
mock_command('firewall-cmd', {'*':('not running', '1')}, Pihole)
|
||||
configureFirewall = Pihole.run('''
|
||||
source /opt/pihole/basic-install.sh
|
||||
configureFirewall
|
||||
''')
|
||||
expected_stdout = 'No active firewall detected.. skipping firewall configuration.'
|
||||
assert expected_stdout in configureFirewall.stdout
|
||||
|
||||
def test_configureFirewall_firewalld_enabled_declined_no_errors(Pihole):
|
||||
''' confirms firewalld rules are not applied when firewallD is running, user declines ruleset '''
|
||||
# firewallD returns running status
|
||||
mock_command('firewall-cmd', {'*':('running', 0)}, Pihole)
|
||||
# Whiptail dialog returns Cancel for user prompt
|
||||
mock_command('whiptail', {'*':('', 1)}, Pihole)
|
||||
configureFirewall = Pihole.run('''
|
||||
source /opt/pihole/basic-install.sh
|
||||
configureFirewall
|
||||
''')
|
||||
expected_stdout = 'Not installing firewall rulesets.'
|
||||
assert expected_stdout in configureFirewall.stdout
|
||||
|
||||
def test_configureFirewall_no_firewall(Pihole):
|
||||
''' confirms firewall skipped no daemon is running '''
|
||||
configureFirewall = Pihole.run('''
|
||||
source /opt/pihole/basic-install.sh
|
||||
configureFirewall
|
||||
''')
|
||||
expected_stdout = 'No active firewall detected'
|
||||
assert expected_stdout in configureFirewall.stdout
|
||||
|
||||
def test_configureFirewall_IPTables_enabled_declined_no_errors(Pihole):
|
||||
''' confirms IPTables rules are not applied when IPTables is running, user declines ruleset '''
|
||||
# iptables command exists
|
||||
mock_command('iptables', {'*':('', '0')}, Pihole)
|
||||
# modinfo returns always true (ip_tables module check)
|
||||
mock_command('modinfo', {'*':('', '0')}, Pihole)
|
||||
# Whiptail dialog returns Cancel for user prompt
|
||||
mock_command('whiptail', {'*':('', '1')}, Pihole)
|
||||
configureFirewall = Pihole.run('''
|
||||
source /opt/pihole/basic-install.sh
|
||||
configureFirewall
|
||||
''')
|
||||
expected_stdout = 'Not installing firewall rulesets.'
|
||||
assert expected_stdout in configureFirewall.stdout
|
||||
|
||||
def test_configureFirewall_IPTables_enabled_rules_exist_no_errors(Pihole):
|
||||
''' confirms IPTables rules are not applied when IPTables is running and rules exist '''
|
||||
# iptables command exists and returns 0 on calls (should return 0 on iptables -C)
|
||||
mock_command('iptables', {'-S':('-P INPUT DENY', '0')}, Pihole)
|
||||
# modinfo returns always true (ip_tables module check)
|
||||
mock_command('modinfo', {'*':('', '0')}, Pihole)
|
||||
# Whiptail dialog returns Cancel for user prompt
|
||||
mock_command('whiptail', {'*':('', '0')}, Pihole)
|
||||
configureFirewall = Pihole.run('''
|
||||
source /opt/pihole/basic-install.sh
|
||||
configureFirewall
|
||||
''')
|
||||
expected_stdout = 'Installing new IPTables firewall rulesets'
|
||||
assert expected_stdout in configureFirewall.stdout
|
||||
firewall_calls = Pihole.run('cat /var/log/iptables').stdout
|
||||
assert 'iptables -I INPUT 1 -p tcp -m tcp --dport 80 -j ACCEPT' not in firewall_calls
|
||||
assert 'iptables -I INPUT 1 -p tcp -m tcp --dport 53 -j ACCEPT' not in firewall_calls
|
||||
assert 'iptables -I INPUT 1 -p udp -m udp --dport 53 -j ACCEPT' not in firewall_calls
|
||||
|
||||
def test_configureFirewall_IPTables_enabled_not_exist_no_errors(Pihole):
|
||||
''' confirms IPTables rules are applied when IPTables is running and rules do not exist '''
|
||||
# iptables command and returns 0 on calls (should return 1 on iptables -C)
|
||||
mock_command('iptables', {'-S':('-P INPUT DENY', '0'), '-C':('', 1), '-I':('', 0)}, Pihole)
|
||||
# modinfo returns always true (ip_tables module check)
|
||||
mock_command('modinfo', {'*':('', '0')}, Pihole)
|
||||
# Whiptail dialog returns Cancel for user prompt
|
||||
mock_command('whiptail', {'*':('', '0')}, Pihole)
|
||||
configureFirewall = Pihole.run('''
|
||||
source /opt/pihole/basic-install.sh
|
||||
configureFirewall
|
||||
''')
|
||||
expected_stdout = 'Installing new IPTables firewall rulesets'
|
||||
assert expected_stdout in configureFirewall.stdout
|
||||
firewall_calls = Pihole.run('cat /var/log/iptables').stdout
|
||||
assert 'iptables -I INPUT 1 -p tcp -m tcp --dport 80 -j ACCEPT' in firewall_calls
|
||||
assert 'iptables -I INPUT 1 -p tcp -m tcp --dport 53 -j ACCEPT' in firewall_calls
|
||||
assert 'iptables -I INPUT 1 -p udp -m udp --dport 53 -j ACCEPT' in firewall_calls
|
||||
|
||||
def test_installPiholeWeb_fresh_install_no_errors(Pihole):
|
||||
''' confirms all web page assets from Core repo are installed on a fresh build '''
|
||||
installWeb = Pihole.run('''
|
||||
source /opt/pihole/basic-install.sh
|
||||
installPiholeWeb
|
||||
''')
|
||||
assert 'Installing pihole custom index page...' in installWeb.stdout
|
||||
assert 'No default index.lighttpd.html file found... not backing up' in installWeb.stdout
|
||||
web_directory = Pihole.run('ls -r /var/www/html/pihole').stdout
|
||||
assert 'index.php' in web_directory
|
||||
assert 'index.js' in web_directory
|
||||
assert 'blockingpage.css' in web_directory
|
||||
|
||||
def test_installPiholeWeb_empty_directory_no_errors(Pihole):
|
||||
''' confirms all web page assets from Core repo are installed in an emtpy directory '''
|
||||
installWeb = Pihole.run('''
|
||||
source /opt/pihole/basic-install.sh
|
||||
mkdir -p /var/www/html/pihole
|
||||
installPiholeWeb
|
||||
''')
|
||||
assert 'Installing pihole custom index page...' in installWeb.stdout
|
||||
assert 'No default index.lighttpd.html file found... not backing up' not in installWeb.stdout
|
||||
assert 'index.php missing, replacing...' in installWeb.stdout
|
||||
assert 'index.js missing, replacing...' in installWeb.stdout
|
||||
assert 'blockingpage.css missing, replacing...' in installWeb.stdout
|
||||
web_directory = Pihole.run('ls -r /var/www/html/pihole').stdout
|
||||
assert 'index.php' in web_directory
|
||||
assert 'index.js' in web_directory
|
||||
assert 'blockingpage.css' in web_directory
|
||||
|
||||
def test_installPiholeWeb_index_php_no_errors(Pihole):
|
||||
''' confirms all web page assets from Core repo are installed when necessary '''
|
||||
installWeb = Pihole.run('''
|
||||
source /opt/pihole/basic-install.sh
|
||||
mkdir -p /var/www/html/pihole
|
||||
touch /var/www/html/pihole/index.php
|
||||
installPiholeWeb
|
||||
''')
|
||||
assert 'Installing pihole custom index page...' in installWeb.stdout
|
||||
assert 'No default index.lighttpd.html file found... not backing up' not in installWeb.stdout
|
||||
assert 'Existing index.php detected, not overwriting' in installWeb.stdout
|
||||
assert 'index.js missing, replacing...' in installWeb.stdout
|
||||
assert 'blockingpage.css missing, replacing...' in installWeb.stdout
|
||||
web_directory = Pihole.run('ls -r /var/www/html/pihole').stdout
|
||||
assert 'index.php' in web_directory
|
||||
assert 'index.js' in web_directory
|
||||
assert 'blockingpage.css' in web_directory
|
||||
|
||||
def test_installPiholeWeb_index_js_no_errors(Pihole):
|
||||
''' confirms all web page assets from Core repo are installed when necessary '''
|
||||
installWeb = Pihole.run('''
|
||||
source /opt/pihole/basic-install.sh
|
||||
mkdir -p /var/www/html/pihole
|
||||
touch /var/www/html/pihole/index.js
|
||||
installPiholeWeb
|
||||
''')
|
||||
assert 'Installing pihole custom index page...' in installWeb.stdout
|
||||
assert 'No default index.lighttpd.html file found... not backing up' not in installWeb.stdout
|
||||
assert 'index.php missing, replacing...' in installWeb.stdout
|
||||
assert 'Existing index.js detected, not overwriting' in installWeb.stdout
|
||||
assert 'blockingpage.css missing, replacing...' in installWeb.stdout
|
||||
web_directory = Pihole.run('ls -r /var/www/html/pihole').stdout
|
||||
assert 'index.php' in web_directory
|
||||
assert 'index.js' in web_directory
|
||||
assert 'blockingpage.css' in web_directory
|
||||
|
||||
def test_installPiholeWeb_blockingpage_css_no_errors(Pihole):
|
||||
''' confirms all web page assets from Core repo are installed when necessary '''
|
||||
installWeb = Pihole.run('''
|
||||
source /opt/pihole/basic-install.sh
|
||||
mkdir -p /var/www/html/pihole
|
||||
touch /var/www/html/pihole/blockingpage.css
|
||||
installPiholeWeb
|
||||
''')
|
||||
assert 'Installing pihole custom index page...' in installWeb.stdout
|
||||
assert 'No default index.lighttpd.html file found... not backing up' not in installWeb.stdout
|
||||
assert 'index.php missing, replacing...' in installWeb.stdout
|
||||
assert 'index.js missing, replacing...' in installWeb.stdout
|
||||
assert 'Existing blockingpage.css detected, not overwriting' in installWeb.stdout
|
||||
web_directory = Pihole.run('ls -r /var/www/html/pihole').stdout
|
||||
assert 'index.php' in web_directory
|
||||
assert 'index.js' in web_directory
|
||||
assert 'blockingpage.css' in web_directory
|
||||
|
||||
def test_installPiholeWeb_already_populated_no_errors(Pihole):
|
||||
''' confirms all web page assets from Core repo are installed when necessary '''
|
||||
installWeb = Pihole.run('''
|
||||
source /opt/pihole/basic-install.sh
|
||||
mkdir -p /var/www/html/pihole
|
||||
touch /var/www/html/pihole/index.php
|
||||
touch /var/www/html/pihole/index.js
|
||||
touch /var/www/html/pihole/blockingpage.css
|
||||
installPiholeWeb
|
||||
''')
|
||||
assert 'Installing pihole custom index page...' in installWeb.stdout
|
||||
assert 'No default index.lighttpd.html file found... not backing up' not in installWeb.stdout
|
||||
assert 'Existing index.php detected, not overwriting' in installWeb.stdout
|
||||
assert 'index.php missing, replacing...' not in installWeb.stdout
|
||||
assert 'Existing index.js detected, not overwriting' in installWeb.stdout
|
||||
assert 'index.js missing, replacing...' not in installWeb.stdout
|
||||
assert 'Existing blockingpage.css detected, not overwriting' in installWeb.stdout
|
||||
assert 'blockingpage.css missing, replacing... ' not in installWeb.stdout
|
||||
web_directory = Pihole.run('ls -r /var/www/html/pihole').stdout
|
||||
assert 'index.php' in web_directory
|
||||
assert 'index.js' in web_directory
|
||||
assert 'blockingpage.css' in web_directory
|
||||
|
||||
def test_update_package_cache_success_no_errors(Pihole):
|
||||
''' confirms package cache was updated without any errors'''
|
||||
updateCache = Pihole.run('''
|
||||
source /opt/pihole/basic-install.sh
|
||||
distro_check
|
||||
update_package_cache
|
||||
''')
|
||||
assert 'Updating local cache of available packages...' in updateCache.stdout
|
||||
assert 'ERROR' not in updateCache.stdout
|
||||
assert 'done!' in updateCache.stdout
|
||||
|
||||
def test_update_package_cache_failure_no_errors(Pihole):
|
||||
''' confirms package cache was not updated'''
|
||||
mock_command('apt-get', {'update':('', '1')}, Pihole)
|
||||
updateCache = Pihole.run('''
|
||||
source /opt/pihole/basic-install.sh
|
||||
distro_check
|
||||
update_package_cache
|
||||
''')
|
||||
assert 'Updating local cache of available packages...' in updateCache.stdout
|
||||
assert 'ERROR' in updateCache.stdout
|
||||
assert 'done!' not in updateCache.stdout
|
||||
|
||||
# Helper functions
|
||||
def mock_command(script, args, container):
|
||||
''' Allows for setup of commands we don't really want to have to run for real in unit tests '''
|
||||
full_script_path = '/usr/local/bin/{}'.format(script)
|
||||
mock_script = dedent('''\
|
||||
#!/bin/bash -e
|
||||
echo "\$0 \$@" >> /var/log/{script}
|
||||
case "\$1" in'''.format(script=script))
|
||||
for k, v in args.iteritems():
|
||||
case = dedent('''
|
||||
{arg})
|
||||
echo {res}
|
||||
exit {retcode}
|
||||
;;'''.format(arg=k, res=v[0], retcode=v[1]))
|
||||
mock_script += case
|
||||
mock_script += dedent('''
|
||||
esac''')
|
||||
container.run('''
|
||||
cat <<EOF> {script}\n{content}\nEOF
|
||||
chmod +x {script}
|
||||
rm -f /var/log/{scriptlog}'''.format(script=full_script_path, content=mock_script, scriptlog=script))
|
||||
|
||||
def run_script(Pihole, script):
|
||||
result = Pihole.run(script)
|
||||
assert result.rc == 0
|
||||
return result
|
13
test/test_shellcheck.py
Normal file
13
test/test_shellcheck.py
Normal file
@@ -0,0 +1,13 @@
|
||||
import pytest
|
||||
import testinfra
|
||||
|
||||
run_local = testinfra.get_backend(
|
||||
"local://"
|
||||
).get_module("Command").run
|
||||
|
||||
def test_scripts_pass_shellcheck():
|
||||
''' Make sure shellcheck does not find anything wrong with our shell scripts '''
|
||||
shellcheck = "find . -type f \( -name 'update.sh' -o -name 'piholeDebug.sh' \) | while read file; do shellcheck \"$file\"; done;"
|
||||
results = run_local(shellcheck)
|
||||
print results.stdout
|
||||
assert '' == results.stdout
|
Reference in New Issue
Block a user