Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 18 additions & 16 deletions netci.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ def project = GithubProject

// Globals

// List of all CI OS
def allOSs = ['Ubuntu', 'Debian8.2', 'OSX', 'FreeBSD', 'CentOS7.1', 'OpenSUSE13.2', 'Windows 10', 'Windows 7', 'Windows_NT']
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this used? Perhaps I missed it but I don't see it used in the script anywhere.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not used anywhere currently, but will be used when all OSes are supported in Outerloop. Will remove the def Outerloop then. Sorry your comment didnt update on my client.. Saw this only now.

// Map of os -> osGroup.
def osGroupMap = ['Ubuntu':'Linux',
'Ubuntu15.10':'Linux',
Expand Down Expand Up @@ -102,36 +104,36 @@ branchList.each { branchName ->
}

// **************************
// Define outerloop windows testing. Run locally on each machine.
// Define outerloop windows/ubuntu testing. Run locally on each machine.
// **************************

def osShortName = ['Windows 10': 'win10', 'Windows 7' : 'win7', 'Windows_NT' : 'windows_nt', 'Ubuntu' : 'ubuntu', 'OSX' : 'osx']
def osShortName = ['Windows 10': 'win10', 'Windows 7' : 'win7', 'Windows_NT' : 'windows_nt', 'Ubuntu14.04' : 'ubuntu14.04']
def outerloopOSs = ['Windows 10', 'Windows 7', 'Windows_NT', 'Ubuntu14.04']
branchList.each { branchName ->
['Windows 10', 'Windows 7', 'Windows_NT', 'Ubuntu', 'OSX'].each { os ->
outerloopOSs.each { os ->
['Debug', 'Release'].each { configurationGroup ->

def isPR = (branchName == 'pr')
def newJobName = "outerloop_${osShortName[os]}_${configurationGroup.toLowerCase()}"

def newJob
if (os != 'Ubuntu' && os != 'OSX') {
newJob = job(getJobName(Utilities.getFullJobName(project, newJobName, isPR), branchName)) {
steps {
batchFile("call \"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\vcvarsall.bat\" x86 && Build.cmd /p:ConfigurationGroup=${configurationGroup} /p:WithCategories=\"InnerLoop;OuterLoop\" /p:TestWithLocalLibraries=true")
def newJob = job(getJobName(Utilities.getFullJobName(project, newJobName, isPR), branchName)) {
steps {
if (os == 'Ubuntu14.04') {
shell("sudo HOME=\$WORKSPACE/tempHome ./build.sh x64 ${configurationGroup.toLowerCase()} /p:WithCategories=\\\"Innerloop;OuterLoop\\\" /p:TestWithLocalLibraries=true")
}
}
} else {
newJob = job(getJobName(Utilities.getFullJobName(project, newJobName, isPR), branchName)) {
// Jobs run as a service in unix, which means that HOME variable is not set, and it is required for restoring packages
// so we set it first, and then call build.sh
steps {
shell("HOME=\$WORKSPACE/tempHome ./build.sh /p:ConfigurationGroup=${configurationGroup} /p:WithCategories=\"\\\"InnerLoop;OuterLoop\\\"\" /p:TestWithLocalLibraries=true")
else {
batchFile("call \"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\vcvarsall.bat\" x86 && Build.cmd /p:ConfigurationGroup=${configurationGroup} /p:WithCategories=\"InnerLoop;OuterLoop\" /p:TestWithLocalLibraries=true")
}
}
}

// Set the affinity. OS name matches the machine affinity.
Utilities.setMachineAffinity(newJob, os)
if (os == 'Ubuntu14.04') {
Utilities.setMachineAffinity(newJob, os, '201626test')
}
else {
Utilities.setMachineAffinity(newJob, os)
}
// Set up standard options.
Utilities.standardJobSetup(newJob, project, isPR, getFullBranchName(branchName))
// Add the unit test results
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<PropertyGroup>
<Configuration Condition="'$(Configuration)'==''">Windows_Debug</Configuration>
Expand All @@ -10,7 +10,6 @@
<ProjectGuid>{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}</ProjectGuid>
<OutputType>Library</OutputType>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetsWindows)' == 'true' and '$(ProjectJson)' == '' ">
<ProjectJson>win/project.json</ProjectJson>
<ProjectLockJson>win/project.lock.json</ProjectLockJson>
Expand All @@ -19,19 +18,16 @@
<ProjectJson>unix/project.json</ProjectJson>
<ProjectLockJson>unix/project.lock.json</ProjectLockJson>
</PropertyGroup>

<!-- Help VS understand available configurations -->
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Linux_Debug|AnyCPU' " />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Linux_Release|AnyCPU' " />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'OSX_Debug|AnyCPU' " />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'OSX_Release|AnyCPU' " />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Windows_Debug|AnyCPU' " />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Windows_Release|AnyCPU' " />

<ItemGroup>
<Compile Include="DummyTcpServer.cs" />
<Compile Include="TestConfiguration.cs" />

<!-- SslStream Tests -->
<Compile Include="CertificateChainValidation.cs" />
<Compile Include="CertificateValidationClientServer.cs" />
Expand All @@ -47,10 +43,8 @@
<Compile Include="SslStreamNetworkStreamTest.cs" />
<Compile Include="StreamAPMExtensions.cs" />
<Compile Include="TransportContextTest.cs" />

<!-- NegotiateStream Tests -->
<Compile Include="NegotiateStreamStreamToStreamTest.cs" />

<!-- Common test files -->
<Compile Include="$(CommonTestPath)\System\Net\HttpTestServers.cs">
<Link>Common\System\Net\HttpTestServers.cs</Link>
Expand Down Expand Up @@ -83,27 +77,29 @@
<Link>Common\System\Threading\Tasks\TaskTimeoutExtensions.cs</Link>
</Compile>
</ItemGroup>

<ItemGroup Condition=" '$(TargetsWindows)' == 'true' ">
<Compile Include="IdentityValidator.Windows.cs" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetsUnix)' == 'true' ">
<Compile Include="IdentityValidator.Unix.cs" />
<None Include="..\Scripts\kdc.conf">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="..\Scripts\setup-kdc.sh">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="..\Scripts\krb5.conf">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\System.Net.Security.csproj">
<Project>{89F37791-6254-4D60-AB96-ACD3CCA0E771}</Project>
<Name>System.Net.Security</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="project.json" />
</ItemGroup>
<ItemGroup>
<SupplementalTestData Include="$(PackagesDir)System.Net.TestData\1.0.0-prerelease\content\**\*.*" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>

16 changes: 16 additions & 0 deletions src/System.Net.Security/tests/Scripts/kdc.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[kdcdefaults]
kdc_ports = 750,88

[realms]
TEST.COREFX.NET = {
database_name = /var/lib/krb5kdc/principal
admin_keytab = FILE:/etc/krb5kdc/kadm5.keytab
acl_file = /etc/krb5kdc/kadm5.acl
key_stash_file = /etc/krb5kdc/stash
kdc_ports = 750,88
max_life = 10h 0m 0s
max_renewable_life = 7d 0h 0m 0s
master_key_type = des3-hmac-sha1
supported_enctypes = aes256-cts:normal arcfour-hmac:normal des3-hmac-sha1:normal des-cbc-crc:normal des:normal des:v4 des:norealm des:onlyrealm des:afs3
default_principal_flags = +preauth
}
12 changes: 12 additions & 0 deletions src/System.Net.Security/tests/Scripts/krb5.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[libdefaults]
default_realm = TEST.COREFX.NET

[realms]
TEST.COREFX.NET = {
kdc = localhost
admin_server = localhost
default_domain = test.corefx.net
}

[domain_realm]
.test.corefx.net = TEST.COREFX.NET
97 changes: 97 additions & 0 deletions src/System.Net.Security/tests/Scripts/setup-kdc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
#!/bin/bash

OS=`cat /etc/os-release | grep "PRETTY_NAME" | sed 's/PRETTY_NAME=//g' | sed 's/["]//g' | awk '{print $1}'`
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why parse PRETTY_NAME when you can just read ID from os-release?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rahulkotecha Can you please address the PR comments on networking scripts. Thanks!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure.. Rahul can take care of all these changes when he sends his PR with the updates required for other distros as well

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

took care of these changes and changes required for other Linux distros as part of: rahulkotecha-zz@e8acf95
Thanks!


realm="TEST.COREFX.NET"

principal1="HOST/host.test.corefx.net"
principal2="HTTP"
krb_user="krb_user"
password="password"

kadmin="kadmin.local"
krb5kdc="krb5kdc"
kdb5_util="kdb5_util"
add_principal_cmd="add_principal -pw ${password}"

krb_conf="krb5.conf"
kdc_conf="kdc.conf"
keytabfile="/etc/krb5.keytab"

# TODO: These locations varies for different distros, Set the values conditianally
krb_conf_location="/etc/"
kdc_conf_location="/etc/krb5kdc/"
database_file="/var/lib/krb5kdc/principal*"

kdc_setup()
{
#Create/copy krb5.conf in /etc/ and kdc.conf in /etc/krb5kdc/
echo "Copying krb5.conf and kdc.conf.."
sudo /bin/cp ${krb_conf} ${krb_conf_location}
sudo /bin/cp ${kdc_conf} ${kdc_conf_location}

echo "Creating KDC database for realm ${realm}.."
sudo ${kdb5_util} create -r ${realm} -P ${password} -s

echo "Adding principal ${principal1}.."
sudo ${kadmin} -q "${add_principal_cmd} ${principal1}@${realm}"

echo "Adding principal ${principal2}.."
sudo ${kadmin} -q "${add_principal_cmd} ${principal2}@${realm}"

echo "Adding user ${krb_user}.."
sudo ${kadmin} -q "${add_principal_cmd} ${krb_user}@${realm}"

echo "Exporting keytab for ${principal1}"
sudo ${kadmin} -q "ktadd ${principal1}@${realm}"

echo "Exporting keytab for ${principal2}"
sudo ${kadmin} -q "ktadd ${principal2}@${realm}"

echo "Exporting keytab for ${krb_user}"
sudo ${kadmin} -q "ktadd ${krb_user}@${realm}"
}

echo "Removing existing database"
sudo rm -rf ${database_file}

case ${OS} in
"Ubuntu")
dpkg -s krb5-kdc >/dev/null 2>&1
if [ $? -ne 0 ]
then
echo "Installing krb5-kdc.."
sudo DEBIAN_FRONTEND=noninteractive apt-get -y install krb5-kdc krb5-admin-server
else
echo "krb5-kdc already installed.."
fi

echo "Stopping KDC.."
if pgrep krb5kdc 2> /dev/null; then killall krb5kdc ; fi
if pgrep kadmind 2> /dev/null; then killall kadmind ; fi

kdc_setup

echo "Starting KDC.."
sudo ${krb5kdc}

;;

"Debian")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not just echo ${OS}

echo "This is a Debian system"
;;

"CentOS")
echo "This is a CentOS system"
;;

"Red Hat")
echo "This is a RedHat system"
;;

*)
echo "This is an Unknown system"
;;
esac

sudo chmod +r ${keytabfile}