やってみる

アウトプットすべく己を導くためのブログ。その試行錯誤すらたれ流す。

LinuxMint17.3にNuGetをインストールしたが使えなかった

Pythonでいうpipみたいなやつ。

前回

参考

LinuxでMonoを使ってC#をコンパイル・実行する - Qiita

手続き

nuget.exe取得

$ wget --no-check-certificate https://nuget.org/nuget.exe
--2017-06-17 21:55:00--  https://nuget.org/nuget.exe
nuget.org (nuget.org) をDNSに問いあわせています... 191.236.146.247
nuget.org (nuget.org)|191.236.146.247|:443 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 301 Moved Permanently
場所: https://www.nuget.org/nuget.exe [続く]
--2017-06-17 21:55:01--  https://www.nuget.org/nuget.exe
www.nuget.org (www.nuget.org) をDNSに問いあわせています... 191.236.146.247
www.nuget.org (www.nuget.org)|191.236.146.247|:443 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 302 Found
場所: https://api.nuget.org/downloads/nuget.exe [続く]
--2017-06-17 21:55:02--  https://api.nuget.org/downloads/nuget.exe
api.nuget.org (api.nuget.org) をDNSに問いあわせています... 117.18.232.200, 2606:2800:147:120f:30c:1ba0:fc6:265a
api.nuget.org (api.nuget.org)|117.18.232.200|:443 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 1686528 (1.6M) [application/octet-stream]
`nuget.exe' に保存中

100%[======================================>] 1,686,528    191KB/s   時間 6.1s 

2017-06-17 21:55:09 (272 KB/s) - `nuget.exe' へ保存完了 [1686528/1686528]

exeはWindowsの実行形式なのだが。

mozroots

$ mozroots --import --machine --sync
Mozilla Roots Importer - version 3.2.8.0
Download and import trusted root certificates from Mozilla's MXR.
Copyright 2002, 2003 Motus Technologies. Copyright 2004-2008 Novell. BSD licensed.

Downloading from 'http://mxr.mozilla.org/seamonkey/source/security/nss/lib/ckfw/builtins/certdata.txt?raw=1'...
Couldn't retrieve the file using the supplied information.

これが何のコマンドなのかも理解していない。

以下はSSL/TSL通信の証明書なのだろうか?

$ certmgr -ssl -m https://go.microsoft.com
Mono Certificate Manager - version 3.2.8.0
Manage X.509 certificates and CRL from stores.
Copyright 2002, 2003 Motus Technologies. Copyright 2004-2008 Novell. BSD licensed.


Self-signed X.509 Certificate v3
   Issued from: C=IE, O=Baltimore, OU=CyberTrust, CN=Baltimore CyberTrust Root
   Issued to:   C=IE, O=Baltimore, OU=CyberTrust, CN=Baltimore CyberTrust Root
   Valid from:  2000/05/12 18:46:00
   Valid until: 2025/05/12 23:59:00
Import this certificate into the Trust store ?yes
Access to the machine '' certificate store has been denied.
$ certmgr -ssl -m https://nugetgallery.blob.core.windows.netMono Certificate Manager - version 3.2.8.0
Manage X.509 certificates and CRL from stores.
Copyright 2002, 2003 Motus Technologies. Copyright 2004-2008 Novell. BSD licensed.


X.509 Certificate v3
   Issued from: C=IE, O=Baltimore, OU=CyberTrust, CN=Baltimore CyberTrust Root
   Issued to:   C=US, S=Washington, L=Redmond, O=Microsoft Corporation, OU=Microsoft IT, CN=Microsoft IT SSL SHA2
   Valid from:  2014/05/07 17:04:09
   Valid until: 2018/05/07 17:03:30
   *** WARNING: Certificate signature is INVALID ***
Import this certificate into the CA store ?yes
Access to the machine '' certificate store has been denied.
$ certmgr -ssl -m https://nuget.org
Mono Certificate Manager - version 3.2.8.0
Manage X.509 certificates and CRL from stores.
Copyright 2002, 2003 Motus Technologies. Copyright 2004-2008 Novell. BSD licensed.


X.509 Certificate v3
   Issued from: C=IE, O=Baltimore, OU=CyberTrust, CN=Baltimore CyberTrust Root
   Issued to:   C=US, S=Washington, L=Redmond, O=Microsoft Corporation, OU=Microsoft IT, CN=Microsoft IT SSL SHA2
   Valid from:  2013/12/19 20:07:32
   Valid until: 2017/12/19 20:06:55
   *** WARNING: Certificate signature is INVALID ***
Import this certificate into the CA store ?yes
Access to the machine '' certificate store has been denied.

ライブラリRestSharpのインストールに失敗した

$ mono nuget.exe install RestSharp
警告: Invalid certificate received from server. Error code: 0xffffffff800b010a
警告: Invalid certificate received from server. Error code: 0xffffffff800b010a
Unable to find package 'RestSharp'.

「Invalid certificate」から察するにSSL/TSLの証明書が無効(期限切れ)になっているエラーではないか?.NETのHttpWebRequestやcurlコマンドでさんざん悩まされた記憶がある。

以下が参考になるかも知れない。

PythonC#,F#の置き換えができない

言語的にはC#,F#に置き換えたい。しかし、SSL/TSL通信ができないからPythonの代わりにWebAPIを叩くことができない。

SSL/TSLエラーはOSを最新にし、MONOを最新にする必要があるかもしれない。また、C#でHttpClientとasyncを使って効率よくコーディングしたい。しかし、OSを最新にすると以前のように壊れる可能性がある。システムアップデートはトラウマ。別のHDDなどの物理的環境を用意しないと怖くて実行できない。

所感

資金も作業時間も必要なため一旦あきらめる。