Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Acme.Sh
Commits
bd8b1a25
Commit
bd8b1a25
authored
Sep 04, 2017
by
Manuel Friedli
Browse files
Don't use wget directly, but instead use _get and _post.
parent
a098167b
Changes
1
Hide whitespace changes
Inline
Side-by-side
deploy/fritzbox.sh
View file @
bd8b1a25
...
...
@@ -27,10 +27,6 @@ fritzbox_deploy() {
_debug _cca
"
$_cca
"
_debug _cfullchain
"
$_cfullchain
"
if
!
_exists wget
;
then
_err
"wget not found"
return
1
fi
if
!
_exists iconv
;
then
_err
"iconv not found"
return
1
...
...
@@ -60,10 +56,13 @@ fritzbox_deploy() {
_saveaccountconf DEPLOY_FRITZBOX_PASSWORD
"
${
_fritzbox_password
}
"
_saveaccountconf DEPLOY_FRITZBOX_URL
"
${
_fritzbox_url
}
"
# Do not check for a valid SSL certificate, because initially the cert is not valid, so it could not install the LE generated certificate
export
HTTPS_INSECURE
=
1
_info
"Log in to the FRITZ!Box"
_fritzbox_challenge
=
"
$(
w
get
--no-check-certificate
-q
-O
-
"
${
_fritzbox_url
}
/login_sid.lua"
|
sed
-e
's/^.*<Challenge>//'
-e
's/<\/Challenge>.*$//'
)
"
_fritzbox_challenge
=
"
$(
_
get
"
${
_fritzbox_url
}
/login_sid.lua"
|
sed
-e
's/^.*<Challenge>//'
-e
's/<\/Challenge>.*$//'
)
"
_fritzbox_hash
=
"
$(
printf
"%s-%s"
"
${
_fritzbox_challenge
}
"
"
${
_fritzbox_password
}
"
| iconv
-f
ASCII
-t
UTF16LE |
md5sum
|
awk
'{print $1}'
)
"
_fritzbox_sid
=
"
$(
w
get
--no-check-certificate
-q
-O
-
"
${
_fritzbox_url
}
/login_sid.lua?sid=0000000000000000&username=
${
_fritzbox_username
}
&response=
${
_fritzbox_challenge
}
-
${
_fritzbox_hash
}
"
|
sed
-e
's/^.*<SID>//'
-e
's/<\/SID>.*$//'
)
"
_fritzbox_sid
=
"
$(
_
get
"
${
_fritzbox_url
}
/login_sid.lua?sid=0000000000000000&username=
${
_fritzbox_username
}
&response=
${
_fritzbox_challenge
}
-
${
_fritzbox_hash
}
"
|
sed
-e
's/^.*<SID>//'
-e
's/<\/SID>.*$//'
)
"
if
[
-z
"
${
_fritzbox_sid
}
"
]
||
[
"
${
_fritzbox_sid
}
"
=
"0000000000000000"
]
;
then
_err
"Logging in to the FRITZ!Box failed. Please check username, password and URL."
...
...
@@ -91,10 +90,17 @@ fritzbox_deploy() {
}
>>
"
${
_post_request
}
"
_info
"Upload certificate to the FRITZ!Box"
wget
--no-check-certificate
-q
-O
-
"
${
_fritzbox_url
}
/cgi-bin/firmwarecfg"
--header
=
"Content-type: multipart/form-data boundary=
${
_post_boundary
}
"
--post-file
"
${
_post_request
}
"
|
grep
SSL
_info
"Upload successful"
export
_H1
=
"Content-type: multipart/form-data boundary=
${
_post_boundary
}
"
_post
"
$(
cat
${
_post_request
}
)
"
"
${
_fritzbox_url
}
/cgi-bin/firmwarecfg"
|
grep
SSL
retval
=
$?
if
[
$retval
=
0
]
;
then
_info
"Upload successful"
else
_err
"Upload failed"
fi
rm
"
${
_post_request
}
"
return
0
return
$retval
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment