Update VS Code and Kaspersky certificate - visual-studio-code

I just wanted to start VS Code on Windows Subsystem Linux but VS Code updates automatically. The issue is a certificate which VS Code wants to access but it is blocked by kaspersky. Kaspersky is installed on Windows 10. I have the Total Securiy Version. Does somebody have a hint? What should I change?
micha#LAPTOP-TD50FJUH:/mnt/c/WINDOWS/system32$ code .
Updating VS Code Server to version 8490d3dde47c57ba65ec40dd192d014fd2113496
Removing previous installation... Installing VS Code Server for x64
(8490d3dde47c57ba65ec40dd192d014fd2113496) Downloading: 100% Failed
--2021-02-05 18:15:16-- https://update.code.visualstudio.com/commit:8490d3dde47c57ba65ec40dd192d014fd2113496/server-linux-x64/stable
Resolving update.code.visualstudio.com
(update.code.visualstudio.com)... 51.144.164.215 Connecting to
update.code.visualstudio.com
(update.code.visualstudio.com)|51.144.164.215|:443... connected.
ERROR: cannot verify update.code.visualstudio.com's certificate,
issued by ‘CN=Kaspersky Anti-Virus Personal Root Certificate,O=AO
Kaspersky Lab’: Self-signed certificate encountered. To connect to
update.code.visualstudio.com insecurely, use `--no-check-certificate'.
ERROR: Failed to download
https://update.code.visualstudio.com/commit:8490d3dde47c57ba65ec40dd192d014fd2113496/server-linux-x64/stable
to
/home/micha/.vscode-server/bin/8490d3dde47c57ba65ec40dd192d014fd2113496-1612545315.tar.gz Please install missing certificates. Debian/Ubuntu: sudo apt-get
install ca-certificates
I have already installed ca-certificates without any Problem.

I solved this error:
(Add Last Line to /etc/wgetrc) - check_certificate = off
Results:
everton#LPEw:/$ code
Updating VS Code Server to version 3c4e3df9e89829dce27b7b5c24508306b151f30d
Removing previous installation...
Installing VS Code Server for x64 (3c4e3df9e89829dce27b7b5c24508306b151f30d)
Downloading: 100%
Unpacking: 100%
Unpacked 1719 files and folders to /home/everton/.vscode-server/bin/3c4e3df9e89829dce27b7b5c24508306b151f30d.
everton#LPEw:/$

1. go to WSL
then type:
sudo vi /etc/wgetrc
uncomment this line
#https_proxy = http://proxy.yoyodyne.com:18023/
type:
https_proxy = https://update.code.visualstudio.com/commit:8490d3dde47c57ba65ec40dd192d014fd2113496/server-linux-x64/stable:443/
uncomment
use_proxy = on
type:
check-certificate=off

solved this by adding the update.code.visualstudio.com domain to the trusted list in kaspersky:
open kaspersky
click on the setting button (the gear at the bottom left)
go to the network setting menu item
add the domain to the trusted adresses

After hours of research I came with a more secure and efficient solution:
Open Control Panel, then Internet Options, go to the Content tab and click Certificates.
Go to the Trusted Root Certificate Authorities tab, select the Kaspersky root certificate and click Export.
Follow the instructions. Use the default settings during the certificate export. Enter the name kaspersky.cer for the file.
Move the exported .cer file to a Linux folder, open the folder and run this command:
openssl x509 -inform DER -in kaspersky.cer -out kaspersky.crt
Copy the created .crt file to /usr/local/share/ca-certificates/
Run sudo update-ca-certificates
Sources: this solution is a devolopment from Labradorcode's comment above and was based on a Kaspersky tutorial and this answer.

Related

Facing Eclipse Marketplace Error after installing JDK 19

I have updated java to JDK 19 and when I try opening Eclipse Marketspace i am getting below error,
MarketplaceDiscoveryStrategy failed with an error
Cannot complete request to https://marketplace.eclipse.org/api/p?client=org.eclipse.epp.mpc.core&client.version=1.6.4.v20180214-1810&os=win32&ws=win32&nl=en_US&java.version=1.8.0_211&product=org.eclipse.epp.package.java.product&product.version=4.7.3.M20180330-0640&runtime.version=3.13.0.v20170207-1030&platform.version=4.7.3.v20180330-0640: Unable to read repository at https://marketplace.eclipse.org/api/p?client=org.eclipse.epp.mpc.core&client.version=1.6.4.v20180214-1810&os=win32&ws=win32&nl=en_US&java.version=1.8.0_211&product=org.eclipse.epp.package.java.product&product.version=4.7.3.M20180330-0640&runtime.version=3.13.0.v20170207-1030&platform.version=4.7.3.v20180330-0640.
I wanted to Install testNg so I tried adding the certificate as follows and made it trust, Still facing the same issue.
keytool -import -alias TestNg -keystore "C:\Program Files\Java\jdk-19\lib\security\cacerts" -file TestNg.cer
I get below error,
Unable to read repository at https://dl.bintray.com/testng-team/testng-eclipse-release/content.xml.
Unable to read repository at https://dl.bintray.com/testng-team/testng-eclipse-release/content.xml.
sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Am I missing anything, I don't see a JRE for JDK is that I am missing?
After exploring few I found a solution for this,
The reason behind the error was:
Our cooperate firewall (ZScalar) prevent these additional steps, and install attempts will fail with the below messages:
Unable to read repository at https://dl.bintray.com/testng-team/testng-eclipse-release/content.xml. Unable to read repository at https://dl.bintray.com/testng-team/testng-eclipse-release/content.xml. sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target.
Java did not recognize the root certificate authority (CA).
How to fix this?
There are two ways to fix this:
Admin team has to reconfigure the firewall to allow Java access to the certificate sites.(They did not agreed with this, so proceeded with below way).
To verify the root certificates, determine where the cacerts file is located.
Cacerts file is available in eclipse jre folder. For example
C:\Eclipse 2022 09\eclipse-java-2022-09-R-win32-x86_64\eclipse\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.4.v20220903-1038\jre\lib\security\cacerts
Now the certificate for the software’s needs to be added to this cacerts file. Eclipse marketplace itself was not opening for me. So on browser I pinged the below link,
https://marketplace.eclipse.org/
Click on the HTTPS certificate chain and navigate the certificate hierarchy. At the top there should be a Primary Root CA. This could be missing from my java cacerts file. Export the certificate and saved in my computer. Now imported to cacerts file.
Open cmd where the certificate is expoted. Execute below command.
keytool -import -alias MarketPlace -keystore "C:\Eclipse 2022 09\eclipse-java-2022-09-R-win32-x86_64\eclipse\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.4.v20220903-1038\jre\lib\security\cacerts" -file ZscalerRootCAMP.der
Here ZscalerRootCAMP.der is the certificate exported for Eclipse market place.
Restart eclipse, open Eclipse marketplace and now I am able to install software's.

Eclipse remote system explorer and sudo

I use Eclipse RSE to access files on a web server. To establish a sftp connection with Eclipse RSE I use my HippieBandJam user-ID. To edit files I need root access which I only can gain with the sudo command. In Eclipse RSE I have tried to start a new ssh terminal, use sudo su and then refreshed the sftp tree but this does not seem to work. Does anyone have any idea how to "upgrade" the sftp connection so I can edit the files?
If you want something really exotic, you could:
Compile a tiny program in C that does the only thing: execs the shell
Set a suid bit for the executable
Create a new user and set our freshly compiled binary as this user's login shell
Set up proper permissions for the binary, allowing only the new user to execute this file
Use new user's credentials to log onto the server
He-he :-)
Here is one idea:
create a mount point in your local system in /media/
use sshfs cmd to mount the remote server file system directory to .
In eclipse use the project, use add directory to your project
Steps: right click on your project -> New -> Folder -> Advanced (Select link to alternate location) linked folder.
There you have your remote systems files synced up...
Hope this helps!
My workaround for this was to set up the connection to use the root user from the start. First, you need to enable it on your ssh client:
https://forums.aws.amazon.com/thread.jspa?threadID=86876
Then you may have to configure the authorized_keys file:
/root/.ssh/authorized_keys
to accept the key.
Hope that helps! It's not quite as secure, so be wary of this method.
Other Workaround:
NOT ON LIVE SERVER!!!!
Assign the group of the files write rights during the period you are editing them and add your account to the group.

How to convert .p12 file to .pem file using Terminal?

I already have an development certificate in apple developer portal. Am developing an iPhone app,i want to integrate Apple Push Notification in this app. I have created a new App ID with used the existing certificate and enabled the Push Notification in this app id. And i have created a new Provisioning Profile used the newly created app id. Before these steps i have created and downloaded the .cer file from keychain access. After done these steps i downloaded the newly created SSL (Apple Push Notification Service SSL certificate) file and installed in my Mac Keychain Access. Once i installed this file, verified (Green tick mark is there) and got the .p12 file from this ssl file.
I followed the apple document RemoteNotificationsPG.pdf, in this document they mentioned after saved the .p12 file open the Terminal app and type below commends,
openssl pkcs12 -in Certificates.p12 -out Certificates.pem -nodes
I have used this in my Terminal app, but the error message is appear that is,
Error opening input file Certificates.p12
Certificates.p12: No such file or directory
Can you please suggest or guide me where i did wrong or what i missed in these steps? Please help me. Thanks in advance.
EDIT:
I stored my Certificates.p12 file in my desktop. Folder path is Desktop->1/5/2012_Certificate->2/5/12->Certificates.p12
I have used 'ls' command in Terminal it is not listing my Certificates.p12 file.
I have typed cd *path* this returned No such file or directory.
Please help me. Thanks in advance.
Are you in the right directory? Use ls command, does it list Certificates.p12?
EDIT: In the terminal type:
ls
this will list all the files of the current directory that you are in. If Certificates.p12 is not listed, you are not in the correct directory in the terminal.
To get to the correct directory type:
cd *path*
where path is the folder containing Certificates.p12. You can drag and drop that folder into the terminal after typing cd. Hit return. Then run the openssl command.
Open the terminal and click ls to list the items in the current directory,
then if you are not in the folder in which the .p12 is having move to the correct directory by
cd directory path
for example,
cd Downloads
Then list the files using and make sure the .p12 file are existing in the directory.
Then convert the .p12 file to .pem file using the following command.
openssl pkcs12 -in filename.p12 -out filename.pem -nodes
The .pem file which you have created will be saved in the directory which is having the .p12 file.

How to Import Reconfigured apk File from Amazon Appstore into Eclipse for Signing

Amazon App Store (appstore) - Marketplace requires you to upload unsigned apk files. They then reconfigure and add their own coding. They then ask you to download that reconfigured file, sign it, then re-upload it to their site.
I'm having a heck of a time trying to import that reconfigured file into Eclipse for signing. Do I use the IMPORT option? If so, what specific steps? Or do I use the Terminal to sign?
I tried importing the new file the same way I imported my original project (using Wizard: Android>Android Project...) but that won't work for the new file.
Any suggestions or workarounds would be appreciated.
PS I found a great site that helps with eclipse and installing apks. But it didn't answer this question.
http://www.satyakomatineni.com/akc/display?url=displaynoteimpurl&ownerUserId=satya&reportId=3279
The ADT plugins for Eclipse can't import an APK to sign it, they can only export a signed (or unsigned) APK. But these instructions from the Android Developers site should help you get on your way: http://developer.android.com/guide/publishing/app-signing.html#signapp
You don't need to import the .apk file back into Eclipse, but can sign it from command line. In fact, Eclipse invokes this same procedure behind the scenes when it signs your binary.
In the samples below, replace the AppName with your application's name. The first step (to generate the keystore file) you will do only once when you setup your project, and the other 2 steps -- every time you need to sign the app. I hope that answers your question.
:: Generate a keystore file
cd "c:\Program Files (x86)\Java\jdk1.6.0_21\bin"
keytool.exe -genkey -v -keystore AppName.keystore -alias AppName -keyalg RSA -keysize 2048 -validity 10000
:: Sign the .apk file
cd "c:\Program Files\Java\jdk1.6.0_29\bin"
jarsigner.exe" -keystore AppName.keystore AppName.apk AppName
:: Zip align the .apk file and copy it to the install folder
cd "c:\Program Files (x86)\android\android-sdk\tools"
zipalign.exe" -f -v 4 AppName.apk install\AppName.apk

Eclipse update site - how to sign jars?

I have a few Eclipse plugins that are part of a feature. We would like to apply code signing to these plugins when the update site is updated.
I can see the JAR Signing tab when exporting an individual plugin, but I can't see anything similar in my update site project settings.
Also, the tutorials that I have read are using self-signed certificates. Can anyone point me towards instructions for using Verisign certificates (i.e. *.pfx files)?
Can anyone help?
Thanks,
Alan
Edit: I have marked Kane's response as the answer because it is very similar to the steps that I took and was an inspiration. I actually followed these instructions to sign the jars because it was based on pfx files: https://support.comodo.com/index.php?_m=knowledgebase&_a=viewarticle&kbarticleid=1072
Step 1: Run the following command to view details about the certificate (substituting the filename with your own):
keytool -list -v -storetype pkcs12 -keystore [Filename].pfx
Step 2: Scroll to the top of the output and take a note of the Alias name value.
Step 3: Sign each jar file using the following command (substituting the filenames and alias name for your own):
jarsigner -storetype pkcs12 -keystore [Filename].pfx [Filename].jar "[AliasName]"
I now need to come up with a way of managing / automating the process.
Update site project doesn't provide such capability to sign the jars. Signing jars is a pure java concept, you could use the signtool from JDK to do it.
If you want to sign you jars via using the certificate for Windows code signing, you could refer to this blog post.
In my successful experience, I convert pfx to JKS format certificate firstly, then call below command in ant,
<signjar sigfile="MyCompany" alias="${sign.alias}" keystore="${sign.keystore}" storepass="${sign.storepass}" keypass="${sign.keypass}" tsaurl="https://timestamp.geotrust.com/tsa" preservelastmodified="true">