gpg is promting for passphrase even after passphrase is set using gpg-preset-passphrase - gnupg

I need to preset the passhrase to decrypt credentials on an unattended machine.
I executed the below steps, even after the passphrase is preset gpg is prompting for password for the private key.
gpg --batch --allow-secret-key-import --import './test_private.key'
/usr/libexec/gpg-preset-passphrase --preset --passphrase "password" "KeygripID"
I am using gpg version2
bash-5.0# gpg --version
gpg (GnuPG) 2.2.23
libgcrypt 1.8.5
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Home: /root/.gnupg
Currently executing above steps in a docker container
bash-5.0# cat /etc/alpine-release
3.12.0
Any help is appreciated.

Related

Programs installed with Chocolatey cannot be executed

I am having a problem with programs that I installed with Chocolatey - namely that they cannot be executed. I am running Windows 10.
Chocolatey itself works - I can download and upgrade programs
the folder C:\ProgramData\chocolatey\bin\ is set in PATH under System Variables
I have a couple of packages installed, but I'll use two as an example here: ffmpeg and nano
If I run either nano --version or ffmpeg--version with Powershell I get in both cases:
ResourceUnavailable: Program 'nano.exe' failed to run: Access deniedAt line:1 >char:1
'+ nano
'+ ~~~~.
And the same for ffmpeg.
The weird thing is if I run the same with GitBash I get for nano:
GNU nano, version 4.9.3
(C) 1999-2011, 2013-2020 Free Software Foundation, Inc.
(C) 2014-2020 the contributors to nano
Email: nano#nano-editor.org Web: https://nano-editor.org/
Compiled options: --enable-utf8
and for ffmpeg
bash: /c/ProgramData/chocolatey/bin/ffmpeg: Permission denied
Any help is greatly appreciated!
Someone had a similar issue here and people thought antivirus software was the cause: Program 'tempCodeRunnerFile.exe' failed to run: Access is deniedAt line:1 char:110 VS Code error

Using Docker, how to change bash version inside Dockefile?

When I login into a running container, and issue a bash --version command I am seeing the following
root#sb-core-repo-7988897977-rdtkb:/myapp# bash --version
GNU bash, version 5.0.3(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Since, this GNU bash version 5.0.3 has a vulnerability, I would like to update the bash to 5.1.2 apparently, the vulnerability has been fixed in that release. as per vulnerability
How and what can I update in the Dockerfile to update the bash version?
My Dockerfile is like this:
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 AS base
WORKDIR /myapp
EXPOSE 80
## Installing tools for dotnet core
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 As pre-build
RUN apt-get update && apt-get install -y openjdk-11-jre
ENV PATH="$PATH:/root/.dotnet/tools"
FROM pre-build AS build
WORKDIR /src
COPY ["PhantomService.Application/PhantomService.Application.csproj", "PhantomService.Application/"]
COPY ["PhantomService.RestApi/NuGet.Config", "PhantomService.RestApi/"]
RUN dotnet restore "PhantomService.RestApi/PhantomService.RestApi.csproj" --configfile "PhantomService.RestApi/NuGet.Config"
## Build and Test
RUN dotnet build "PhantomService.RestApi/PhantomService.RestApi.csproj" -c Release -o /myapp
FROM build AS publish
RUN dotnet publish "PhantomService.RestApi/PhantomService.RestApi.csproj" -c Release -o /myapp
FROM base AS final
WORKDIR /myapp
COPY --from=publish /myapp .
ENTRYPOINT ["dotnet", "PhantomService.RestApi.dll"]
appreciate all the help and advice

Docker Oracle Instant Client

I have been trying for 4 days to:
Deploy Oracle Instant Client with Docker. I can give you the Dockerfile but it is 96 lines
To use Oracle Instant Client on my Linux Ubuntu latest.
In the end I arrive at the same two issues.
When installing OCI 8 with the command:
Docker:
RUN echo 'instantclient, / usr / local / instantclient' | pecl install
oci8
Ubuntu:
echo "instantclient, / opt / oracle / instantclient_12_2" | sudo pecl
install oci8
I get the error:
make: *** [Makefile: 194: oci8.lo] Error 1
ERROR: `make 'failed
Could not find a solution.
Make is correctly installed in both cases:
GNU Make 4.2.1 Built for x86_64-pc-linux-gnu Copyright (C) 1988-2016
Free Software Foundation, Inc. GPLv3 + license: GNU GPL version 3 or
later http://gnu.org/licenses/gpl.html This is free software: you
are free to change and redistribute it. There is NO WARRANTY, to the
extent permitted by law.
Do you have an idea ? It blocks me for the rest of my work.
BR,
Nicolas.
EDIT :
I try this :
pear download pecl/oci8
tar xvzf oci8-3.0.0.tgz
phpize
./configure --with-oci8=instantclient,/opt/oracle/instantclient_12_2/
make
Same issue :
make: *** [Makefile:194: oci8.lo] Error 1
I'm going crazy...
If you follow the instructions from Oracle's Github Repo for Docker you should be able to build your own instantclient.
https://github.com/oracle/docker-images/tree/master/OracleInstantClient
Another option will be to just make use of an existing image from their container-registry.
docker pull container-registry.oracle.com/database/instantclient:latest
Best of luck!
I did it this way:
RUN echo 'instantclient,/opt/oracle/instantclient/lib' | pecl install oci8

Akeneo Install Error - Install the Ghostscript executable at least 9.27 version

I want to install Akeneo with:
php7-73STABLE-CLI -c /kunden/xxxxx/webseiten/web/akeneo/pim-community-standard/D3066475_php7.ini bin/console pim:install --force --symlink --clean --env=dev
But i get the following error:
Install the Ghostscript executable at least 9.27 version
The problem is: Ghostscript is installed and active! A 'gs -v' gets
GPL Ghostscript 9.27 (2019-04-04) Copyright (C) 2018 Artifex Software, Inc. All rights reserved.
Can anybody help me?
Best wishes!
This error comes from a bug in last version of Akeneo (4.0). A fix has been submitted on our repository for master here.
You can apply it to your project if you don't want to wait :)

Apt rejects keyrings in `/etc/apt/trusted.gpg.d` on Ubuntu 18.04 [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 10 months ago.
Improve this question
I am facing a problem on Ubuntu 18.04 (Bionic Beaver) with apt and the way it deals with trusted keys to authenticate repositories.
On Ubuntu 14.04 we used to install the key that was used sign the repository of our software releases as keyring to /etc/apt/trusted.gpg.d. By this apt knows that the key is trusted.
However, this seems to not work anymore on Ubuntu 18.04. If I do the same there, I get an error during updating:
# apt-get update
Hit:1 http://company.com/ubuntu-snapshot bionic InRelease
Reading package lists... Done
W: http://company.com/ubuntu-snapshot/dists/bionic/InRelease: The key(s) in the keyring /etc/apt/trusted.gpg.d/company-keys.gpg are ignored as the file is not readable by user '_apt' executing apt-key.
The obvious attempt to fix it by
# sudo chown -v _apt /etc/apt/trusted.gpg.d/company-keys.gpg
changed ownership of '/etc/apt/trusted.gpg.d/company-keys.gpg' from root to _apt
does not work, as apt-get update then yields:
# apt-get update
Hit:1 http://company.com/ubuntu-snapshot bionic InRelease
Reading package lists... Done
W: http://company.com/ubuntu-snapshot/dists/bionic/InRelease: The key(s) in the keyring /etc/apt/trusted.gpg.d/company-keys.gpg are ignored as the file has an unsupported filetype.
The key itself is valid, if I add it with the following line everything works as expected:
wget -O - http://company.com/key.gpg | sudo apt-key add -
The latter is unfortunately not an option for us since we want to deploy our own keys and also have the ability to change/revoke them.
I could neither figure out why apt rejects the keyring in /etc/apt/trusted.gpg.d, nor could I find a changelog describing different expectations of apt for the new Ubuntu version. Would be very glad if you point to some resource to overcome this issue.
It sounds like your key file (/etc/apt/trusted.gpg.d/company-keys.gpg) is an unsupported format. The apt-key man page explains what's supported:
apt-key supports only the binary OpenPGP format (also known as "GPG
key public ring") in files with the "gpg" extension, not the keybox
database format introduced in newer gpg(1) versions as default for
keyring files. Binary keyring files intended to be used with any apt
version should therefore always be created with gpg --export.
Alternatively, if all systems which should be using the created
keyring have at least apt version >= 1.4 installed, you can use the
ASCII armored format with the "asc" extension instead which can be
created with gpg --armor --export.
To check the file format, run file /etc/apt/trusted.gpg.d/company-keys.gpg If it says "GPG key public ring" then I would expect it to work and I can't explain the problem you're seeing.
If it says "GPG keybox database" then the problem is the file format. You can convert it with this command (thanks to #Wildcard for including this in his answer):
gpg --no-default-keyring --keyring /etc/apt/trusted.gpg.d/company-keys.gpg --export > /etc/apt/trusted.gpg.d/company-keys.fixed.gpg
If you see this problem repeatedly then you may wish to check how you're installing your key to /etc/apt/trusted.gpg.d/. I had a problem where attempting to list the contents of the keyring by running gpg --keyring /etc/apt/trusted.gpg.d/mine.gpg was causing the file to be created as an unsupported keybox file. Subsequently adding the key to that keyring didn't allow the key to be used.
Also worth noting that there's apparently no reason to use apt-key add. From the man page:
Instead of using this command a keyring should be placed directly in
the /etc/apt/trusted.gpg.d/ directory with a descriptive name and
either "gpg" or "asc" as file extension.
So if you're using apt-key add you could consider copying the file directly instead.
You can use gpg's --dearmor option to convert ASCII-armored keys, the ones rejected by apt in trusted.gpg.d to the binary format, which is what apt expects.
gpg --dearmor keyfile
tl; dr: Mark's answer is right. You can convert the keybox to a keyring by using:
gpg --no-default-keyring --keyring ./the-keybox-file.gpg --export > /etc/apt/trusted.gpg.d/this-keyring-will-actually-work.gpg
(More detailed description of what I ran into and how I resolved it:)
I encountered the same scenario in trying to follow a modified version of the instructions for fluentd installation so that I wouldn't have to run apt-key on any server. I worked out how to solve it; here are my notes:
Instructions I was reading: https://docs.fluentd.org/installation/install-by-deb
The script they ask you to run includes the command:
curl https://packages.treasuredata.com/GPG-KEY-td-agent | apt-key add -
But I wanted to convert the key to a keyring so I could just place it in a directory rather than running a command on each server.
I used some notes I wrote a while back for something similar:
https://unix.stackexchange.com/q/467639/135943
That's when I ran into the problem you illustrated here.
Here is the full solution I used:
# head -n 2 /etc/os-release
NAME="Ubuntu"
VERSION="18.04.2 LTS (Bionic Beaver)"
# ls
GPG-KEY-td-agent
# file GPG-KEY-td-agent
GPG-KEY-td-agent: PGP public key block Public-Key (old)
# gpg --no-default-keyring --keyring ./tempfile.gpg --import ./GPG-KEY-td-agent
gpg: keybox './tempfile.gpg' created
gpg: key 901F9177AB97ACBE: public key "Treasure Data, Inc (Treasure Agent Official Signing key) <support#treasure-data.com>" imported
gpg: Total number processed: 1
gpg: imported: 1
# gpg --no-default-keyring --keyring ./tempfile.gpg --export > td-agent-keyring.gpg
# file *
GPG-KEY-td-agent: PGP public key block Public-Key (old)
td-agent-keyring.gpg: GPG key public ring, created Tue Dec 27 08:18:20 2016
tempfile.gpg: GPG keybox database version 1, created-at Sat Jul 20 02:36:45 2019, last-maintained Sat Jul 20 02:36:45 2019
tempfile.gpg~: GPG keybox database version 1, created-at Sat Jul 20 02:36:45 2019, last-maintained Sat Jul 20 02:36:45 2019
# mv td-agent-keyring.gpg /etc/apt/trusted.gpg.d/
#

Resources