warding 0.2.0 → 0.2.1
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 +4 -4
- data/lib/warding.rb +102 -90
- data/lib/warding/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1336ed9c9428a9d4a863bcff8d1f9e5d9f5c10aac9470b613b77ef1bb582c766
|
4
|
+
data.tar.gz: 10b78d4ceeb9c41b8241b8273b84150baa9c991319f4397ccb1df784d554ac3d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9f73200e9ea088e7f1dc5a3b47e84b0b84ed6d6bb4008a16b4cbd48398c59f0262233f4923e42beb97ff0e6f5f0152dfecae9bdd498fbe89d1bfc3663eeda2a
|
7
|
+
data.tar.gz: 2814c6eae1c1f05fab93853b2e39e8bf7c41888bc28759955d13eec06e9536dc75955c17702ba50a52b341a8ea1ebf298a03c4d66c9e77f37d152f7b51e6ca68
|
data/lib/warding.rb
CHANGED
@@ -89,133 +89,145 @@ module Warding
|
|
89
89
|
def install(data)
|
90
90
|
if @@prompt.yes?('Confirm settings and continue?')
|
91
91
|
|
92
|
-
|
92
|
+
@@prompt.say("Installing, please wait...")
|
93
93
|
|
94
|
-
|
94
|
+
def setup_mirrors
|
95
95
|
`reflector --latest 25 --sort rate --save /etc/pacman.d/mirrorlist`
|
96
96
|
end
|
97
97
|
|
98
|
-
|
98
|
+
setup_mirrors if data[:update_mirrors]
|
99
99
|
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
100
|
+
def setup_timezone(timezone)
|
101
|
+
`timedatectl set-ntp true`
|
102
|
+
if timezone
|
103
|
+
`timedatectl set-timezone #{timezone}`
|
104
|
+
else
|
105
|
+
`timedatectl set-timezone "$(curl --fail https://ipapi.co/timezone)"`
|
106
|
+
end
|
106
107
|
end
|
107
108
|
|
108
|
-
|
109
|
-
|
110
|
-
`parted -s -a optimal /dev/sda \
|
111
|
-
mklabel gpt \
|
112
|
-
mkpart primary fat32 0% #{data[:system_settings][:boot_size]}Mib \
|
113
|
-
set 1 esp on \
|
114
|
-
mkpart primary ext4 #{data[:system_settings][:boot_size]}Mib 100% \
|
115
|
-
set 2 lvm on
|
116
|
-
`
|
117
|
-
|
118
|
-
`pvcreate /dev/sda2`
|
119
|
-
`vgcreate vg0 /dev/sda2`
|
120
|
-
`lvcreate -L #{data[:system_settings][:swap_size]}Mib vg0 -n swap`
|
121
|
-
`lvcreate -L #{data[:system_settings[:home_size]]}Mib vg0 -n home` if data[:system_settings][:partition] == '/boot, /root and /home'
|
122
|
-
`lvcreate -l 100%FREE vg0 -n root`
|
109
|
+
data[:update_timezone] ? setup_timezone(data[:update_timezone]) : setup_timezone
|
123
110
|
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
111
|
+
def setup_partitions(boot_size)
|
112
|
+
`parted -s -a optimal /dev/sda \
|
113
|
+
mklabel gpt \
|
114
|
+
mkpart primary fat32 0% #{boot_size}Mib \
|
115
|
+
set 1 esp on \
|
116
|
+
mkpart primary ext4 #{boot_size}Mib 100% \
|
117
|
+
set 2 lvm on
|
118
|
+
`
|
130
119
|
end
|
131
120
|
|
132
|
-
|
133
|
-
`mkdir /mnt/boot`
|
134
|
-
|
135
|
-
`mkswap /dev/vg0/swap`
|
136
|
-
`swapon /dev/vg0/swap`
|
137
|
-
|
138
|
-
# setup encryption
|
139
|
-
|
140
|
-
# TODO: everything
|
141
|
-
|
142
|
-
# setup base packages
|
143
|
-
|
144
|
-
`pacman -Sy`
|
145
|
-
`pacstrap /mnt base base-devel`
|
146
|
-
`genfstab -U /mnt >> /mnt/etc/fstab`
|
147
|
-
|
148
|
-
# setup chroot
|
149
|
-
|
150
|
-
`arch-chroot /mnt ln -sf /usr/share/zoneinfo/"$(curl --fail https://ipapi.co/timezone)" /etc/localtime`
|
151
|
-
`arch-chroot /mnt hwclock --systohc`
|
152
|
-
|
153
|
-
`echo "#{data[:system_language]}.UTF-8" > /mnt/etc/locale.gen`
|
154
|
-
`arch-chroot /mnt locale-gen`
|
155
|
-
`echo "LANG=#{data[:system_language]}.UTF-8" > /mnt/etc/locale.conf`
|
121
|
+
setup_partitions(data[:system_settings][:boot_size])
|
156
122
|
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
`arch-chroot /mnt echo -e "#{data[:root_password]}\n#{data[:root_password]}" | passwd`
|
166
|
-
|
167
|
-
`arch-chroot /mnt pacman -Sy archlinux-keyring linux lvm2 mkinitcpio --noconfirm`
|
123
|
+
def setup_lvm(scheme, swap_size, home_size=false)
|
124
|
+
`pvcreate /dev/sda2`
|
125
|
+
`vgcreate vg0 /dev/sda2`
|
126
|
+
`lvcreate -L #{swap_size}Mib vg0 -n swap`
|
127
|
+
if scheme == '/boot, /root and /home'
|
128
|
+
`lvcreate -L #{home_size}Mib vg0 -n home`
|
129
|
+
end
|
130
|
+
`lvcreate -l 100%FREE vg0 -n root`
|
168
131
|
|
169
|
-
|
132
|
+
`mkfs.ext4 /dev/vg0/root`
|
133
|
+
`mount /dev/vg0/root /mnt`
|
170
134
|
|
171
|
-
|
135
|
+
if scheme == '/boot, /root and /home'
|
136
|
+
`mkfs.ext4 /dev/vg0/home`
|
137
|
+
`mount /dev/vg0/home /mnt/home`
|
138
|
+
end
|
172
139
|
|
173
|
-
|
140
|
+
`mkfs.fat -F32 /dev/sda1`
|
141
|
+
`mkdir /mnt/boot`
|
142
|
+
`mount /dev/sda1 /mnt/boot`
|
174
143
|
|
175
|
-
|
144
|
+
`mkswap /dev/vg0/swap`
|
145
|
+
`swapon /dev/vg0/swap`
|
146
|
+
end
|
176
147
|
|
177
|
-
if data[:system_settings][:
|
178
|
-
|
179
|
-
`echo "title Warding Linux
|
180
|
-
linux /vmlinuz-linux
|
181
|
-
initrd /intel-ucode.img
|
182
|
-
initrd /initramfs-linux.img
|
183
|
-
options root=/dev/vg0/root rw" > /mnt/boot/loader/entries/warding.conf`
|
148
|
+
if data[:system_settings][:partition] == '/boot, /root and /home'
|
149
|
+
setup_lvm(data[:system_settings][:partition], data[:system_settings][:swap_size], data[:system_settings[:home_size]])
|
184
150
|
else
|
185
|
-
|
151
|
+
setup_lvm(data[:system_settings][:partition], data[:system_settings][:swap_size])
|
186
152
|
end
|
187
153
|
|
188
|
-
# setup
|
154
|
+
# setup encryption
|
155
|
+
# TODO: everything
|
156
|
+
|
157
|
+
def setup_packages
|
158
|
+
`pacman -Sy`
|
159
|
+
`pacstrap /mnt base base-devel`
|
160
|
+
`genfstab -U /mnt >> /mnt/etc/fstab`
|
161
|
+
end
|
189
162
|
|
190
|
-
|
191
|
-
|
163
|
+
def setup_chroot(lang, keymap, password)
|
164
|
+
`arch-chroot /mnt ln -sf /usr/share/zoneinfo/"$(curl --fail https://ipapi.co/timezone)" /etc/localtime`
|
165
|
+
`arch-chroot /mnt hwclock --systohc`
|
166
|
+
|
167
|
+
`echo "#{lang}.UTF-8" > /mnt/etc/locale.gen`
|
168
|
+
`arch-chroot /mnt locale-gen`
|
169
|
+
`echo "LANG=#{lang}.UTF-8" > /mnt/etc/locale.conf`
|
170
|
+
`echo KEYMAP=#{keymap} > /mnt/etc/vconsole.conf`
|
171
|
+
`echo "warding" > /mnt/etc/hostname`
|
172
|
+
`echo "127.0.0.1 localhost
|
173
|
+
::1 localhost
|
174
|
+
127.0.1.1 warding.localdomain warding" > /mnt/etc/hosts`
|
175
|
+
|
176
|
+
`arch-chroot /mnt echo -e "#{password}\n#{password}" | passwd`
|
177
|
+
|
178
|
+
`arch-chroot /mnt pacman -Sy linux lvm2 mkinitcpio --noconfirm`
|
179
|
+
`sed -i "/^HOOK/s/filesystems/lvm2 filesystems/" /mnt/etc/mkinitcpio.conf`
|
180
|
+
`arch-chroot /mnt mkinitcpio -p linux`
|
181
|
+
`arch-chroot /mnt pacman -S intel-ucode --noconfirm`
|
182
|
+
end
|
192
183
|
|
193
|
-
|
194
|
-
|
184
|
+
setup_chroot(data[:system_language], data[:keyboard_keymap], data[:root_password])
|
185
|
+
|
186
|
+
def setup_bootloader(loader)
|
187
|
+
if loader == 'systemd-boot'
|
188
|
+
`arch-chroot /mnt bootctl install`
|
189
|
+
`echo "title Warding Linux
|
190
|
+
linux /vmlinuz-linux
|
191
|
+
initrd /intel-ucode.img
|
192
|
+
initrd /initramfs-linux.img
|
193
|
+
options root=/dev/vg0/root rw" > /mnt/boot/loader/entries/warding.conf`
|
194
|
+
else
|
195
|
+
# TODO: grub
|
196
|
+
end
|
197
|
+
end
|
195
198
|
|
196
|
-
|
199
|
+
setup_bootloader(data[:system_settings][:bootloader])
|
197
200
|
|
198
|
-
|
201
|
+
def setup_usability
|
202
|
+
# TODO: include gnome desktop
|
203
|
+
`arch-chroot /mnt pacman -S nano fuse wget cmake openbsd-netcat dhcpcd samba openssh openvpn unzip vim xorg-server xf86-video-intel plasma konsole dolphin kmix sddm wget git kvantum-qt5 zsh --noconfirm`
|
204
|
+
`arch-chroot /mnt systemctl enable dhcpcd`
|
205
|
+
`arch-chroot /mnt systemctl enable sddm`
|
206
|
+
`arch-chroot /mnt wget -qO- https://blackarch.org/strap.sh | sh`
|
207
|
+
`arch-chroot /mnt wget -qO- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh | sh`
|
208
|
+
end
|
199
209
|
|
200
|
-
|
210
|
+
setup_usability
|
201
211
|
|
202
|
-
|
212
|
+
def setup_visuals
|
203
213
|
`arch-chroot /mnt wget -qO- https://raw.githubusercontent.com/PapirusDevelopmentTeam/arc-kde/master/install.sh | sh`
|
204
214
|
`arch-chroot /mnt wget -qO- https://git.io/papirus-icon-theme-install | sh`
|
205
215
|
end
|
206
216
|
|
207
|
-
|
217
|
+
setup_visuals if data[:extra_settings].include?('themes')
|
208
218
|
|
209
|
-
|
219
|
+
def setup_extras
|
210
220
|
`arch-chroot /mnt pacman -S nmap impacket go ruby php firefox atom hashcat john jre-openjdk proxychains-ng exploitdb httpie metasploit bind-tools radare2 sqlmap wpscan xclip --noconfirm`
|
211
221
|
`arch-chroot /mnt mkdir -p /usr/share/wordlists`
|
212
222
|
`arch-chroot /mnt wget -q https://github.com/danielmiessler/SecLists/raw/master/Passwords/Leaked-Databases/rockyou.txt.tar.gz -O /usr/share/wordlists/rockyou.txt.tar.gz`
|
213
223
|
`arch-chroot /mnt wget -q https://github.com/danielmiessler/SecLists/raw/master/Discovery/Web-Content/common.txt -O /usr/share/wordlists/common.txt`
|
214
224
|
end
|
215
225
|
|
216
|
-
|
226
|
+
setup_extras if data[:extra_settings].include?('tools')
|
217
227
|
|
218
|
-
|
228
|
+
def setup_cron
|
229
|
+
# TODO: include crons
|
230
|
+
end
|
219
231
|
end
|
220
232
|
end
|
221
233
|
end
|
data/lib/warding/version.rb
CHANGED