warding 0.2.7 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 80f1a448f9e2dca165d0ae31d4d745b2bd6641a768d2455d64086bb04132a098
4
- data.tar.gz: d6afdd80c3497c2a6fd39dda60ebdcedb63d02483116c8ee68b0861f079f93a1
3
+ metadata.gz: 2704ce5e2fe31c212a948bd68397c3ad1754dccaff6b57dc401f6a7415027569
4
+ data.tar.gz: 3b53d34edb304a1f9a9007836d3aedac4ba3f3ca5d170353190bf390c5b77194
5
5
  SHA512:
6
- metadata.gz: 3baef4c001d534fc9dcb595fb10b4b222121e2a161980c153856bee1365db895055b29b644f14739bba69b59535b9cf84359c7c3df69f52be676f8648916b10f
7
- data.tar.gz: 5acd8f21a504566276ad9e54a6407307bca3ea3b9e16f7d2001dadc8f80b60f62615f7fc4fac49f77caec34c6f1cf9c8563d13c80b1d0caed57e8f7301f7f22c
6
+ metadata.gz: eb4214f53c1faee924ca4c08d43d986514eaad8005d69f3bedc6af2114120dfa7ecbb08928793843c27cbe2b11923ebf467a59f96b2dcb94b54c8eb06b386ce9
7
+ data.tar.gz: 3f042c791e275d4f6c851c1a625e8d253eafeb7a70fa6d2f0d7ccd225bd994472ae0c1dc4492115a4fa9066d2934281a8760a5035a5284ddff7d4d64f065d78e
@@ -23,13 +23,3 @@ jobs:
23
23
  env:
24
24
  GEM_HOST_API_KEY: "Bearer ${{secrets.GITHUB_TOKEN}}"
25
25
  OWNER: ${{ github.repository_owner }}
26
- - name: Publish to RubyGems
27
- run: |
28
- mkdir -p $HOME/.gem
29
- touch $HOME/.gem/credentials
30
- chmod 0600 $HOME/.gem/credentials
31
- printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
32
- gem build *.gemspec
33
- gem push *.gem
34
- env:
35
- GEM_HOST_API_KEY: "Bearer ${{secrets.RUBYGEMS_AUTH_TOKEN}}"
data/README.md CHANGED
@@ -10,24 +10,27 @@ Install warding by using the `gem install` command.
10
10
  gem install warding
11
11
  ```
12
12
 
13
+ Or use the quick install method:
14
+
15
+ ```bash
16
+ wget -qO- https://raw.githubusercontent.com/marlospomin/warding/master/debug/quick-install.sh | sh
17
+ ```
18
+
13
19
  ## Usage
14
20
 
15
21
  1. Download Arch Linux.
16
- 2. Boot from the live ISO.
17
- 3. Install warding (Ruby may also be required).
22
+ 2. Boot the live ISO.
23
+ 3. Install warding either from source or with the gem command.
18
24
  4. Run the binary executable `warding` and fill in the prompts.
19
25
  5. Enjoy.
20
26
 
21
- ## Tasklist
27
+ ## Debug
22
28
 
23
- * Add sddm and gdm extra confs.
24
- * Refactor.
25
- * Suppress outputs.
26
- * Add AUR support.
27
- * Code missing features.
28
- * Add extra checks.
29
- * Add GitHub actions.
30
- * Publish gem/package on GitHub.
29
+ To install the latest version (debug) of warding follow the steps below:
30
+
31
+ ```bash
32
+ wget -qO- https://raw.githubusercontent.com/marlospomin/warding/master/debug/debug.sh | sh
33
+ ```
31
34
 
32
35
  ## Contributing
33
36
 
data/bin/warding CHANGED
@@ -12,4 +12,8 @@ warding.check
12
12
  # gather inputs from the user
13
13
  user_input = warding.gather
14
14
  # install warding
15
- warding.install(user_input)
15
+ if user_input[:system_settings][:encrypted]
16
+ warding.install(user_input, true)
17
+ else
18
+ warding.install(user_input)
19
+ end
data/debug/debug.sh ADDED
@@ -0,0 +1,11 @@
1
+ #!/bin/bash
2
+
3
+ pacman -S git ruby glibc libxcrypt --noconfirm
4
+ git clone https://github.com/marlospomin/warding
5
+ cd warding
6
+ pacman -R man-pages --noconfirm
7
+ gem install bundle rake
8
+ export PATH="`ruby -e 'puts Gem.user_dir'`/bin:$PATH"
9
+ bundle
10
+ rake install
11
+ warding
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+
3
+ pacman -R man-pages --noconfirm
4
+ pacman -Syy ruby glibc libxcrypt --noconfirm
5
+ gem install warding
6
+ export PATH="`ruby -e 'puts Gem.user_dir'`/bin:$PATH"
7
+ warding
data/lib/warding.rb CHANGED
@@ -1,288 +1,270 @@
1
- # frozen_string_literal: true
2
-
3
- require "warding/version"
4
- require "tty-prompt"
5
-
6
- module Warding
7
- class Error < StandardError; end
8
-
9
- class Installer
10
- @@prompt = TTY::Prompt.new
11
-
12
- def banner
13
- puts <<~'EOF'
14
-
15
- ( ( (
16
- )\))( ' ) ( )\ ) ( ( (
17
- ((_)()\ ) ( /( )( (()/( )\ ( )\))(
18
- _(())\_)() )(_)) (()\ ((_)) ((_) )\ ) ((_))\
19
- \ \((_)/ /((_)_ ((_) _| | (_) _(_/( (()(_)
20
- \ \/\/ / / _` | | '_| / _` | | | | ' \)) / _` |
21
- \_/\_/ \__,_| |_| \__,_| |_| |_||_| \__, |
22
- |___/
23
-
24
- EOF
25
- end
26
-
27
- def check
28
- unless `uname -a`.include?("archiso")
29
- @@prompt.error("Exiting...")
30
- @@prompt.warn("Warding can only be installed from within the live ISO context!")
31
- exit!
32
- end
33
-
34
- unless `[ -d /sys/firmware/efi ] && echo true`.include?("true")
35
- @@prompt.error("UEFI/EFI must be enabled to install warding")
36
- exit!
37
- end
38
- end
39
-
40
- def gather
41
- locales_list = %w[en_US es_ES pt_BR ru_RU fr_FR it_IT de_DE ja_JP ko_KR zh_CN]
42
- keymaps_list = %w[us uk br en fr de zh ru it es]
43
-
44
- parsed_input = @@prompt.collect do
45
- key(:update_mirrors).yes?("Update mirrorlist?")
46
- key(:system_language).select("Pick the desired system language:", locales_list)
47
- key(:keyboard_keymap).select("Pick your keyboard layout:", keymaps_list)
48
-
49
- unless @@prompt.yes?("Set timezone automatically?", default: true)
50
- key(:update_timezone).ask("Enter timezone:", required: true)
51
- end
52
-
53
- key(:root_password).mask("Insert new root password:", required: true)
54
-
55
- key(:system_settings) do
56
- bootloader = key(:bootloader).select("Which bootloader to use?", %w[systemd-boot grub])
57
- partitions = key(:partitions).select(
58
- "Select partition scheme to use:", ["/boot and /root", "/boot, /root and /home"]
59
- )
60
-
61
- key(:boot_size).slider("Boot drive partition size (MiB):", min: 512, max: 4096, default: 1024, step: 128)
62
-
63
- if partitions == "/boot, /root and /home"
64
- key(:home_size).slider("Home partition size (MiB):", min: 2048, max: 8192, default: 4096, step: 256)
65
- end
66
-
67
- key(:swap_size).slider("Swap partition size (MiB):", min: 1024, max: 8192, default: 2048, step: 256)
68
-
69
- if @@prompt.yes?("Enable encryption?", default: false)
70
- key(:encryption_settings) do
71
- key(:encryption_mode).expand("Which cryptic setup to use?") do |q|
72
- if partitions == "/boot, /root and /home"
73
- q.choice key: "m", name: "minimal (/home only)" do :minimal end
74
- q.choice key: "s", name: "safe (/home, /var, /tmp and swap)", value: :safe
75
- end
76
- q.choice key: "p", name: "paranoid (full disk encryption, except /boot)", value: :paranoid
77
- q.choice key: "i", name: "insane (full disk encryption)", value: :insane if bootloader == "grub"
78
- end
79
- key(:encryption_key).mask("Insert the encryption key:", required: true)
80
- end
81
- end
82
- end
83
-
84
- key(:desktop_environment).select("Select your desktop environment:", %w[plasma gnome none])
85
- end
86
-
87
- parsed_input
88
- end
89
-
90
- def install(data)
91
- if @@prompt.yes?("Confirm settings and continue?")
92
-
93
- @@prompt.say("Installing, please wait...")
94
-
95
- def setup_mirrors
96
- # update mirrorlist
97
- `reflector --latest 25 --sort rate --save /etc/pacman.d/mirrorlist`
98
- end
99
-
100
- setup_mirrors if data[:update_mirrors]
101
-
102
- def setup_timezone(timezone = false)
103
- # set clock
104
- `timedatectl set-ntp true`
105
- # set timezone
106
- if timezone
107
- `timedatectl set-timezone #{timezone}`
108
- else
109
- `timedatectl set-timezone "$(curl -s https://ipapi.co/timezone)"`
110
- end
111
- end
112
-
113
- data[:update_timezone] ? setup_timezone(data[:update_timezone]) : setup_timezone
114
-
115
- def setup_partitions(boot_size)
116
- # create partitions
117
- `parted -s -a optimal /dev/sda \
118
- mklabel gpt \
119
- mkpart primary fat32 0% #{boot_size}Mib \
120
- set 1 esp on \
121
- mkpart primary ext4 #{boot_size}Mib 100% \
122
- set 2 lvm on
123
- `
124
- end
125
-
126
- setup_partitions(data[:system_settings][:boot_size])
127
-
128
- def setup_lvm(scheme, swap_size, home_size = false)
129
- # create physical volume
130
- `pvcreate /dev/sda2`
131
- # create virtual group
132
- `vgcreate vg0 /dev/sda2`
133
- # create logical volumes
134
- `lvcreate -L #{swap_size}Mib vg0 -n swap`
135
- if scheme == "/boot, /root and /home"
136
- `lvcreate -L #{home_size}Mib vg0 -n home`
137
- end
138
- `lvcreate -l 100%FREE vg0 -n root`
139
- # make and mount root fs
140
- `mkfs.ext4 /dev/vg0/root`
141
- `mount /dev/vg0/root /mnt`
142
- # make and mount home folder
143
- if scheme == "/boot, /root and /home"
144
- `mkfs.ext4 /dev/vg0/home`
145
- `mount /dev/vg0/home /mnt/home`
146
- end
147
- # make and mount boot partition
148
- `mkfs.fat -F32 /dev/sda1`
149
- `mkdir /mnt/boot`
150
- if data[:system_settings][:bootloader] == "systemd-boot"
151
- `mount /dev/sda1 /mnt/boot`
152
- else
153
- `mount /dev/sda1 /mnt/boot/efi`
154
- end
155
- # setup swap
156
- `mkswap /dev/vg0/swap`
157
- `swapon /dev/vg0/swap`
158
- end
159
-
160
- if data[:system_settings][:partition] == "/boot, /root and /home"
161
- setup_lvm(data[:system_settings][:partition], data[:system_settings][:swap_size], data[:system_settings[:home_size]])
162
- else
163
- setup_lvm(data[:system_settings][:partition], data[:system_settings][:swap_size])
164
- end
165
-
166
- def setup_packages
167
- # update packages list
168
- `pacman -Syy`
169
- # install base system
170
- `pacstrap /mnt base base-devel linux linux-firmware lvm2 mkinitcpio dmidecode reflector networkmanager cronie man-db nano vi fuse wget openbsd-netcat dhcpcd samba openssh openvpn unzip vim git zsh`
171
- # generate fstab
172
- `genfstab -U /mnt >> /mnt/etc/fstab`
173
- end
174
-
175
- setup_packages
176
-
177
- def setup_chroot(lang, keymap, password)
178
- # set timezone
179
- `arch-chroot /mnt ln -sf /usr/share/zoneinfo/"$(curl -s https://ipapi.co/timezone)" /etc/localtime`
180
- # update clock
181
- `arch-chroot /mnt hwclock --systohc`
182
- # set locale
183
- `echo "#{lang}.UTF-8 UTF-8" > /mnt/etc/locale.gen`
184
- `arch-chroot /mnt locale-gen`
185
- `echo "LANG=#{lang}.UTF-8" > /mnt/etc/locale.conf`
186
- # set keymap
187
- `echo "KEYMAP=#{keymap}" > /mnt/etc/vconsole.conf`
188
- # update hostname
189
- `echo "warding" > /mnt/etc/hostname`
190
- # update hosts
191
- `echo "127.0.0.1 localhost\n::1 localhost\n127.0.1.1 warding.localdomain warding" > /mnt/etc/hosts`
192
- # update root password
193
- `echo -e "#{password}\n#{password}" | arch-chroot /mnt passwd`
194
- # update hooks
195
- `sed -i "/^HOOK/s/filesystems/lvm2 filesystems/" /mnt/etc/mkinitcpio.conf`
196
- # recompile initramfs
197
- `arch-chroot /mnt mkinitcpio -p linux`
198
- # add intel microcode
199
- `arch-chroot /mnt pacman -S intel-ucode --noconfirm`
200
- end
201
-
202
- setup_chroot(data[:system_language], data[:keyboard_keymap], data[:root_password])
203
-
204
- def setup_bootloader(loader)
205
- # setup systemd-boot
206
- if loader == "systemd-boot"
207
- `arch-chroot /mnt bootctl install`
208
- `echo "title Warding Linux
209
- linux /vmlinuz-linux
210
- initrd /intel-ucode.img
211
- initrd /initramfs-linux.img
212
- options root=/dev/vg0/root rw" > /mnt/boot/loader/entries/warding.conf`
213
- else
214
- # setup grub
215
- `arch-chroot /mnt pacman -S grub efibootmgr --noconfirm`
216
- `arch-chroot /mnt grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB`
217
- `arch-chroot /mnt grub-mkconfig -o /boot/grub/grub.cfg`
218
- end
219
- end
220
-
221
- setup_bootloader(data[:system_settings][:bootloader])
222
-
223
- def setup_usability
224
- # enable internet
225
- `arch-chroot /mnt systemctl enable NetworkManager`
226
- # add cron jobs
227
- `echo "#!/bin/bash\nreflector --latest 25 --sort rate --save /etc/pacman.d/mirrorlist" > /mnt/etc/cron.hourly/mirrorlist; chmod +x /mnt/etc/cron.hourly/mirrorlist`
228
- `echo "#!/bin/bash\npacman -Sy" > /mnt/etc/cron.weekly/pacman-sync; chmod +x /mnt/etc/cron.weekly/pacman-sync`
229
- `echo "#!/bin/bash\npacman -Syu --noconfirm" > /mnt/etc/cron.monthly/system-upgrade; chmod +x /mnt/etc/cron.monthly/system-upgrade`
230
- # enable cron jobs
231
- `arch-chroot /mnt systemctl enable cronie`
232
- # change default shell
233
- `arch-chroot /mnt chsh -s $(which zsh)"`
234
- # setup blackarch's keyring
235
- `wget -q https://blackarch.org/keyring/blackarch-keyring.pkg.tar.xz{,.sig}`
236
- `gpg --keyserver hkp://pgp.mit.edu --recv-keys 4345771566D76038C7FEB43863EC0ADBEA87E4E3 > /dev/null 2>&1`
237
- `gpg --keyserver-options no-auto-key-retrieve --with-fingerprint blackarch-keyring.pkg.tar.xz.sig > /dev/null 2>&1`
238
- `rm blackarch-keyring.pkg.tar.xz.sig`
239
- `pacman-key --init`
240
- `pacman --config /dev/null --noconfirm -U blackarch-keyring.pkg.tar.xz`
241
- `pacman-key --populate`
242
- # update package list
243
- `pacman -Syy`
244
- # check if on VM
245
- if `dmidecode -s system-manufacturer`.include?("VMware, Inc.")
246
- # install and enable VMware utils
247
- `arch-chroot /mnt pacman -S openvpn-vm-tools --noconfirm`
248
- `arch-chroot /mnt systemctl enable vmtoolsd`
249
- end
250
- end
251
-
252
- setup_usability
253
-
254
- def setup_visuals(theme = "none")
255
- if theme == "none"
256
- break
257
- elsif theme == "kde"
258
- # install packages
259
- `arch-chroot /mnt pacman -S xorg-server xf86-video-intel plasma konsole dolphin kmix sddm kvantum-qt5`
260
- # create conf dir
261
- `mkdir -p /mnt/etc/sddm.conf.d`
262
- # fix theme
263
- `echo "[Theme]\nCurrent=breeze" > /mnt/etc/sddm.conf.d/theme.conf`
264
- # enable autologin
265
- `echo "[Autologin]\nUser=root" > /mnt/etc/sddm.conf.d/login.conf`
266
- # enable sddm
267
- `arch-chroot /mnt systemctl enable sddm`
268
- else
269
- # install packages
270
- `arch-chroot /mnt pacman -S xf86-video-intel gnome`
271
- # enable gdm
272
- `arch-chroot /mnt systemctl enable gdm`
273
- end
274
- end
275
-
276
- setup_visuals(data[:desktop_environment])
277
-
278
- def finish
279
- # end
280
- `umount -R /mnt`
281
- `reboot`
282
- end
283
-
284
- finish
285
- end
286
- end
287
- end
288
- end
1
+ # frozen_string_literal: true
2
+
3
+ require "warding/version"
4
+ require "tty-prompt"
5
+
6
+ module Warding
7
+ class Error < StandardError; end
8
+
9
+ class Installer
10
+ @@prompt = TTY::Prompt.new
11
+
12
+ def banner
13
+ puts <<~'EOF'
14
+
15
+ ( ( (
16
+ )\))( ' ) ( )\ ) ( ( (
17
+ ((_)()\ ) ( /( )( (()/( )\ ( )\))(
18
+ _(())\_)() )(_)) (()\ ((_)) ((_) )\ ) ((_))\
19
+ \ \((_)/ /((_)_ ((_) _| | (_) _(_/( (()(_)
20
+ \ \/\/ / / _` | | '_| / _` | | | | ' \)) / _` |
21
+ \_/\_/ \__,_| |_| \__,_| |_| |_||_| \__, |
22
+ |___/
23
+
24
+ EOF
25
+ end
26
+
27
+ def check
28
+ unless `uname -a`.include?("archiso")
29
+ @@prompt.error("Exiting...")
30
+ @@prompt.warn("Warding can only be installed from within the live ISO context!")
31
+ exit!
32
+ end
33
+
34
+ unless `[ -d /sys/firmware/efi ] && echo true`.include?("true")
35
+ @@prompt.error("UEFI/EFI must be enabled to install warding.")
36
+ exit!
37
+ end
38
+ end
39
+
40
+ def gather
41
+ locales_list = %w[en_US es_ES pt_BR ru_RU fr_FR it_IT de_DE ja_JP ko_KR zh_CN]
42
+ keymaps_list = %w[us uk br en fr de zh ru it es]
43
+
44
+ parsed_input = @@prompt.collect do
45
+ key(:update_mirrors).yes?("Update mirrorlist?")
46
+ key(:system_language).select("Pick the desired system language:", locales_list)
47
+ key(:keyboard_keymap).select("Pick your keyboard layout:", keymaps_list)
48
+
49
+ unless @@prompt.yes?("Set timezone automatically?", default: true)
50
+ key(:update_timezone).ask("Enter timezone:", required: true)
51
+ end
52
+
53
+ key(:root_password).mask("Insert new root password:", default: "warding")
54
+
55
+ key(:system_settings) do
56
+ key(:boot_size).slider("Boot drive partition size (MiB):", min: 512, max: 4096, default: 1024, step: 128)
57
+ key(:swap_size).slider("Swap partition size (MiB):", min: 1024, max: 8192, default: 2048, step: 256)
58
+
59
+ if key(:encrypted).yes?("Enable encryption?", default: false)
60
+ key(:encryption_settings) do
61
+ key(:encryption_key).mask("Insert the encryption key:", required: true)
62
+ end
63
+ end
64
+ end
65
+
66
+ key(:desktop_environment).select("Select your desktop environment:", %w[plasma gnome i3 none])
67
+ end
68
+
69
+ parsed_input
70
+ end
71
+
72
+ def install(data, encrypted = false)
73
+ if @@prompt.yes?("Confirm settings and continue?")
74
+
75
+ @@prompt.say("Installing, please wait...")
76
+
77
+ def setup_mirrors
78
+ # update mirrorlist
79
+ `reflector --latest 100 --sort rate --save /etc/pacman.d/mirrorlist`
80
+ end
81
+
82
+ def setup_timezone(timezone = false)
83
+ # set clock
84
+ `timedatectl set-ntp true`
85
+ # set timezone
86
+ if timezone
87
+ `timedatectl set-timezone #{timezone}`
88
+ else
89
+ `timedatectl set-timezone "$(curl -s https://ipapi.co/timezone)"`
90
+ end
91
+ end
92
+
93
+ def setup_partitions(boot_size)
94
+ # create partitions
95
+ `parted -s -a optimal /dev/sda \
96
+ mklabel gpt \
97
+ mkpart primary fat32 0% #{boot_size}Mib \
98
+ set 1 esp on \
99
+ mkpart primary ext4 #{boot_size}Mib 100% \
100
+ set 2 lvm on
101
+ `
102
+ end
103
+
104
+ def setup_lvm(swap_size, key = false)
105
+ # setup encryption
106
+ if key
107
+ # create an encrypted volume
108
+ `echo "#{key}" | cryptsetup -q luksFormat --type luks2 --cipher aes-xts-plain64 --key-size 512 /dev/sda2`
109
+ # open the volume
110
+ `echo "#{key}" | cryptsetup open /dev/sda2 cryptlvm -`
111
+ # setup lvm
112
+ `pvcreate /dev/mapper/cryptlvm`
113
+ # create virtual group
114
+ `vgcreate vg0 /dev/mapper/cryptlvm`
115
+ else
116
+ # create physical volume
117
+ `pvcreate /dev/sda2`
118
+ # create virtual group
119
+ `vgcreate vg0 /dev/sda2`
120
+ end
121
+ # create logical volumes
122
+ `lvcreate -L #{swap_size}Mib vg0 -n swap`
123
+ `lvcreate -l 100%FREE vg0 -n root`
124
+ # make and mount rootfs
125
+ `mkfs.ext4 -q /dev/vg0/root`
126
+ `mount /dev/vg0/root /mnt`
127
+ # make and mount boot partition
128
+ `mkfs.fat -F32 /dev/sda1`
129
+ `mkdir /mnt/boot`
130
+ `mount /dev/sda1 /mnt/boot`
131
+ # setup swap
132
+ `mkswap /dev/vg0/swap`
133
+ `swapon /dev/vg0/swap`
134
+ end
135
+
136
+ def setup_packages
137
+ # update packages list
138
+ `pacman -Syy`
139
+ # install base system
140
+ `pacstrap /mnt base base-devel linux linux-firmware linux-headers lvm2 mkinitcpio dmidecode smbclient reflector networkmanager go cronie man-db nano vi fuse wget openbsd-netcat dhcpcd samba openssh openvpn unzip vim git zsh`
141
+ # generate fstab
142
+ `genfstab -U /mnt >> /mnt/etc/fstab`
143
+ end
144
+
145
+ def setup_chroot(lang, keymap, password = "warding", encrypted = false)
146
+ # set timezone
147
+ `arch-chroot /mnt ln -sf /usr/share/zoneinfo/"$(curl -s https://ipapi.co/timezone)" /etc/localtime`
148
+ # update clock
149
+ `arch-chroot /mnt hwclock --systohc`
150
+ # set locale
151
+ `echo "#{lang}.UTF-8 UTF-8" > /mnt/etc/locale.gen`
152
+ `arch-chroot /mnt locale-gen`
153
+ `echo "LANG=#{lang}.UTF-8" > /mnt/etc/locale.conf`
154
+ # set keymap
155
+ `echo "KEYMAP=#{keymap}" > /mnt/etc/vconsole.conf`
156
+ # update hostname
157
+ `echo "warding" > /mnt/etc/hostname`
158
+ # update hosts
159
+ `echo "127.0.0.1 localhost\n::1 localhost\n127.0.1.1 warding.localdomain warding" > /mnt/etc/hosts`
160
+ # update root password
161
+ `echo -e "#{password}\n#{password}" | arch-chroot /mnt passwd`
162
+ # update hooks
163
+ if encrypted
164
+ `sed -i "/^HOOK/s/modconf/keyboard keymap modconf/" /mnt/etc/mkinitcpio.conf`
165
+ `sed -i "/^HOOK/s/filesystems/encrypt lvm2 filesystems/" /mnt/etc/mkinitcpio.conf`
166
+ else
167
+ `sed -i "/^HOOK/s/filesystems/lvm2 filesystems/" /mnt/etc/mkinitcpio.conf`
168
+ end
169
+ # recompile initramfs
170
+ `arch-chroot /mnt mkinitcpio -P`
171
+ # add intel microcode
172
+ `arch-chroot /mnt pacman -S amd-ucode --noconfirm`
173
+ end
174
+
175
+ def setup_bootloader(encrypted = false)
176
+ # setup systemd-boot
177
+ `arch-chroot /mnt bootctl install`
178
+ `echo "title Warding Linux
179
+ linux /vmlinuz-linux
180
+ initrd /amd-ucode.img
181
+ initrd /initramfs-linux.img" > /mnt/boot/loader/entries/warding.conf`
182
+ if encrypted
183
+ `echo "options cryptdevice=UUID=$(blkid -s UUID -o value /dev/sda2):cryptlvm:allow-discards root=/dev/vg0/root quiet rw" >> /mnt/boot/loader/entries/warding.conf`
184
+ else
185
+ `echo "options root=/dev/vg0/root rw" >> /mnt/boot/loader/entries/warding.conf`
186
+ end
187
+ end
188
+
189
+ def setup_usability
190
+ # enable internet
191
+ `arch-chroot /mnt systemctl -q enable NetworkManager`
192
+ # add cron jobs
193
+ `echo "#!/bin/bash\nreflector --latest 100 --sort rate --save /etc/pacman.d/mirrorlist" > /mnt/etc/cron.weekly/mirrorlist; chmod +x /mnt/etc/cron.weekly/mirrorlist`
194
+ `echo "#!/bin/bash\npacman -Sy" > /mnt/etc/cron.weekly/pacman-sync; chmod +x /mnt/etc/cron.weekly/pacman-sync`
195
+ `echo "#!/bin/bash\npacman -Syu --noconfirm" > /mnt/etc/cron.monthly/system-upgrade; chmod +x /mnt/etc/cron.monthly/system-upgrade`
196
+ # enable cron jobs
197
+ `arch-chroot /mnt systemctl -q enable cronie`
198
+ # change default shell
199
+ `arch-chroot /mnt chsh -s /usr/bin/zsh`
200
+ # setup wordlists
201
+ `arch-chroot /mnt mkdir -p /usr/share/wordlists`
202
+ `arch-chroot /mnt curl -s https://github.com/danielmiessler/SecLists/blob/master/Discovery/Web-Content/raft-large-directories-lowercase.txt -O --output-dir /usr/share/wordlists`
203
+ `arch-chroot /mnt curl -s https://github.com/danielmiessler/SecLists/blob/master/Discovery/Web-Content/common.txt -O --output-dir /usr/share/wordlists`
204
+ `arch-chroot /mnt curl -s https://github.com/danielmiessler/SecLists/raw/master/Passwords/Leaked-Databases/rockyou.txt.tar.gz -O --output-dir /usr/share/wordlists`
205
+ # setup drivers
206
+ `arch-chroot /mnt pacman -S alsa-utils alsa-plugins alsa-lib --noc`
207
+ # update package list
208
+ `arch-chroot /mnt pacman -Syy`
209
+ # user creation --fix
210
+ `arch-chroot /mnt useradd -m -g wheel -s /bin/zsh ward`
211
+ `sed -i '85 s/# %wheel ALL=(ALL) NOPASSWD: ALL/%wheel ALL=(ALL) NOPASSWD: ALL/g' /mnt/etc/sudoers`
212
+ `arch-chroot /mnt sudo -u ward sh -c "cd /home/ward; git clone https://aur.archlinux.org/yay.git; cd yay; makepkg -si --noconfirm"`
213
+ `arch-chroot /mnt sudo -u ward sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended`
214
+ # check if on VM
215
+ if `arch-chroot /mnt dmidecode -s system-manufacturer`.include?("VMware, Inc.")
216
+ # install and enable VMware utils
217
+ `arch-chroot /mnt pacman -S open-vm-tools --noconfirm`
218
+ `arch-chroot /mnt systemctl -q enable vmtoolsd`
219
+ end
220
+ end
221
+
222
+ def setup_visuals(theme)
223
+ case theme
224
+ when "plasma"
225
+ # install packages
226
+ `arch-chroot /mnt pacman -S xorg-server plasma-meta gtkmm konsole sddm kvantum-qt5 --noc -q`
227
+ # create conf dir
228
+ `mkdir -p /mnt/etc/sddm.conf.d`
229
+ # fix theme
230
+ `echo "[Theme]\nCurrent=breeze" > /mnt/etc/sddm.conf.d/theme.conf`
231
+ # enable autologin
232
+ `echo "[Autologin]\nUser=ward\nSession=plasma" > /mnt/etc/sddm.conf.d/autologin.conf`
233
+ # enable sddm
234
+ `arch-chroot /mnt systemctl -q enable sddm`
235
+ when "gnome"
236
+ # install packages
237
+ `arch-chroot /mnt pacman -S gtkmm gnome gnome-tweaks --noc`
238
+ # enable autologin
239
+ `echo "[daemon]\nAutomaticLogin=ward\nAutomaticLoginEnable=True" > /mnt/etc/gdm/custom.conf`
240
+ # enable gdm
241
+ `arch-chroot /mnt systemctl -q enable gdm`
242
+ when "i3"
243
+ # install packages
244
+ `arch-chroot /mnt pacman -S lightdm lightdm-gtk-greeter xorg-server xorg-apps xorg-xinit i3-wm --noc`
245
+ # enable lightdm
246
+ `arch-chroot /mnt systemctl -q enable lightdm`
247
+ else
248
+ nil
249
+ end
250
+ end
251
+
252
+ def finish
253
+ `umount -R /mnt`
254
+ `reboot`
255
+ end
256
+
257
+ setup_mirrors if data[:update_mirrors]
258
+ data[:update_timezone] ? setup_timezone(data[:update_timezone]) : setup_timezone
259
+ setup_partitions(data[:system_settings][:boot_size])
260
+ data[:system_settings][:encrypted] ? setup_lvm(data[:system_settings][:swap_size], data[:system_settings][:encryption_settings][:encryption_key]) : setup_lvm(data[:system_settings][:swap_size])
261
+ setup_packages
262
+ data[:system_settings][:encrypted] ? setup_chroot(data[:system_language], data[:keyboard_keymap], data[:root_password], true) : setup_chroot(data[:system_language], data[:keyboard_keymap], data[:root_password])
263
+ data[:system_settings][:encrypted] ? setup_bootloader(true) : setup_bootloader
264
+ setup_usability
265
+ setup_visuals(data[:desktop_environment])
266
+ finish
267
+ end
268
+ end
269
+ end
270
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Warding
4
- VERSION = "0.2.7"
4
+ VERSION = "2.0.0"
5
5
  end
data/warding.gemspec CHANGED
@@ -1,30 +1,30 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "lib/warding/version"
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = "warding"
7
- spec.version = Warding::VERSION
8
- spec.authors = ["Marlos Pomin"]
9
- spec.email = ["marlospomin@gmail.com"]
10
-
11
- spec.summary = "Warding Linux installer."
12
- spec.description = "Custom Arch Linux installer designed for security assessments and pentesting."
13
- spec.homepage = "https://github.com/marlospomin/warding"
14
- spec.license = "MIT"
15
-
16
- spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
17
-
18
- spec.metadata["homepage_uri"] = spec.homepage
19
- spec.metadata["source_code_uri"] = "https://github.com/marlospomin/warding"
20
- spec.metadata["changelog_uri"] = "https://github.com/marlospomin/warding/releases"
21
-
22
- spec.files = Dir.chdir(File.expand_path(__dir__)) do
23
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
24
- end
25
-
26
- spec.executables = ["warding"]
27
- spec.require_paths = ["lib"]
28
-
29
- spec.add_runtime_dependency "tty-prompt"
30
- end
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/warding/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "warding"
7
+ spec.version = Warding::VERSION
8
+ spec.authors = ["Marlos Pomin"]
9
+ spec.email = ["marlospomin@gmail.com"]
10
+
11
+ spec.summary = "Warding Linux installer."
12
+ spec.description = "Custom Arch Linux installer designed for security assessments and pentesting."
13
+ spec.homepage = "https://github.com/marlospomin/warding"
14
+ spec.license = "MIT"
15
+
16
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
17
+
18
+ spec.metadata["homepage_uri"] = spec.homepage
19
+ spec.metadata["source_code_uri"] = "https://github.com/marlospomin/warding"
20
+ spec.metadata["changelog_uri"] = "https://github.com/marlospomin/warding/releases"
21
+
22
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
23
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
24
+ end
25
+
26
+ spec.executables = ["warding"]
27
+ spec.require_paths = ["lib"]
28
+
29
+ spec.add_runtime_dependency "tty-prompt"
30
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: warding
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marlos Pomin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-28 00:00:00.000000000 Z
11
+ date: 2021-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tty-prompt
@@ -41,6 +41,8 @@ files:
41
41
  - README.md
42
42
  - Rakefile
43
43
  - bin/warding
44
+ - debug/debug.sh
45
+ - debug/quick-install.sh
44
46
  - lib/warding.rb
45
47
  - lib/warding/version.rb
46
48
  - warding.gemspec
@@ -66,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
66
68
  - !ruby/object:Gem::Version
67
69
  version: '0'
68
70
  requirements: []
69
- rubygems_version: 3.0.3
71
+ rubygems_version: 3.1.2
70
72
  signing_key:
71
73
  specification_version: 4
72
74
  summary: Warding Linux installer.