Skip to content

Commit

Permalink
Misc. corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
VivienMla committed Nov 18, 2022
1 parent 56207ef commit 087cab7
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 13 deletions.
3 changes: 2 additions & 1 deletion components/base-debian-bullseye/packages.list
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ borgbackup rclone
python3-pacparser
python3-requests python3-gi python3-dbus
btrfs-progs
firmware-iwlwifi
firmware-linux
sshfs
opensc-pkcs11
tpm2-tools
pciutils
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/sh

# This file is part of INSECA.
#
# Copyright (C) 2022 INSECA authors
#
# INSECA is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# INSECA is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with INSECA. If not, see <https://www.gnu.org/licenses/>

for svce in fairshell-virt-system
do
systemctl stop $svce
systemctl disable $svce
done
10 changes: 7 additions & 3 deletions lib/EncLUKS.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,13 @@ def open(self):
2: "invalid password",
3: "out of memory",
4: "wrong device",
5: "device already exists or is busy"
5: "device already exists or is busy",
-9: "Not enough memory" # OOM killer did its job
}
raise Exception("Unable to open LUKS volume '%s': %s"%(self._part_name, msgs[status]))
if status in msgs:
raise Exception("Unable to open LUKS volume '%s': %s"%(self._part_name, msgs[status]))
raise Exception("Unable to open LUKS volume '%s': %s(%s)"%(self._part_name, status))

(mapped, mp)=util.get_encrypted_partition_mapped_elements(self._part_name)
return mapped

Expand All @@ -56,7 +60,7 @@ def create(self):
# LUKS format
if not self._password:
raise Exception("No password specified")
args=["/sbin/cryptsetup", "luksFormat", self._part_name, "--type", "luks2", "-d", "-"]
args=["/sbin/cryptsetup", "luksFormat", self._part_name, "--type", "luks2", "--pbkdf-memory", "524288", "-d", "-"] # limit mem consumption to 512 Mio
(status, out, err)=util.exec_sync(args, stdin_data=self._password) # no newline!
if status != 0:
# from the man page: Error codes are: 1 wrong parameters, 2 no permission (bad passphrase),
Expand Down
12 changes: 8 additions & 4 deletions lib/Live.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ class BootProcessWKS:
@staticmethod
def get_instance(live_env=None):
"""Method to get a singleton"""
if BootProcessWKS.__instance is None :
if BootProcessWKS.__instance is None and live_env:
BootProcessWKS.__instance = BootProcessWKS(live_env)
return BootProcessWKS.__instance

Expand Down Expand Up @@ -315,7 +315,7 @@ def unlock(self, user_password):
data=util.load_file_contents("%s/resources/internal-pass.enc"%dmp)
int_password=eobj.decrypt(data).decode()

self._dev.set_partition_secret("internal", "password", int_password)
self._dev.set_partition_secret(partid_internal, "password", int_password)
self._dev.mount(partid_internal, "/internal", options="nodev,x-gvfs-hide", auto_umount=False)

# unlock and mount "data" partition
Expand Down Expand Up @@ -372,7 +372,8 @@ def unlock(self, user_password):

def map_directories(self):
"""Map directories from the /data partition"""
data_map=json.load(open("/opt/share/inseca-data-map.json", "r"))
map_file="/opt/share/inseca-data-map.json"
data_map=json.load(open(map_file, "r"))
for key in data_map:
dest=data_map[key]
src="/data/%s"%key
Expand All @@ -389,7 +390,10 @@ def map_directories(self):
raise Exception("Could not bind 'data/%s' to '%s': %s"%(src, dest, err))

def unmap_directories(self):
data_map=json.load(open("/opt/share/inseca-data-map.json", "r"))
map_file="/opt/share/inseca-data-map.json"
if not os.path.exists(map_file):
return
data_map=json.load(open(map_file, "r"))
for key in data_map:
dest=data_map[key]
syslog.syslog(syslog.LOG_INFO, "Unbinding %s"%dest)
Expand Down
5 changes: 2 additions & 3 deletions tools/inseca
Original file line number Diff line number Diff line change
Expand Up @@ -438,8 +438,6 @@ def list_configs(args):
elif ctype=="repo":
configs=gconf.repo_configs
for type in confs.RepoType:
if not args.verbose and type!=confs.RepoType.USERDATA:
continue
print("%s repositories:"%type.value.upper())
for uid in configs:
rconf=gconf.get_repo_conf(uid)
Expand Down Expand Up @@ -1108,6 +1106,7 @@ def sync_pull(args):

# extract last archive of BUILD and USERDATA repos
util.print_event("Extracting last BUILD and USERDATA archives")
ngconf=confs.GlobalConfiguration()
for ruid in updated_repos:
rconf=ngconf.get_repo_conf(ruid)
if rconf.type in (confs.RepoType.BUILD, confs.RepoType.USERDATA):
Expand Down Expand Up @@ -2099,7 +2098,7 @@ def dev_run_in_vm(args):
# umount all partitions of @target
Device.umount_all_partitions(args.devfile)

mem=2048
mem=3072
if args.mem:
mem=int(args.mem)

Expand Down
Binary file modified tools/resources/grub-config/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions tools/resources/template-generic-build.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"validity-months": 3,
"version": "0.1",
"components": {
"base-debian-bullseye": {
"base-debian-bullseye": null,
"gnome-desktop": {
"display-type": "wayland"
},
"veracrypt": null,
Expand All @@ -23,7 +24,7 @@
"sandboxed-programs": null,
"inseca-live-wks": {
"userdata-skey-pub-file": "userdata-sign-key.pub",
"network-connections-allowed": true,
"allow-network-connections": true,
"allowed-virtualized": ""
}
}
Expand Down

0 comments on commit 087cab7

Please sign in to comment.