2015-08-18 62 views
0

我試圖通過在TDSTCPServerTransport上添加PC1和RSA過濾器來提高我們的delphi datasnap服務器的安全性。 FiltersDelphi datasnap tcpip加密PC1和RSA

添加過濾器或之後連接客戶端並不是問題,實際上我認爲任何事情都沒有加密或更「安全」,但我不得不承認我不完全明白它應該如何上班。

基本上我想要在客戶端和服務器之間進行加密通信,並且我想保護服務器免於將它的方法公開給任何可以讀取和列出服務器方法的客戶端,除了那些知道關鍵字的客戶端加密。

在我的基本示例中,我能夠連接客戶端,而不管添加到客戶端的過濾器。我發現了一些文檔,關於此主題的信息並不多,如果我正確理解它們,客戶端將從服務器獲取過濾器,並且無論客戶端上的PC1密鑰與服務器匹配如何,都能夠進行連接。

我認爲鍵必須匹配 - 工作像一種預共享密鑰。

有人可以解釋它應該如何工作以及它會保護什麼(以及不能)如果它被正確設置? 是否有可能保護暴露的方法不被濫用,這是通過結合PC1/RSA和角色來完成的,這可以被認爲是相對安全的嗎?

我確實找到了PC1DynamicKey,但只能演示動態密鑰。

我正在使用XE8。

回答

0

您可以使用Apache HTTP作爲反向代理和客戶端證書。 The documentation與配置的例子包括這樣的:

  • 我怎麼能強制客戶端使用證書進行身份驗證?
  • 如何強制客戶端使用特定URL的證書進行身份驗證,但仍允許任意客戶端訪問服務器的其餘部分 ?
  • 我該如何只允許擁有證書的客戶端訪問特定的URL,但允許所有客戶端訪問 服務器的其餘部分?
  • 對於來自互聯網的客戶,我如何要求具有強密碼的HTTPS以及用於訪問部分 內聯網網站的基本身份驗證或客戶端證書的HTTPS?
+0

謝謝,我們正在使用tcp comm。但是我們當然可以添加一些代理,但這並不是我想要的。 – hhaumann

0

我一直在挖這一點,並找到如下:

  1. 過濾器PC1和RSA只加密通信,並將 保護通過在第三部分的侵擾通信 網絡。 Zip只是壓縮。
  2. 訪問執行方法由datasnap中的角色控制。
  3. 訪問datasetproviders,如果導出,不受任何保護......?!?!
  4. 名稱以AS_開頭的服務器方法被隱藏,代理生成器不包含在代理客戶端類中。
  5. 以AS_開頭的數據集提供程序也被公開。
  6. [$ METHODINFO ON]對代理生成器沒有影響,可能只能由RTTI使用。

下面是一個例子ServerMethods類(我希望這次的編輯將格式化好)

`

type 
    TServerMethods1 = class(TDSServerModule) 
    Sqlserver1ad4Connection: TFDConnection; 
    Tree_alarmsTable: TFDQuery; 
    Tree_calllistsTable: TFDQuery; 
    Tree_contactsTable: TFDQuery; 
    dspAlarms: TDataSetProvider; // exported and accessable in proxy client 
    dspCalllists: TDataSetProvider; // exported and accessable in proxy client 
    dspContacts: TDataSetProvider; // exported and accessable in proxy client 
    AS_SecretDataSetProvider: TDataSetProvider; // AS_ has no effect here, exported and accessable in proxy client 
    dspContactsNotExported: TDataSetProvider; // NOT exported and NOT accessable in proxy client 
    private 
    { Private declarations } 
    public 
    { Public declarations } 
    function AS_AddCD(A, B : integer) : integer; // will not be in proxy client 
    function AddDE(A, B : integer) : integer; /// will be in proxy client, and can be accessed by anyone 
    {$METHODINFO ON} // has no effect on proxy client 
    function EchoString(AString : string) : string; // will be in proxy client, and can be accessed by anyone 
    function ReverseString(AString : string) : string; // will be in proxy client, and can be accessed by anyone 
    function ValidateUser(ALoginName, APassword : string; out AUserLevel : integer; out AUserName : string) : boolean; 
    [TAuthRoles('admins')] 
    function AddAB(A, B : integer) : integer; // will be in proxy client, and can be accessed by user with role "admins" 
    function AS_AddBC(A, B : integer) : integer; // will not be in proxy client 
    {$METHODINFO OFF} // has no effect on proxy client 
    end; 

`

代理客戶端看起來像這樣再 `

type 
    TServerMethods1Client = class(TDSAdminClient) 
    private 
    FAddDECommand: TDBXCommand; 
    FEchoStringCommand: TDBXCommand; 
    FReverseStringCommand: TDBXCommand; 
    FValidateUserCommand: TDBXCommand; 
    FAddABCommand: TDBXCommand; 
    public 
    constructor Create(ADBXConnection: TDBXConnection); overload; 
    constructor Create(ADBXConnection: TDBXConnection; AInstanceOwner: Boolean); overload; 
    destructor Destroy; override; 
    function AddDE(A: Integer; B: Integer): Integer; 
    function EchoString(AString: string): string; 
    function ReverseString(AString: string): string; 
    function ValidateUser(ALoginName: string; APassword: string; out AUserLevel: Integer; out AUserName: string): Boolean; 
    function AddAB(A: Integer; B: Integer): Integer; 
    end; 

`