WSL: bugs

1 minuto(s) de leitura

WSL no MP

Estava tendo o problema com a internet no WSL. Sempre que eu dava o comando sudo apt update recebia alertas assim: Clearsigned file isn’t valid, got ‘NOSPLIT’ (does the network require authentication?)

Li trocentas coisas e tentei algumas delas…

Um bom teste é

ping 8.8.8.8
sudo apt update
wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.17.2.tar.xz

sudo cp /mnt/c/Users/michelsilva/OneDrive/MPSP/TI/certificado/cert.pem /etc/ssl/certs



Coisa 1: Adicionar certificados!

# Adicionar Certificado!
cd /mnt/c/Users/michelsilva/OneDrive/MPSP/TI/certificado

#
sudo cp /mnt/c/Users/michelsilva/OneDrive/MPSP/TI/certificado/cert.pem /usr/local/share/ca-certificates

# Vai pra WSL
cd /usr/local/share/ca-certificates

# Convert PEM to CRT
# https://stackoverflow.com/questions/13732826/convert-pem-to-crt-and-key
sudo openssl x509 -outform der -in cert.pem -out cert.crt

# Update Certificate
# https://wiki.archlinux.org/title/User:Grawity/Adding_a_trusted_CA_certificate
sudo update-ca-certificates


Para limpar a baguça!

# Acessa
cd /usr/local/share/ca-certificates

# Deleta tudo que tem cert
sudo rm cert*



Coisa 2: nameserver

sudo apt update always giving Clearsigned file isn’t valid, got ‘NOSPLIT’ (does the network require authentication?)

sudo nano /etc/resolv.conf


por padrão estava 172.18.96.1

Há quem sugira colocar nameserver 8.8.8.8 eu coloquei o nameserver 10.73.2.101

Após isso é necessário reiniciar:

sudo service network-manager restart



Configuração Ok!

Deu certo no Ubuntu

sudo nano /etc/wsl.conf
[network]
generateResolvConf = true

[boot]
systemd=true
sudo nano /etc/resolv.conf
# nameserver 8.8.8.8
nameserver 10.73.2.101



WSL

# Lista Distribuições Rodando
wsl -l -v

# Termina com uma delas
wsl -t kali-linux
wsl -t Ubuntu



Travar Arquivo

+i imutável!

sudo chattr +i /etc/resolv.conf
sudo chattr -i /etc/resolv.conf



Outros Comandos

echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf > /dev/null
sudo unlink /etc/resolv.conf

sudo apt-get update



Proxy

sudo cp /mnt/c/Users/michelsilva/Downloads/cntlm\_\*.deb ~/
sudo cntlm -u michelsilva -d MP -M http://www.uol.com.br
sudo nano /etc/cntlm.conf
sudo systemctl start systemd-resolved.service
sudo systemctl restart systemd-resolved.service
sudo systemctl unmask systemd-resolved.service

openssl s_client -showcerts
dpkg-reconfigure ca-certificates



Referências

  • https://github.com/MicrosoftDocs/WSL/issues/937
  • https://gist.github.com/coltenkrauter/608cfe02319ce60facd76373249b8ca6

sudo systemctl enable systemd-networkd

Created symlink /etc/systemd/system/dbus-org.freedesktop.network1.service → /lib/systemd/system/systemd-networkd.service. Created symlink /etc/systemd/system/multi-user.target.wants/systemd-networkd.service → /lib/systemd/system/systemd-networkd.service. Created symlink /etc/systemd/system/sockets.target.wants/systemd-networkd.socket → /lib/systemd/system/systemd-networkd.socket. Created symlink /etc/systemd/system/sysinit.target.wants/systemd-network-generator.service → /lib/systemd/system/systemd-network-generator.service. Created symlink /etc/systemd/system/network-online.target.wants/systemd-networkd-wait-online.service → /lib/systemd/system/systemd-networkd-wait-online.service.


Referências

  • https://community.checkpoint.com/t5/Threat-Prevention/Usercheck-Block-Page-is-Insecure-Private/m-p/20217?commentID=26695#
  • https://github.com/AmmarRahman/wsl-vpn

Deixe um comentário