This is an automated email from the ASF dual-hosted git repository.
vatamane pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb-pkg.git
The following commit(s) were added to refs/heads/main by this push:
new c4d15dd Improve /dev/random usage when generating cookies for RPM
distros
c4d15dd is described below
commit c4d15dd4c095d7f4f74be1b5f57cc387ec09fec2
Author: Nick Vatamaniuc <[email protected]>
AuthorDate: Mon Jun 13 15:13:05 2022 -0400
Improve /dev/random usage when generating cookies for RPM distros
In a low entropy environments, `/dev/random` will block, so make sure to use
only as many bytes as we'll need instead of reading and discarding bytes as
we
did previously.
---
rpm/SPECS/couchdb.spec.in | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/rpm/SPECS/couchdb.spec.in b/rpm/SPECS/couchdb.spec.in
index cfec522..e77f949 100644
--- a/rpm/SPECS/couchdb.spec.in
+++ b/rpm/SPECS/couchdb.spec.in
@@ -151,7 +151,7 @@ if %{__grep} -q "^-setcookie monster$"
/opt/%{name}/etc/vm.args; then
cookie=${COUCHDB_COOKIE}
else
echo "Generating random cookie value."
- cookie=$(cat /dev/random | tr -dc 'a-zA-Z0-9' | head --bytes 48)
+ cookie=$(dd if=/dev/random bs=1 count=38 status=none | base64 | tr -cd
[:alnum:])
fi
%{__sed} -i "s/^-setcookie monster.*$/-setcookie ${cookie}/"
/opt/%{name}/etc/vm.args
elif %{__grep} -q "^[# ]*-setcookie$" /opt/%{name}/etc/vm.args; then
@@ -161,7 +161,7 @@ elif %{__grep} -q "^[# ]*-setcookie$"
/opt/%{name}/etc/vm.args; then
cookie=${COUCHDB_COOKIE}
else
echo "Generating random cookie value."
- cookie=$(cat /dev/random | tr -dc 'a-zA-Z0-9' | head --bytes 48)
+ cookie=$(dd if=/dev/random bs=1 count=38 status=none | base64 | tr -cd
[:alnum:])
fi
%{__sed} -i "s/^[# ]*-setcookie.*$/-setcookie ${cookie}/"
/opt/%{name}/etc/vm.args
fi