快速修复:如何在Python中使用SSL

时间:2019-05-16 20:34:53

标签: python ssl quickfix fix-protocol

[对不起,我的英语] 我在连接使用python开发的客户端quckfix时遇到问题。配置文件没有响应,我想要的。

如果我将路径(错误的路径,用于强制错误)更改为文件* .pem,然后重新启动应用程序。该应用程序没有任何作用,只是可以正常运行。

好像未读取配置

在本教程中提到:quickfix的Python实现不支持SSL,这是真的吗?

https://medium.com/@federico_dv/fix-protocol-en-python-primeros-pasos-e-implementaci%C3%B3n-29a130b71ffc

这是针对Windows中带有http://www.quickfixengine.org/库快速修复程序的python iomplementation的

[DEFAULT]
PersistMessages=Y
ConnectionType=initiator
UseDataDictionary=Y 
StartTime=00:00:00
EndTime=23:59:00
FileStorePath=incoming 
FileLogPath=outgoing   


[SESSION]
SSLEnable=Y
SSLProtocol=TLSv1
ClientCertificateFil=C:\python\pyarb\cert\cert.pem
ClientCertificateKeyFile=C:\python\pyarb\cert\key.pem
StartTime=14:00:00
SenderCompID=AGENT
TargetCompID=FIX
EndTime=00:00:00
ConnectionType=initiator 
ApplVerID=9
BeginString=FIXT.1.1
DefaultApplVerID=9
TransportDataDictionary=quickfix_dicts\FIX50SP1.xml
AppDataDictionary=quickfix_dicts\FIX50SP1.xml
DataDictionary=quickfix_dicts\FIX50SP1.xml
SocketConnectPort=xxxx
SocketConnectHost=xxx.xxx.xxx.xxx
HeartBtInt=30
ReconnectInterval=30
ResetOnLogon=Y
ResetOnLogout=Y
ResetOnDisconnect=N
ResetSeqNumFlag=N

1 个答案:

答案 0 :(得分:3)

是的,截至撰写本文时,quickfix不支持现成的SSL。您将需要手动创建一条从计算机到需要SSL连接的主机的SSL隧道。您可以通过“隧道”执行此操作。在下面发布一些配置,希望可以解释如何进行设置。

STUNNEL CONFIG

log = append
output = <path where logs will be written>

[client]
client = yes
accept = <port of your choosing on the local machine for quickfix>
connect = <ssl host you want to connect to>:<port>
verifyPeer = yes
CAfile = <path of certification provided by SSL host>
checkHost = <ssl host you want to connect to>
debug = debug

下面的例子

log = append
output = /home/user/logs

[client]
client = yes
accept = 1589
connect = 5.854.17.45:446
verifyPeer = yes
CAfile = /etc/ssl/certs/ca-cert.pem
checkHost = 5.854.17.45
debug = debug

快速修复配置

[DEFAULT]
<Other relevant settings>
SocketConnectPort=1589
SocketConnectHost=localhost

[SESSION]
<Other relevant settings>