Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
a64bdf5f
Commit
a64bdf5f
authored
Aug 19, 2011
by
Robert Haas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow sepgsql regression tests to be run from a user homedir.
KaiGai Kohei, with some changes by me.
parent
00a7c901
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
12 deletions
+53
-12
contrib/sepgsql/chkselinuxenv
contrib/sepgsql/chkselinuxenv
+50
-11
contrib/sepgsql/sepgsql-regtest.te
contrib/sepgsql/sepgsql-regtest.te
+3
-1
No files found.
contrib/sepgsql/chkselinuxenv
View file @
a64bdf5f
...
@@ -9,6 +9,33 @@ PG_DATADIR="$2"
...
@@ -9,6 +9,33 @@ PG_DATADIR="$2"
echo
echo
echo
"============== checking selinux environment =============="
echo
"============== checking selinux environment =============="
#
# Test.0 - necessary commands for environment checks
#
echo
-n
"test installed commands ... "
if
!
which
--help
>
&/dev/null
;
then
echo
"failed"
echo
echo
"'which' command was not found, executable or installed."
echo
"Please make sure your PATH, or install this command at first."
echo
echo
"If yum is available on your system, it will suggest packages"
echo
"to be installed:"
echo
" # yum provides which"
exit
1
fi
if
!
matchpathcon
-n
/
>
&/dev/null
;
then
echo
"failed"
echo
echo
"'matchpathcon' command was not found, executable or installed."
echo
"Please make sure your PATH, or install this command at first."
echo
echo
"If yum is available on your system, it will suggest packages"
echo
"to be installed:"
echo
" # yum provides which"
exit
1
fi
echo
"ok"
#
#
# Test.1 - must be launched at unconfined_t domain
# Test.1 - must be launched at unconfined_t domain
...
@@ -164,24 +191,36 @@ fi
...
@@ -164,24 +191,36 @@ fi
echo
"ok"
echo
"ok"
#
#
# Test.8 - 'psql' command must be
labeled as 'bin_t' type
# Test.8 - 'psql' command must be
executable by test domain
#
#
echo
-n
"test
label of psql
... "
echo
-n
"test
execution of psql
... "
CMD_PSQL
=
"
${
PG_BINDIR
}
/psql"
CMD_PSQL
=
"
${
PG_BINDIR
}
/psql"
LABEL_PSQL
=
`
stat
-c
'%C'
${
CMD_PSQL
}
|
sed
's/:/ /g'
|
awk
'{print $3}'
`
${
CMD_RUNCON
}
-t
sepgsql_regtest_user_t
${
CMD_PSQL
}
--help
>
& /dev/null
if
[
"
${
LABEL_PSQL
}
"
!=
"bin_t"
]
;
then
if
[
$?
-ne
0
]
;
then
echo
"failed"
echo
"failed"
echo
echo
echo
"The
${
CMD_PSQL
}
must be labeled as bin_t type."
echo
"The
${
CMD_PSQL
}
must be executable by sepgsql_regtest_user_t"
echo
"You can assign right label using restorecon, as follows:"
echo
"domain. It has restricted privileges compared to unconfined_t,"
echo
"so you should ensure whether this command is labeled correctly."
echo
echo
echo
"
\$
su - (not needed, if you owns installation directory)"
echo
"
\$
su - (not needed, if you owns installation directory)"
echo
" # restorecon -R
${
PG_BINDIR
}
"
EXPECT_PSQL
=
`
matchpathcon
-n
${
CMD_PSQL
}
|
sed
's/:/ /g'
|
awk
'{print $3}'
`
echo
if
[
"
${
EXPECT_PSQL
}
"
=
"user_home_t"
]
;
then
echo
"Or, using chcon"
## Case of installation on /home directory
echo
echo
" # restorecon -R
${
PG_BINDIR
}
"
echo
" # chcon -t bin_t
${
CMD_PSQL
}
"
echo
echo
"Or, using chcon"
echo
echo
" # chcon -t user_home_t
${
CMD_PSQL
}
"
else
echo
"
\$
su - (not needed, if you own the installation directory)"
echo
" # restorecon -R
${
PG_BINDIR
}
"
echo
echo
"Or, using chcon"
echo
echo
" # chcon -t bin_t
${
CMD_PSQL
}
"
fi
echo
echo
exit
1
exit
1
fi
fi
...
...
contrib/sepgsql/sepgsql-regtest.te
View file @
a64bdf5f
policy_module(sepgsql-regtest, 1.0
2
)
policy_module(sepgsql-regtest, 1.0
3
)
gen_require(`
gen_require(`
all_userspace_class_perms
all_userspace_class_perms
...
@@ -24,6 +24,7 @@ postgresql_procedure_object(sepgsql_regtest_trusted_proc_exec_t)
...
@@ -24,6 +24,7 @@ postgresql_procedure_object(sepgsql_regtest_trusted_proc_exec_t)
role sepgsql_regtest_dba_r;
role sepgsql_regtest_dba_r;
userdom_base_user_template(sepgsql_regtest_dba)
userdom_base_user_template(sepgsql_regtest_dba)
userdom_manage_home_role(sepgsql_regtest_dba_r, sepgsql_regtest_dba_t)
userdom_manage_home_role(sepgsql_regtest_dba_r, sepgsql_regtest_dba_t)
userdom_exec_user_home_content_files(sepgsql_regtest_dba_t)
userdom_write_user_tmp_sockets(sepgsql_regtest_user_t)
userdom_write_user_tmp_sockets(sepgsql_regtest_user_t)
optional_policy(`
optional_policy(`
postgresql_admin(sepgsql_regtest_dba_t, sepgsql_regtest_dba_r)
postgresql_admin(sepgsql_regtest_dba_t, sepgsql_regtest_dba_r)
...
@@ -40,6 +41,7 @@ optional_policy(`
...
@@ -40,6 +41,7 @@ optional_policy(`
role sepgsql_regtest_user_r;
role sepgsql_regtest_user_r;
userdom_base_user_template(sepgsql_regtest_user)
userdom_base_user_template(sepgsql_regtest_user)
userdom_manage_home_role(sepgsql_regtest_user_r, sepgsql_regtest_user_t)
userdom_manage_home_role(sepgsql_regtest_user_r, sepgsql_regtest_user_t)
userdom_exec_user_home_content_files(sepgsql_regtest_user_t)
userdom_write_user_tmp_sockets(sepgsql_regtest_user_t)
userdom_write_user_tmp_sockets(sepgsql_regtest_user_t)
optional_policy(`
optional_policy(`
postgresql_role(sepgsql_regtest_user_r, sepgsql_regtest_user_t)
postgresql_role(sepgsql_regtest_user_r, sepgsql_regtest_user_t)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment