Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
snf-image-creator
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
itminedu
snf-image-creator
Commits
e97aafe5
Commit
e97aafe5
authored
10 years ago
by
Nikos Skalkotos
Browse files
Options
Downloads
Patches
Plain Diff
Make the sensitive_userdata a list sysprep param
The user may alter the list of sensitive userdata
parent
4cc83e2e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
image_creator/os_type/unix.py
+30
-14
30 additions, 14 deletions
image_creator/os_type/unix.py
with
30 additions
and
14 deletions
image_creator/os_type/unix.py
+
30
−
14
View file @
e97aafe5
...
...
@@ -17,7 +17,7 @@
"""
This module hosts OS-specific code common to all Unix-like OSs.
"""
from
image_creator.os_type
import
OSBase
,
sysprep
from
image_creator.os_type
import
OSBase
,
sysprep
,
add_sysprep_param
# Credits go to Wmconfig (https://www.arrishq.net/) for the biggest part of
# this collection
...
...
@@ -78,23 +78,38 @@ DESKTOPSESSIONS = {
(
'
windowlab
'
,):
'
WindowLab
'
,
(
'
xmonad
'
,):
'
xmonad
'
,
}
X11_EXECUTABLE
=
'
startx
'
SENSITIVE_USERDATA
=
[
'
.history
'
,
'
.sh_history
'
,
'
.bash_history
'
,
'
.zsh_history
'
,
'
.gnupg
'
,
'
.ssh
'
,
'
.kamakirc
'
,
'
.kamaki.history
'
,
'
.kamaki.log
'
]
def
check_sensitive_userdata
(
value
):
"
Do not allow a zero string
"
if
len
(
value
)
==
0
:
raise
ValueError
(
"
Filename cannot be empty
"
)
return
value
class
Unix
(
OSBase
):
"""
OS class for Unix
"""
sensitive_userdata
=
[
'
.history
'
,
'
.sh_history
'
,
'
.bash_history
'
,
'
.zsh_history
'
,
'
.gnupg
'
,
'
.ssh
'
,
'
.kamakirc
'
,
'
.kamaki.history
'
,
'
.kamaki.log
'
]
@add_sysprep_param
(
'
sensitive_userdata
'
,
'
list:string
'
,
SENSITIVE_USERDATA
,
'
Files in the home directory of each user that should be removed
'
,
check
=
check_sensitive_userdata
)
def
__init__
(
self
,
image
,
**
kwargs
):
super
(
Unix
,
self
).
__init__
(
image
,
**
kwargs
)
def
_mountpoints
(
self
):
"""
Return mountpoints in the correct order.
...
...
@@ -231,8 +246,9 @@ class Unix(OSBase):
else
:
self
.
out
.
warn
(
"
Sensitive data won
'
t be scrubbed (not supported)
"
)
sensitive_userdata
=
self
.
sysprep_params
[
'
sensitive_userdata
'
].
value
for
homedir
in
homedirs
:
for
data
in
self
.
sensitive_userdata
:
for
data
in
sensitive_userdata
:
fname
=
"
%s/%s
"
%
(
homedir
,
data
)
if
self
.
image
.
g
.
is_file
(
fname
):
action
(
fname
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment