我有一個用C#和F#的組合編寫的Web角色,我想在GitHub上公開一個開源項目。Azure Web角色 - 如何確保開源項目的安全?
這裏是我的ServiceConfiguration.Cloud.cscfg
文件:
<?xml version="1.0" encoding="utf-8"?>
<ServiceConfiguration serviceName="My.Cloud.Service" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="4" osVersion="*" schemaVersion="2015-04.2.6">
<Role name="My.Web.Role">
<Instances count="1" />
<ConfigurationSettings>
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=<<myaccountkey>>" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.Enabled" value="true" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountUsername" value="roblyndon" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountEncryptedPassword" value="<<my encrypted password>>" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountExpiration" value="2017-05-17T23:59:59.0000000+01:00" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteForwarder.Enabled" value="true" />
<Setting name="APPINSIGHTS_INSTRUMENTATIONKEY" value="205ceb49-275d-4c1c-a42c-fd7e55be0229" />
</ConfigurationSettings>
<Certificates>
<Certificate name="Microsoft.WindowsAzure.Plugins.RemoteAccess.PasswordEncryption" thumbprint="35DE0821166BCB100B2BA7FF339436DA0CBC089F" thumbprintAlgorithm="sha1" />
</Certificates>
</Role>
</ServiceConfiguration>
我很想不躲<<my encrypted password>>
- 它畢竟是加密的,儘管SHA-1。
這樣做的錯誤在於,儘管我的遠程訪問密碼被加密,但直接暴露了指向我的存儲帳戶的診斷連接字符串。實際上,它包含我的存儲帳戶的主要訪問密鑰的未加密版本。
如果我把它放到一個開源項目中,我想包括我的cscfg
文件,但顯然我無法做到這一點,而它公開我的私人數據。就像我現在所做的那樣,將它們放入.gitignore
中會爲試圖克隆存儲庫的任何人創建編譯頭痛的問題。
有沒有辦法讓我的cscfg
文件安全?
編輯:請注意,這不是一個關於在敏感數據隱藏在開源項目中的通用問題。有幾種策略可以做到這一點,具體取決於您正在使用哪種項目。對於網絡角色來說,實施這些標準解決方案非常困難,而試圖這樣做可能會打破構建。明顯的答案是.gitignore
整個ccproj
雲服務項目,並讓合作者只能訪問關聯的Web項目。
這是特定於Azure的。診斷連接字符串已生成。對這個問題的接受答案是指不同語言的不同環境;其他人過於通用而不感興趣。 –
爲什麼你不把這些東西存儲在應用程序設置中? –
我很困惑這個問題:你爲什麼覺得你需要發佈你的訂閱的鑰匙,只是因爲它是一個開源項目?這沒有意義。 –