Skip to content

Commit

Permalink
Using https with the government CA certificate
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanb committed Mar 11, 2018
1 parent 45701ed commit a9ba3b3
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 8 deletions.
21 changes: 13 additions & 8 deletions scripts/si/getSource.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ fi
# read possibly existing credentials...
source $credentialsFile

echo Credentials for http://egp.gu.gov.si/egp/
echo Credentials for https://egp.gu.gov.si/egp/

if [ -z "$username" ]; then
echo -n " Username: ";
Expand Down Expand Up @@ -54,8 +54,9 @@ fi
wget --quiet \
--save-cookies cookies.txt \
--keep-session-cookies \
http://egp.gu.gov.si/egp/login.html
# example login.html content:;
--ca-certificate=sigov-ca2.pem \
"https://egp.gu.gov.si/egp/login.html"
# example login.html content:
# <input type="hidden" name="_csrf" value="089070ed-b40a-4e3c-ab22-422de0daffff" />
csrftoken="`sed -n 's/.*name="_csrf"\s\+value="\([^"]\+\).*/\1/p' login.html`"
rm login.html
Expand All @@ -69,30 +70,34 @@ loginFormData="username=${username}&password=${password}&_csrf=${csrftoken}"
wget --quiet --load-cookies cookies.txt \
--save-cookies cookies.txt \
--keep-session-cookies \
--referer http://egp.gu.gov.si/egp/ \
--referer https://egp.gu.gov.si/egp/ \
--post-data "${loginFormData}" \
--delete-after \
http://egp.gu.gov.si/egp/login.html
--ca-certificate=sigov-ca2.pem \
"https://egp.gu.gov.si/egp/login.html"

# Now grab the data we care about.

#RPE_PE.ZIP
wget --load-cookies cookies.txt \
--directory-prefix "${dest}" \
--content-disposition -N \
"http://egp.gu.gov.si/egp/download-file.html?id=105&format=10&d96=0"
--ca-certificate=sigov-ca2.pem \
"https://egp.gu.gov.si/egp/download-file.html?id=105&format=10&d96=0"

#RPE_UL.ZIP
wget --load-cookies cookies.txt \
--directory-prefix "${dest}" \
--content-disposition -N \
"http://egp.gu.gov.si/egp/download-file.html?id=106&format=10&d96=0"
--ca-certificate=sigov-ca2.pem \
"https://egp.gu.gov.si/egp/download-file.html?id=106&format=10&d96=0"

#RPE_HS.ZIP
wget --load-cookies cookies.txt \
--directory-prefix "${dest}" \
--content-disposition -N \
"http://egp.gu.gov.si/egp/download-file.html?id=107&format=10&d96=0"
--ca-certificate=sigov-ca2.pem \
"https://egp.gu.gov.si/egp/download-file.html?id=107&format=10&d96=0"

rm cookies.txt
rm login.htm*
Expand Down
28 changes: 28 additions & 0 deletions scripts/si/sigov-ca2.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
-----BEGIN CERTIFICATE-----
MIIEgDCCAuigAwIBAgINAL0ag3wAAAAAVnvHDjANBgkqhkiG9w0BAQsFADBXMQsw
CQYDVQQGEwJTSTEcMBoGA1UEChMTUmVwdWJsaWthIFNsb3ZlbmlqYTEXMBUGA1UE
YRMOVkFUU0ktMTc2NTk5NTcxETAPBgNVBAMTCFNJR09WLUNBMB4XDTE1MTIyNDA5
NTEwNloXDTM1MTIyNDEwMjEwNlowVzELMAkGA1UEBhMCU0kxHDAaBgNVBAoTE1Jl
cHVibGlrYSBTbG92ZW5pamExFzAVBgNVBGETDlZBVFNJLTE3NjU5OTU3MREwDwYD
VQQDEwhTSUdPVi1DQTCCAaIwDQYJKoZIhvcNAQEBBQADggGPADCCAYoCggGBAMwL
1q8WkYT8bgTgdHHvdMS+A0Fiep9eQA4Y2bNiLFYF2Gzj2ykP1Llg2SPQJBIJkB4R
x49celNikM/XOzsxtov4qnP8eO9N6Ez4pu68MldzHdWC2UpglR8vE9QMjn3zFdGM
88x84x5A7wxDr05kgeiPLy9KD2vSVsX7CNIAWXGv9FAE0ayCtsUNWQBH+nln/eR9
xJGSwYHySnvYniUwihAVsZMYRipBcjc8EpLWriaaQvxOhqmk8qwvTmbm9SCo4uTK
I9HGhIbhMQZ+6B/Q0cHNKa5hPJyQpJ9iWza7gBfUe7uU/Ee5Xj4WjNJlshS80wNu
S8y8gbkUvPPhAGuWEX0Hg5/v5yOpq6iMbkFL5vdLif4qdV06I/+j4oco8F761Obs
5VP39++QHUBF93Le6ZZBweftzCYegIUX/kRPyEoxmkUDCkme8HF0m6gJBF0prh7C
o4geBeEzSCq5DwxrKbb0ZhS30uxjEQr3dgXfxHqJQcfuyKdymlYEuGJ7TmmuVQID
AQABo0swSTAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjATBgNVHSME
DDAKgAhGXkDlU+3+/jARBgNVHQ4ECgQIRl5A5VPt/v4wDQYJKoZIhvcNAQELBQAD
ggGBAKuyWriPA495SJiRLk8xh4ikFkIMgum61AXGg6O2B2KGn44cNQWUlpbYBu9s
9z86K43+rKbgDcl6o40paRwfneKRHNsjiHmXDyZa7u74S6jGf+t9SO+TDlpBe6iu
Pl97Yw8LMtnktQuKMnuKms78RIJrX9K8JRFQiGkhIAduDwYdcQEbQ77sJxNdcfRL
hK5fNZFWQiyWmdBxwIyhec5s69Vsu44+wUACrCDHNH69vxfWkS39DO4m46gjHfNr
+vo+G6ATo2kQX2cLIBz7AX/aF5grR+K+4Y/hZdyKF3WR4eIJUcaZ72P80M09fOiM
0sgBAQNNUFKgqHBojawIH2ZtdrZHY361gSd86tXEoJbq5xKLE+Ux6+7p86IM2gAr
lzs89rwII0TdMcAbCTZnOrjqtgiMGac/LL8jbsLcJlkhwW4ZM8sxZoHqlrvd8Sm6
s43iLyLD/P6gsSCv65ZasettJxwVoBNF45qXEvQ973pkyPPK9DOrYs+r5801/MjD
eFARnA==
-----END CERTIFICATE-----

0 comments on commit a9ba3b3

Please sign in to comment.