編集する

編集する

Shadowsocksプロファイルを構成するときにこの問題が発生しました。

$ ssserver -c profile.json
/gnu/store/yvjgk9n6xzpr32maq1mqw1ij2vhm9jxb-shadowsocks-2.8.2-0.e332ec9/lib/python3.8/site-packages/shadowsocks/common.py:221: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if addr is "":
/gnu/store/yvjgk9n6xzpr32maq1mqw1ij2vhm9jxb-shadowsocks-2.8.2-0.e332ec9/lib/python3.8/site-packages/shadowsocks/common.py:233: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if len(block) is 1:
/gnu/store/yvjgk9n6xzpr32maq1mqw1ij2vhm9jxb-shadowsocks-2.8.2-0.e332ec9/lib/python3.8/site-packages/shadowsocks/common.py:235: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  while (ip & 1) == 0 and ip is not 0:
INFO: loading config from profile.json
Traceback (most recent call last):
  File "/gnu/store/yvjgk9n6xzpr32maq1mqw1ij2vhm9jxb-shadowsocks-2.8.2-0.e332ec9/bin/.ssserver-real", line 11, in <module>
    load_entry_point('shadowsocks==3.0.0', 'console_scripts', 'ssserver')()
  File "/gnu/store/yvjgk9n6xzpr32maq1mqw1ij2vhm9jxb-shadowsocks-2.8.2-0.e332ec9/lib/python3.8/site-packages/shadowsocks/server.py", line 34, in main
    config = shell.get_config(False)
  File "/gnu/store/yvjgk9n6xzpr32maq1mqw1ij2vhm9jxb-shadowsocks-2.8.2-0.e332ec9/lib/python3.8/site-packages/shadowsocks/shell.py", line 355, in get_config
    check_config(config, is_local)
  File "/gnu/store/yvjgk9n6xzpr32maq1mqw1ij2vhm9jxb-shadowsocks-2.8.2-0.e332ec9/lib/python3.8/site-packages/shadowsocks/shell.py", line 210, in check_config
    cryptor.try_cipher(config['password'], config['method'],
  File "/gnu/store/yvjgk9n6xzpr32maq1mqw1ij2vhm9jxb-shadowsocks-2.8.2-0.e332ec9/lib/python3.8/site-packages/shadowsocks/cryptor.py", line 51, in try_cipher
    Cryptor(key, method, crypto_path)
  File "/gnu/store/yvjgk9n6xzpr32maq1mqw1ij2vhm9jxb-shadowsocks-2.8.2-0.e332ec9/lib/python3.8/site-packages/shadowsocks/cryptor.py", line 98, in __init__
    self.cipher = self.get_cipher(
  File "/gnu/store/yvjgk9n6xzpr32maq1mqw1ij2vhm9jxb-shadowsocks-2.8.2-0.e332ec9/lib/python3.8/site-packages/shadowsocks/cryptor.py", line 130, in get_cipher
    return m[METHOD_INFO_CRYPTO](method, key, iv, op, self.crypto_path)
  File "/gnu/store/yvjgk9n6xzpr32maq1mqw1ij2vhm9jxb-shadowsocks-2.8.2-0.e332ec9/lib/python3.8/site-packages/shadowsocks/crypto/openssl.py", line 150, in __init__
    OpenSSLCryptoBase.__init__(self, cipher_name, crypto_path)
  File "/gnu/store/yvjgk9n6xzpr32maq1mqw1ij2vhm9jxb-shadowsocks-2.8.2-0.e332ec9/lib/python3.8/site-packages/shadowsocks/crypto/openssl.py", line 98, in __init__
    load_openssl(crypto_path)
  File "/gnu/store/yvjgk9n6xzpr32maq1mqw1ij2vhm9jxb-shadowsocks-2.8.2-0.e332ec9/lib/python3.8/site-packages/shadowsocks/crypto/openssl.py", line 51, in load_openssl
    raise Exception('libcrypto(OpenSSL) not found with path %s' % path)
Exception: libcrypto(OpenSSL) not found with path None

解決策は何ですか?

ベストアンサー1

編集する

この記事を書いている時点で、私よりもソースコードをよく知っている人がデザインしました。パッチ、Guixの上流に提出されました。つまり、この問題はすぐに解決される可能性があります。

オリジナル投稿

Shadowsocksのパッケージ定義を見ると、OpenSSLを入力としてリストしない限り、ほとんど何もないようです。さらに、Shadowsocksは、これらのすべてのパスをいくつかの設定に保存したいと思います。

config['crypto_path'] = {'openssl': config['libopenssl'],
                         'mbedtls': config['libmbedtls'],
                         'sodium': config['libsodium']}

これらのトリックは、従来のディストリビューション(Debianベースのディストリビューションなど)では非常に賢明ですが、あらゆる種類のパッケージ管理と組み合わせると完全に壊れます。 Guixがこの種の問題を処理する方法はビルド時にありますsubstitute*。ステージは次のとおりです。

  (add-after 'unpack 'patch-crypto-paths
    (lambda* (#:key inputs #:allow-other-keys)
      (substitute* "shadowsocks/shell.py"
        (("config\\['libopenssl'\\]") 
         (string-append (assoc-ref inputs "openssl") "/path/to/libopenssl"))
        [...])
      #t))

[上記のコードは明らかにGuixコードなので、SOが通常CC BY-SAを実行してもGPLv3+で自由に使用できます。 ]

#t最近ではinで終わることは必ずしも必要ではありませんが、Guixコードではまだ頻繁に見つけることができます。

おすすめ記事