Class: Installation::Dialogs::Security

Inherits:
CWM::Dialog
  • Object
show all
Defined in:
src/lib/installation/dialogs/security.rb

Overview

Dialog for security proposal configuration

Instance Method Summary collapse

Constructor Details

#initialize(settings) ⇒ Security

Returns a new instance of Security.


32
33
34
35
36
37
# File 'src/lib/installation/dialogs/security.rb', line 32

def initialize(settings)
  super()
  textdomain "installation"

  @settings = settings
end

Instance Method Details

#abort_buttonObject


70
71
72
# File 'src/lib/installation/dialogs/security.rb', line 70

def abort_button
  ""
end

#back_buttonObject


74
75
76
77
# File 'src/lib/installation/dialogs/security.rb', line 74

def back_button
  # do not show back button when running on running system. See CWM::Dialog.back_button
  Yast::Mode.installation ? nil : ""
end

#contentsObject


43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'src/lib/installation/dialogs/security.rb', line 43

def contents
  # lazy require to avoid build dependency on firewall
  require "y2firewall/widgets/proposal"
  # lazy require to avoid build dependency on bootloader
  require "bootloader/grub2_widgets"

  left_col = [firewall_frame, polkit_frame]
  right_col = [cpu_frame]
  right_col << lsm_frame if lsm_configurable?

  HBox(
    HStretch(),
    VBox(
      VStretch(),
      *left_col,
      VStretch()
    ),
    HStretch(),
    VBox(
      VStretch(),
      *right_col,
      VStretch()
    ),
    HStretch()
  )
end

#cpu_frameObject (protected)


121
122
123
124
125
126
# File 'src/lib/installation/dialogs/security.rb', line 121

def cpu_frame
  frame(
    _("CPU"),
    ::Bootloader::CpuMitigationsWidget.new
  )
end

#disable_buttonsObject


83
84
85
# File 'src/lib/installation/dialogs/security.rb', line 83

def disable_buttons
  [:abort]
end

#firewall_frameObject (protected)


107
108
109
110
111
112
# File 'src/lib/installation/dialogs/security.rb', line 107

def firewall_frame
  frame(
    _("Firewall and SSH service"),
    Y2Firewall::Widgets::FirewallSSHProposal.new(@settings)
  )
end

#frame(label, widget) ⇒ Object (protected)


135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# File 'src/lib/installation/dialogs/security.rb', line 135

def frame(label, widget)
  Left(
    Frame(
      label,
      MarginBox(
        0.5,
        0.5,
        HBox(
          widget,
          HStretch()
        )
      )
    )
  )
end

#hostnameString (protected)

Hostname of the current system.

Getting the hostname is sometimes a little bit slow, so the value is cached to be reused in every dialog redraw

Returns:

  • (String)

95
96
97
# File 'src/lib/installation/dialogs/security.rb', line 95

def hostname
  @hostname ||= Yast::Hostname.CurrentHostname
end

#lsm_configurable?Boolean (protected)

Returns:

  • (Boolean)

103
104
105
# File 'src/lib/installation/dialogs/security.rb', line 103

def lsm_configurable?
  @settings.lsm_config.configurable?
end

#lsm_frameObject (protected)


128
129
130
131
132
133
# File 'src/lib/installation/dialogs/security.rb', line 128

def lsm_frame
  frame(
    _("Major Linux Security Module"),
    Widgets::LSM.new(@settings)
  )
end

#next_buttonObject


79
80
81
# File 'src/lib/installation/dialogs/security.rb', line 79

def next_button
  Yast::Mode.installation ? Yast::Label.OKButton : Yast::Label.FinishButton
end

#polkit_frameObject (protected)


114
115
116
117
118
119
# File 'src/lib/installation/dialogs/security.rb', line 114

def polkit_frame
  frame(
    _("PolicyKit"),
    Widgets::PolkitDefaultPriv.new(@settings)
  )
end

#should_open_dialog?Boolean (protected)

Returns:

  • (Boolean)

99
100
101
# File 'src/lib/installation/dialogs/security.rb', line 99

def should_open_dialog?
  true
end

#titleObject


39
40
41
# File 'src/lib/installation/dialogs/security.rb', line 39

def title
  _("Security Configuration")
end