Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Partitions in MB and not in % #62

Open
foresthus opened this issue Mar 9, 2018 · 10 comments
Open

Partitions in MB and not in % #62

foresthus opened this issue Mar 9, 2018 · 10 comments

Comments

@foresthus
Copy link

Hello,
I was wondering to change the percent-mounts to mb-mounts, but I am not that good in python. First of all I changed it in the redhat6-hardening meny.py and it worked. Now I treid the same with the redhat7-hardening menu.py. Under redhat6-hardening I added a new variable "

self.disk_mb = self.disk_total * 1024

". This new self.disk_mb should be the value:

First step: I changed the luks- configuration:

The server should be started up as far as possible without entering any data. In a data center this is sometimes necessary.

...
self.encrypt_disk = gtk.CheckButton('Encrypt Drives with LUKS')
self.encrypt_disk.set_active(False)
self.encrypt.pack_start(self.encrypt_disk, False, True, 0)
...

Second step: Example:

All partitions should be set from percent to an actual size. This has the advantage that the administrator can leave the defaults independent of the existing hard disk size. At a e.g. 500GB hard drive would be 10 percent for root way too much in my opinion.

root gets 2048MB

...
self.label = gtk.Label(" ROOT (/) ")
self.partitioning1.pack_start(self.label,False,True,0)
self.root_range = gtk.Adjustment(2048,1,self.disk_mb,1,100, 0)
...

Third Step:

There is a division of hard disk mountpoints. Here the standards are taken from a Linux operating system. Here I would separate the mountpoint /usr. With the optional mountpoints /opt or /var/www the question arises under Redhat, if /var/www is really necessary. The admin could set this up at any time on the console, if desired. Because if you also include repositories, under Redhat it can very easily happen that e.g. Apache (http24) does not have its files as usual under /var/www/html. These would then be under /opt/rh/httpd24/root/var/www/.

/usr gets 4096MB

...
self.label = gtk.Label("MB USR /usr ")
self.partitioning3.pack_start(self.label,False,True,0)
self.usr_range = gtk.Adjustment(4096,1,self.disk_mb,1,100, 0)
self.usr_partition = gtk.SpinButton(adjustment=self.usr_range,climb_rate=1,digits=0)
self.usr_partition.connect('value-changed',self.lvm_check)
self.partitioning3.pack_start(self.usr_partition,False,True,0)
...

Now the question:
Does anyone already have such a working version? I would be very happy to get this version of the menu.py file.

@foresthus
Copy link
Author

        # Minimal Installation Warning
        if self.disk_total < 8:
            self.MessageBox(self.window,"<b>Recommended minimum of 8Gb disk space for a Minimal Install!</b>\n\n You have "+str(self.disk_total)+"Gb available.",gtk.MESSAGE_WARNING)

        # Blank Label
        self.label = gtk.Label("")
        self.vbox.add(self.label)

        ### Variable: self.disk_mb = self.disk_total*1024
        self.disk_mb = self.disk_total * 1024
        # Partitioning
        self.label = gtk.Label('Required LVM Partitioning in MB.')
        self.vbox.add(self.label)
        self.partitioning1 = gtk.HBox()
        self.label = gtk.Label("           ROOT (/) ")
        self.partitioning1.pack_start(self.label,False,True,0)
        self.root_range = gtk.Adjustment(2048,1,self.disk_mb,1,100, 0)
        self.root_partition = gtk.SpinButton(adjustment=self.root_range,climb_rate=1,digits=0)
        self.root_partition.connect('value-changed',self.lvm_check)
        self.partitioning1.pack_start(self.root_partition,False,True,0)
        self.label = gtk.Label("MB HOME (/home) ")
        self.partitioning1.pack_start(self.label,False,True,0)
        self.home_range = gtk.Adjustment(1024,1,self.disk_mb,1,100, 0)
        self.home_partition = gtk.SpinButton(adjustment=self.home_range,climb_rate=1,digits=0)
        self.home_partition.connect('value-changed',self.lvm_check)
        self.partitioning1.pack_start(self.home_partition,False,True,0)
        self.label = gtk.Label("MB TMP (/tmp) ")
        self.partitioning1.pack_start(self.label,False,True,0)
        self.tmp_range = gtk.Adjustment(1024,1,self.disk_mb,1,100, 0)
        self.tmp_partition = gtk.SpinButton(adjustment=self.tmp_range,climb_rate=1,digits=0)
        self.tmp_partition.connect('value-changed',self.lvm_check)
        self.partitioning1.pack_start(self.tmp_partition,False,True,0)
        self.label = gtk.Label("MB VAR (/var) ")
        self.partitioning1.pack_start(self.label,False,True,0)
        self.var_range = gtk.Adjustment(2048,1,self.disk_mb,1,100, 0)
        self.var_partition = gtk.SpinButton(adjustment=self.var_range,climb_rate=1,digits=0)
        self.var_partition.connect('value-changed',self.lvm_check)
        self.partitioning1.pack_start(self.var_partition,False,True,0)
        self.label = gtk.Label("MB")
        self.partitioning1.pack_start(self.label,False,True,0)

        self.vbox.add(self.partitioning1)
        self.partitioning2 = gtk.HBox()
        self.label = gtk.Label("  LOG (/var/log) ")
        self.partitioning2.pack_start(self.label,False,True,0)
        self.log_range = gtk.Adjustment(3072,1,self.disk_mb,1,100, 0)
        self.log_partition = gtk.SpinButton(adjustment=self.log_range,climb_rate=1,digits=0)
        self.log_partition.connect('value-changed',self.lvm_check)
        self.partitioning2.pack_start(self.log_partition,False,True,0)
        self.label = gtk.Label("MB AUDIT (/var/log/audit) ")
        self.partitioning2.pack_start(self.label,False,True,0)
        self.audit_range = gtk.Adjustment(2048,1,self.disk_mb,1,100, 0)
        self.audit_partition = gtk.SpinButton(adjustment=self.audit_range,climb_rate=1,digits=0)
        self.audit_partition.connect('value-changed',self.lvm_check)
        self.partitioning2.pack_start(self.audit_partition,False,True,0)
        self.label = gtk.Label("MB SWAP ")
        self.partitioning2.pack_start(self.label,False,True,0)
        self.swap_range = gtk.Adjustment(4096,1,self.disk_mb,1,100, 0)
        self.swap_partition = gtk.SpinButton(adjustment=self.swap_range,climb_rate=1,digits=0)
        self.swap_partition.connect('value-changed',self.lvm_check)
        self.partitioning2.pack_start(self.swap_partition,False,True,0)
        self.label = gtk.Label("MB")
        self.partitioning2.pack_start(self.label,False,True,0)
        self.vbox.add(self.partitioning2)
        # Blank Label
        self.label = gtk.Label("")
        self.vbox.add(self.label)
        self.label = gtk.Label('Optional LVM Partitioning in MB.')
        self.vbox.add(self.label)

        self.partitioning3 = gtk.HBox()
        self.label = gtk.Label("       WWW (/var/www) ")
        self.partitioning3.pack_start(self.label,False,True,0)
        self.www_range = gtk.Adjustment(1024,1,self.disk_mb,1,100, 0)
        self.www_partition = gtk.SpinButton(adjustment=self.www_range,climb_rate=1,digits=0)
        self.www_partition.connect('value-changed',self.lvm_check)
        self.partitioning3.pack_start(self.www_partition,False,True,0)

        self.label = gtk.Label("MB  OPT (/opt) ")
        self.partitioning3.pack_start(self.label,False,True,0)
        self.opt_range = gtk.Adjustment(2048,1,self.disk_mb,1,100, 0)
        self.opt_partition = gtk.SpinButton(adjustment=self.opt_range,climb_rate=1,digits=0)
        self.opt_partition.connect('value-changed',self.lvm_check)
        self.partitioning3.pack_start(self.opt_partition,False,True,0)

        self.label = gtk.Label("MB  USR /usr ")
        self.partitioning3.pack_start(self.label,False,True,0)
        self.usr_range = gtk.Adjustment(4096,1,self.disk_mb,1,100, 0)
        self.usr_partition = gtk.SpinButton(adjustment=self.usr_range,climb_rate=1,digits=0)
        self.usr_partition.connect('value-changed',self.lvm_check)
        self.partitioning3.pack_start(self.usr_partition,False,True,0)

        self.label = gtk.Label("MB")
        self.partitioning3.pack_start(self.label,False,True,0)
        self.vbox.add(self.partitioning3)

@fcaviggia
Copy link
Collaborator

Pull requests accepted on this.

@foresthus
Copy link
Author

What should be done? I cannot create a Pull Request.

@fcaviggia
Copy link
Collaborator

I was thinking about this a bit - I could try to integrate both the percentage and the MB values on to the screen and link them.

@jmaughmer
Copy link

I ended up just changing the section where it writes the values to the kickstart with static values and just ignore the partition section of the menu. We use a dedicated VM for each application so I use a default minimal value on all my volumes and increase as required.

I also make a few other changes to include extra packages, firewall changes, grub user/pass changes, our CA cert chain, and additional RPM GPG keys.

@foresthus
Copy link
Author

So there will be change for MB or not?

@fcaviggia
Copy link
Collaborator

Sorry, I've been swamped with stuff I working on additional stuff this weekend - with a baby coming here in less than a month I don't have the free time I used to.

@foresthus
Copy link
Author

Hi,
I was trying to use the default partioning (%), but adding "/usr" to the file menu.py. Everything was correctly installed. The mountpoints are added, the packages are installed, the system comes up, but there is no way to login.
So I started the rescue-mode: I added the kernel with the parameter "rd.break" at the end of line here linux16 is mentioned and booted with "CTRL X". ...
Only the filesystems /root / and /usr were active. I guess that is the failure.

Then I made following steps to get the filesystem mounted as it should do.
Now switch to sysroot with ..

chroot /sysroot/
...
mount –o remount,rw /sysroot
mount -o bind /proc /sysroot/proc
mount -o bind /sys /sysroot/sys
mount -o bind /dev /sysroot/dev
vgscan
vgchange -a y vg1
mount -a

... all mountspoints are mounted correctly.

Now to my question. Is there somewhere in the code a check for mountpoint called is /usr? I cannot find one. The coding if the file menu,py should be ok from my point if view.

Any ideas for that? I would be glad to have a solution to that

@fcaviggia I hope everything is fine getting father. I wish your wife and yourself a kind of "happy landing"

cu

@fcaviggia
Copy link
Collaborator

I've actually done a fair bit of redesign to this project at work and that code is being integrated by the SIMP Project (https://simp-project.com/, https://github.com/NationalSecurityAgency/SIMP) The big change was around creating static (pre-defined) kickstarts for partitioning. Once life has settled a bit I want to contribute to that project more than this project.

Anyway, where are you preforming those commands - in the installation (pre-, during, or post- install)? Are the modifications being used with LUKS? Adding the filesystem to fstab after it's created should be all that's needed.

I'll try to respond better - weekends I've been extremely busy getting ready for the baby (2 weeks out) and work (travel, papers, presentations) - I don't mean to be ignoring stuff but life has priorities and bills. I'll try to be responsive, just swamped right now. 😄

@foresthus
Copy link
Author

Hi,
sorry 4 the delay.
I managing everything in the file menu.py in the part defining the partitioning.
My aim is to use MB instead of percent. I described it above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants