Skip to content
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
4 changes: 2 additions & 2 deletions release/community-stable/archlinux/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ RUN \
&& rm -f /tmp/powershell-linux.tar.gz \
# Create the pwsh symbolic link that points to powershell
&& ln -s ${PS_INSTALL_FOLDER}/pwsh /usr/bin/pwsh \
# Give all user execute permissions
&& chmod a+x ${PS_INSTALL_FOLDER}/pwsh \
# Give all user execute permissions and remove write permissions for others
&& chmod a+x,o-w ${PS_INSTALL_FOLDER}/pwsh \
# intialize powershell module cache
&& pwsh \
-NoLogo \
Expand Down
4 changes: 2 additions & 2 deletions release/community-stable/blackarch/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ RUN \
&& rm -f /tmp/powershell-linux.tar.gz \
# Create the pwsh symbolic link that points to powershell
&& ln -s ${PS_INSTALL_FOLDER}/pwsh /usr/bin/pwsh \
# Give all user execute permissions
&& chmod a+x ${PS_INSTALL_FOLDER}/pwsh \
# Give all user execute permissions and remove write permissions for others
&& chmod a+x,o-w ${PS_INSTALL_FOLDER}/pwsh \
# intialize powershell module cache
&& pwsh \
-NoLogo \
Expand Down
4 changes: 2 additions & 2 deletions release/community-stable/parrot/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ RUN \
&& apt-get install -y /tmp/powershell.deb \
# remove powershell package
&& rm -f /tmp/powershell.deb \
# Give all user execute permissions
&& chmod a+x ${PS_INSTALL_FOLDER}/pwsh \
# Give all user execute permissions and remove write permissions for others
&& chmod a+x,o-w ${PS_INSTALL_FOLDER}/pwsh \
# intialize powershell module cache
&& pwsh \
-NoLogo \
Expand Down
4 changes: 2 additions & 2 deletions release/community-stable/photon/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ RUN \
&& locale-gen.sh \
# create the pwsh symbolic link that points to powershell
&& ln -s ${PS_INSTALL_FOLDER}/pwsh /usr/bin/pwsh \
# Give all user execute permissions
&& chmod a+x ${PS_INSTALL_FOLDER}/pwsh \
# Give all user execute permissions and remove write permissions for others
&& chmod a+x,o-w ${PS_INSTALL_FOLDER}/pwsh \
# intialize powershell module cache
&& pwsh \
-NoLogo \
Expand Down
4 changes: 2 additions & 2 deletions release/preview/alpine/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ RUN apk add --no-cache \
\
# Create the pwsh-preview symbolic link that points to powershell
&& ln -s ${PS_INSTALL_FOLDER}/pwsh /usr/bin/pwsh-preview \
# Give all user execute permissions
&& chmod a+x ${PS_INSTALL_FOLDER}/pwsh \
# Give all user execute permissions and remove write permissions for others
&& chmod a+x,o-w ${PS_INSTALL_FOLDER}/pwsh \
# intialize powershell module cache
&& pwsh \
-NoLogo \
Expand Down
4 changes: 2 additions & 2 deletions release/preview/opensuse423/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ RUN zypper --non-interactive update --skip-interactive \
# Create the pwsh symbolic link that points to powershell
&& ln -s ${PS_INSTALL_FOLDER}/pwsh /usr/bin/pwsh \
&& ln -sf ${PS_INSTALL_FOLDER}/pwsh /usr/bin/pwsh-preview \
# Give all user execute permissions
&& chmod a+x ${PS_INSTALL_FOLDER}/pwsh \
# Give all user execute permissions and remove write permissions for others
&& chmod a+x,o-w ${PS_INSTALL_FOLDER}/pwsh \
# clean package manager cache
&& zypper clean -a \
# remove package manager log file
Expand Down
4 changes: 2 additions & 2 deletions release/servicing/alpine/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ RUN apk add --no-cache \
\
# Create the pwsh symbolic link that points to powershell
&& ln -s ${PS_INSTALL_FOLDER}/pwsh /usr/bin/pwsh \
# Give all user execute permissions
&& chmod a+x ${PS_INSTALL_FOLDER}/pwsh \
# Give all user execute permissions and remove write permissions for others
&& chmod a+x,o-w ${PS_INSTALL_FOLDER}/pwsh \
# intialize powershell module cache
&& pwsh \
-NoLogo \
Expand Down
4 changes: 2 additions & 2 deletions release/servicing/opensuse423/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ RUN zypper --non-interactive update --skip-interactive \
&& localedef --charmap=UTF-8 --inputfile=en_US $LANG \
# Create the pwsh symbolic link that points to powershell
&& ln -s ${PS_INSTALL_FOLDER}/pwsh /usr/bin/pwsh \
# Give all user execute permissions
&& chmod a+x ${PS_INSTALL_FOLDER}/pwsh \
# Give all user execute permissions and remove write permissions for others
&& chmod a+x,o-w ${PS_INSTALL_FOLDER}/pwsh \
# clean package manager cache
&& zypper clean -a \
# remove package manager log file
Expand Down
4 changes: 2 additions & 2 deletions release/stable/alpine/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ RUN apk add --no-cache \
\
# Create the pwsh symbolic link that points to powershell
&& ln -s ${PS_INSTALL_FOLDER}/pwsh /usr/bin/pwsh \
# Give all user execute permissions
&& chmod a+x ${PS_INSTALL_FOLDER}/pwsh \
# Give all user execute permissions and remove write permissions for others
&& chmod a+x,o-w ${PS_INSTALL_FOLDER}/pwsh \
# intialize powershell module cache
&& pwsh \
-NoLogo \
Expand Down
4 changes: 2 additions & 2 deletions release/stable/opensuse423/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ RUN zypper --non-interactive update --skip-interactive \
&& localedef --charmap=UTF-8 --inputfile=en_US $LANG \
# Create the pwsh symbolic link that points to powershell
&& ln -s ${PS_INSTALL_FOLDER}/pwsh /usr/bin/pwsh \
# Give all user execute permissions
&& chmod a+x ${PS_INSTALL_FOLDER}/pwsh \
# Give all user execute permissions and remove write permissions for others
&& chmod a+x,o-w ${PS_INSTALL_FOLDER}/pwsh \
# clean package manager cache
&& zypper clean -a \
# remove package manager log file
Expand Down
21 changes: 20 additions & 1 deletion tests/container.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ Describe "Linux Containers" -Tags 'Behavior', 'Linux' {
)
}

it "The permissions for pwsh should be correct in <channel>-<Name>" -TestCases $permissionsTestCases -Skip:$script:skipLinuxRun {
it "pwsh should have execute permissions for all in <channel>-<Name>" -TestCases $permissionsTestCases -Skip:$script:skipLinuxRun {
param(
[Parameter(Mandatory=$true)]
[string]
Expand All @@ -347,6 +347,25 @@ Describe "Linux Containers" -Tags 'Behavior', 'Linux' {
$permissions = Get-DockerImagePwshPermissions -Name $name -Path $path
$permissions | Should -Match '^[\-rw]{3}x([\-rw]{2}x){2}$' -Because 'Everyone should be able to execute'
}
it "pwsh should NOT have write permissions for others in <channel>-<Name>" -TestCases $permissionsTestCases -Skip:$script:skipLinuxRun {
param(
[Parameter(Mandatory=$true)]
[string]
$name,
[string]
$Channel
)

$path = '/opt/microsoft/powershell/6/pwsh'

if($Channel -eq 'preview')
{
$path = '/opt/microsoft/powershell/6-preview/pwsh'
}

$permissions = Get-DockerImagePwshPermissions -Name $name -Path $path
$permissions | Should -Match '^[\-rwx]{4}[\-rwx]{3}[\-rx]{3}$' -Because 'Others should not be able to write'
}
}

Context "default executables" {
Expand Down