Skip to content

Commit 743fc46

Browse files
committed
added sparky-ca
0 parents  commit 743fc46

File tree

10 files changed

+1152
-0
lines changed

10 files changed

+1152
-0
lines changed

CHANGELOG

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
-------------------------------------------------------------------------------
2+
Version 0.1.0 (2018-02-18)
3+
-------------------------------------------------------------------------------
4+
* Initial release

LICENSE

Lines changed: 674 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
Sparky CA
2+
This tool downloads and installs PJeOffice CA Certificates
3+
4+
Copyright (C) 2018 Paweł Pijanowski and others, see copyright file.
5+
6+
This program is free software: you can redistribute it and/or modify
7+
it under the terms of the GNU General Public License as published by
8+
the Free Software Foundation, either version 3 of the License, or
9+
(at your option) any later version.
10+
11+
This program is distributed in the hope that it will be useful,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
GNU General Public License for more details.
15+
16+
You should have received a copy of the GNU General Public License
17+
along with this program. If not, see <http://www.gnu.org/licenses/>.
18+
19+
Dependencies:
20+
-------------
21+
ca-certificates
22+
coreutils
23+
grep
24+
sparky-remsu
25+
sparky-xterm
26+
wget
27+
yad
28+
29+
Install:
30+
-------------
31+
su (or sudo)
32+
./install.sh
33+
34+
Uninstall:
35+
-------------
36+
su (or sudo)
37+
./install.sh uninstall

bin/sparky-ca

Lines changed: 300 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,300 @@
1+
#!/bin/bash
2+
#
3+
# Created by Paweł "pavroo" Pijanowski 2018/02/17
4+
# Copyright 2018 under the GNU GPL2 License
5+
# Last update 2018/02/18
6+
#
7+
# This script requires yad to run
8+
9+
# get default's locale file
10+
DEFLOCDIR="/usr/share/sparky/sparky-ca"
11+
if [ "`cat /etc/default/locale | grep pl_PL`" != "" ]; then
12+
. $DEFLOCDIR/pl
13+
elif [ "`cat /etc/default/locale | grep pt_BR`" != "" ]; then
14+
. $DEFLOCDIR/pt_BR
15+
else
16+
. $DEFLOCDIR/en
17+
fi
18+
19+
testroot="`whoami`"
20+
if [ "$testroot" != "root" ]; then
21+
echo "Must be root...Exiting"
22+
exit 1
23+
fi
24+
25+
DIALOG="yad --window-icon=seahorse --width=500 --height=320 --center"
26+
DIALOG4="yad --window-icon=seahorse --width=450 --height=250 --center"
27+
TITLE="--always-print-result --dialog-sep --image=seahorse --title="
28+
TEXT="--text="
29+
MENU="--list --column=$LOCAL1 --column=$LOCAL2"
30+
OKEXIT="--button=Ok:0 --button=$LOCAL3:1"
31+
YESNO="--button=$LOCAL13:0 --button=$LOCAL14:1"
32+
MSGBOX="--button=Ok:0"
33+
TITLETEXT="$LOCAL4"
34+
35+
if [ -f /usr/bin/sparky-terminal ]; then
36+
SPARKYXTERM="sparky-terminal"
37+
else
38+
SPARKYXTERM="x-terminal-emulator"
39+
fi
40+
41+
CADIR="/usr/local/share/ca-certificates"
42+
CABRDIR="ICP-Brazil"
43+
if [ ! -d $CADIR/$CABRDIR ]; then
44+
mkdir -p $CADIR/$CABRDIR
45+
fi
46+
cd $CADIR/$CABRDIR
47+
48+
# Brazilian certificates servers
49+
BRSERVER1="http://acraiz.icpbrasil.gov.br/credenciadas/RAIZ"
50+
BRSERVER2="http://acraiz.icpbrasil.gov.br/credenciadas/CERTISIGN"
51+
BRSERVER3="http://acraiz.icpbrasil.gov.br/credenciadas/CERTISIGN"
52+
BRSERBER4="http://acraiz.icpbrasil.gov.br/credenciadas/JUS"
53+
54+
# Brazilian certificates names
55+
# 1:ICP root
56+
BRCA1="ICP-Brasil.crt"
57+
BRCA2="ICP-Brasilv2.crt"
58+
BRCA3="ICP-Brasilv4.crt"
59+
# 2:CertSign Chains
60+
BRCA4="AC_Certisign_G3.crt"
61+
BRCA5="AC_Certisign_G6.crt"
62+
BRCA6="AC_Certisign_G7.crt"
63+
# 3:OAB chains
64+
BRCA7="AC_Oab_G2.crt"
65+
BRCA8="AC_OAB_G3.crt"
66+
# 4:Justice chains
67+
BRCA9="Autoridade_Certificadora_da_Justica_v3.crt"
68+
BRCA10="Autoridade_Certificadora_da_Justica_v4.crt"
69+
BRCA11="Autoridade_Certificadora_da_Justica_v5.crt"
70+
71+
mainmenu () {
72+
73+
CHOICES=`$DIALOG $TITLE"$TITLETEXT" $MENU $OKEXIT $TEXT"$LOCAL5:" \
74+
BR1 "$LOCAL6" \
75+
BR2 "$LOCAL7" \
76+
BR3 "$LOCAL8" \
77+
BR4 "$LOCAL9" \
78+
Exit "$LOCAL3"`
79+
80+
if [ "$?" = "0" ]; then
81+
CHOICE=`echo $CHOICES | cut -d "|" -f 1`
82+
else
83+
exit 0
84+
fi
85+
86+
if [ "$CHOICE" = "BR1" ]; then
87+
br1menu
88+
elif [ "$CHOICE" = "BR2" ]; then
89+
br2menu
90+
elif [ "$CHOICE" = "BR3" ]; then
91+
br3menu
92+
elif [ "$CHOICE" = "BR4" ]; then
93+
br4menu
94+
elif [ "$CHOICE" = "Exit" ]; then
95+
exit 0
96+
else
97+
exit 0
98+
fi
99+
}
100+
101+
br1menu () {
102+
if [ -f $BRCA1 ]; then
103+
$DIALOG4 $TITLE"$TITLETEXT" $YESNO $TEXT"\n$BRCA1 $LOCAL11\n$LOCAL12"
104+
if [ "$?" = "0" ]; then
105+
rm -f $BRCA1
106+
$SPARKYXTERM -e "wget $BRSERVER1/$BRCA1"
107+
fi
108+
else
109+
$SPARKYXTERM -e "wget $BRSERVER1/$BRCA1"
110+
fi
111+
112+
if [ -f $BRCA2 ]; then
113+
$DIALOG4 $TITLE"$TITLETEXT" $YESNO $TEXT"\n$BRCA2 $LOCAL11\n$LOCAL12"
114+
if [ "$?" = "0" ]; then
115+
rm -f $BRCA2
116+
$SPARKYXTERM -e "wget $BRSERVER1/$BRCA2"
117+
fi
118+
else
119+
$SPARKYXTERM -e "wget $BRSERVER1/$BRCA2"
120+
fi
121+
122+
if [ -f $BRCA3 ]; then
123+
$DIALOG4 $TITLE"$TITLETEXT" $YESNO $TEXT"\n$BRCA3 $LOCAL11\n$LOCAL12"
124+
if [ "$?" = "0" ]; then
125+
rm -f $BRCA3
126+
$SPARKYXTERM -e "wget $BRSERVER1/$BRCA3"
127+
fi
128+
else
129+
$SPARKYXTERM -e "wget $BRSERVER1/$BRCA3"
130+
fi
131+
132+
$SPARKYXTERM -e "update-ca-certificates"
133+
134+
if [ -f $BRCA1 ]; then
135+
BRCA1CHECK=$BRCA1
136+
else
137+
BRCA1CHECK=""
138+
fi
139+
if [ -f $BRCA2 ]; then
140+
BRCA2CHECK=$BRCA2
141+
else
142+
BRCA2CHECK=""
143+
fi
144+
if [ -f $BRCA3 ]; then
145+
BRCA3CHECK=$BRCA3
146+
else
147+
BRCA3CHECK=""
148+
fi
149+
150+
$DIALOG $TITLE"$TITLETEXT" $MSGBOX $TEXT"\n$LOCAL15\n$BRCA1CHECK\n$BRCA2CHECK\n$BRCA3CHECK"
151+
mainmenu
152+
}
153+
154+
br2menu () {
155+
if [ -f $BRCA4 ]; then
156+
$DIALOG4 $TITLE"$TITLETEXT" $YESNO $TEXT"\n$BRCA4 $LOCAL11\n$LOCAL12"
157+
if [ "$?" = "0" ]; then
158+
rm -f $BRCA4
159+
$SPARKYXTERM -e "wget $BRSERVER2/v1/p/$BRCA4"
160+
fi
161+
else
162+
$SPARKYXTERM -e "wget $BRSERVER2/v1/p/$BRCA4"
163+
fi
164+
165+
if [ -f $BRCA5 ]; then
166+
$DIALOG4 $TITLE"$TITLETEXT" $YESNO $TEXT"\n$BRCA5 $LOCAL11\n$LOCAL12"
167+
if [ "$?" = "0" ]; then
168+
rm -f $BRCA5
169+
$SPARKYXTERM -e "wget $BRSERVER2/v2/p/$BRCA5"
170+
fi
171+
else
172+
$SPARKYXTERM -e "wget $BRSERVER2/v2/p/$BRCA5"
173+
fi
174+
175+
if [ -f $BRCA6 ]; then
176+
$DIALOG4 $TITLE"$TITLETEXT" $YESNO $TEXT"\n$BRCA6 $LOCAL11\n$LOCAL12"
177+
if [ "$?" = "0" ]; then
178+
rm -f $BRCA6
179+
$SPARKYXTERM -e "wget $BRSERVER2/v5/p/$BRCA6"
180+
fi
181+
else
182+
$SPARKYXTERM -e "wget $BRSERVER2/v5/p/$BRCA6"
183+
fi
184+
185+
$SPARKYXTERM -e "update-ca-certificates"
186+
187+
if [ -f $BRCA4 ]; then
188+
BRCA4CHECK=$BRCA4
189+
else
190+
BRCA4CHECK=""
191+
fi
192+
if [ -f $BRCA5 ]; then
193+
BRCA5CHECK=$BRCA5
194+
else
195+
BRCA5CHECK=""
196+
fi
197+
if [ -f $BRCA6 ]; then
198+
BRCA6CHECK=$BRCA6
199+
else
200+
BRCA6CHECK=""
201+
fi
202+
203+
$DIALOG $TITLE"$TITLETEXT" $MSGBOX $TEXT"\n$LOCAL15\n$BRCA4CHECK\n$BRCA5CHECK\n$BRCA6CHECK"
204+
mainmenu
205+
}
206+
207+
br3menu () {
208+
if [ -f $BRCA7 ]; then
209+
$DIALOG4 $TITLE"$TITLETEXT" $YESNO $TEXT"\n$BRCA7 $LOCAL11\n$LOCAL12"
210+
if [ "$?" = "0" ]; then
211+
rm -f $BRCA7
212+
$SPARKYXTERM -e "wget $BRSERVER3/v2/$BRCA7"
213+
fi
214+
else
215+
$SPARKYXTERM -e "wget $BRSERVER3/v2/$BRCA7"
216+
fi
217+
218+
if [ -f $BRCA8 ]; then
219+
$DIALOG4 $TITLE"$TITLETEXT" $YESNO $TEXT"\n$BRCA8 $LOCAL11\n$LOCAL12"
220+
if [ "$?" = "0" ]; then
221+
rm -f $BRCA8
222+
$SPARKYXTERM -e "wget $BRSERVER3/v5/$BRCA8"
223+
fi
224+
else
225+
$SPARKYXTERM -e "wget $BRSERVER3/v5/$BRCA8"
226+
fi
227+
228+
$SPARKYXTERM -e "update-ca-certificates"
229+
230+
if [ -f $BRCA7 ]; then
231+
BRCA7CHECK=$BRCA7
232+
else
233+
BRCA7CHECK=""
234+
fi
235+
if [ -f $BRCA8 ]; then
236+
BRCA8CHECK=$BRCA8
237+
else
238+
BRCA8CHECK=""
239+
fi
240+
241+
$DIALOG $TITLE"$TITLETEXT" $MSGBOX $TEXT"\n$LOCAL15\n$BRCA7CHECK\n$BRCA8CHECK"
242+
mainmenu
243+
}
244+
245+
br4menu () {
246+
if [ -f $BRCA9 ]; then
247+
$DIALOG4 $TITLE"$TITLETEXT" $YESNO $TEXT"\n$BRCA9 $LOCAL11\n$LOCAL12"
248+
if [ "$?" = "0" ]; then
249+
rm -f $BRCA9
250+
$SPARKYXTERM -e "wget $BRSERVER4/v1/p/$BRCA9"
251+
fi
252+
else
253+
$SPARKYXTERM -e "wget $BRSERVER4/v1/p/$BRCA9"
254+
fi
255+
256+
if [ -f $BRCA2 ]; then
257+
$DIALOG4 $TITLE"$TITLETEXT" $YESNO $TEXT"\n$BRCA10 $LOCAL11\n$LOCAL12"
258+
if [ "$?" = "0" ]; then
259+
rm -f $BRCA10
260+
$SPARKYXTERM -e "wget $BRSERVER4/v1/p/$BRCA10"
261+
fi
262+
else
263+
$SPARKYXTERM -e "wget $BRSERVER4/v1/p/$BRCA10"
264+
fi
265+
266+
if [ -f $BRCA3 ]; then
267+
$DIALOG4 $TITLE"$TITLETEXT" $YESNO $TEXT"\n$BRCA11 $LOCAL11\n$LOCAL12"
268+
if [ "$?" = "0" ]; then
269+
rm -f $BRCA11
270+
$SPARKYXTERM -e "wget $BRSERVER4/v1/p/$BRCA11"
271+
fi
272+
else
273+
$SPARKYXTERM -e "wget $BRSERVER4/v1/p/$BRCA11"
274+
fi
275+
276+
$SPARKYXTERM -e "update-ca-certificates"
277+
278+
if [ -f $BRCA9 ]; then
279+
BRCA9CHECK=$BRCA9
280+
else
281+
BRCA9CHECK=""
282+
fi
283+
if [ -f $BRCA10 ]; then
284+
BRCA10CHECK=$BRCA10
285+
else
286+
BRCA10CHECK=""
287+
fi
288+
if [ -f $BRCA11 ]; then
289+
BRCA11CHECK=$BRCA11
290+
else
291+
BRCA11CHECK=""
292+
fi
293+
294+
$DIALOG $TITLE"$TITLETEXT" $MSGBOX $TEXT"\n$LOCAL15\n$BRCA9CHECK\n$BRCA10CHECK\n$BRCA11CHECK"
295+
mainmenu
296+
}
297+
298+
mainmenu
299+
300+
exit 0

copyright

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
Upstream Author(s):
2+
Paweł "pavroo" Pijanowski <[email protected]>
3+
4+
Files: *
5+
Copyright Paweł "pavroo" Pijanowski 2018
6+
License: GPL-2
7+
8+
File: pt_BR
9+
Copyright (C) 2018 Daniel Campos Ramos
10+
License: GPL-2
11+
12+
License:
13+
14+
This package is free software; you can redistribute it and/or modify
15+
it under the terms of the GNU General Public License as published by
16+
the Free Software Foundation; either version 2 of the License, or
17+
(at your option) any later version.
18+
19+
This package is distributed in the hope that it will be useful,
20+
but WITHOUT ANY WARRANTY; without even the implied warranty of
21+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22+
GNU General Public License for more details.
23+
24+
You should have received a copy of the GNU General Public License
25+
along with this package; if not, write to the Free Software
26+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27+
28+
On Debian systems, the complete text of the GNU General
29+
Public License can be found in `/usr/share/common-licenses/GPL'.

0 commit comments

Comments
 (0)