<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://bradnor.ddns.net/bradnorwiki/index.php?action=history&amp;feed=atom&amp;title=Hardening_security</id>
	<title>Hardening security - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://bradnor.ddns.net/bradnorwiki/index.php?action=history&amp;feed=atom&amp;title=Hardening_security"/>
	<link rel="alternate" type="text/html" href="https://bradnor.ddns.net/bradnorwiki/index.php?title=Hardening_security&amp;action=history"/>
	<updated>2026-04-05T18:00:13Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://bradnor.ddns.net/bradnorwiki/index.php?title=Hardening_security&amp;diff=2617&amp;oldid=prev</id>
		<title>Ch at 12:15, 17 May 2021</title>
		<link rel="alternate" type="text/html" href="https://bradnor.ddns.net/bradnorwiki/index.php?title=Hardening_security&amp;diff=2617&amp;oldid=prev"/>
		<updated>2021-05-17T12:15:01Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[Basic_Install|&amp;amp;lArr; Basic Install]]&lt;br /&gt;
&lt;br /&gt;
==Disabling root and pi accounts==&lt;br /&gt;
;We need to change passwords and/or disable root and pi usernames.&lt;br /&gt;
&lt;br /&gt;
::First create our own account (logged in as pi)&lt;br /&gt;
:::&amp;lt;tt&amp;gt;sudo /usr/sbin/useradd --groups sudo --shell /bin/bash -m &amp;lt;myusername&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
:::&amp;lt;tt&amp;gt;sudo passwd &amp;lt;myusername&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Login as the new username and change root and pi passwords&lt;br /&gt;
&lt;br /&gt;
::&amp;lt;tt&amp;gt;sudo passwd root&amp;lt;/tt&amp;gt;&lt;br /&gt;
::&amp;lt;tt&amp;gt;sudo passwd pi&amp;lt;/tt&amp;gt;&lt;br /&gt;
::&amp;lt;tt&amp;gt;sudo passwd --lock p&amp;lt;/tt&amp;gt;i&lt;br /&gt;
&lt;br /&gt;
==Securing ssh==&lt;br /&gt;
;Create a key on the host you are attaching from (if not already done so)&lt;br /&gt;
&lt;br /&gt;
::&amp;lt;tt&amp;gt;ssh-keygen -t rsa&amp;lt;/tt&amp;gt;&lt;br /&gt;
:::providing a keyphrase&lt;br /&gt;
::Copy the created key (in ~/.ssh) to the raspberrypi&lt;br /&gt;
:::&amp;lt;tt&amp;gt;ssh-copy-id -i ~/.ssh/id_rsa.pub &amp;lt;remote_user&amp;gt;@&amp;lt;remote_host&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
::Add host key to known hosts  - (this removes existing entry (if any) and allows new host key to be added to the ~.ssh/known_hosts file at next ssh login&lt;br /&gt;
:::&amp;lt;tt&amp;gt;ssh-keygen –R &amp;lt;remote_host&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
::login to host with ssh&lt;br /&gt;
&lt;br /&gt;
;Disable password authentication for ssh&lt;br /&gt;
&lt;br /&gt;
::Edit the ssh config file&lt;br /&gt;
:::&amp;lt;tt&amp;gt;sudo emacs /etc/ssh/sshd_config&amp;lt;/tt&amp;gt;&lt;br /&gt;
::::and set&lt;br /&gt;
:::::PasswordAuthentication no&lt;br /&gt;
:::::PermitRootLogin no&lt;br /&gt;
:::::UsePAM no&lt;br /&gt;
&lt;br /&gt;
;Load new ssh configuration and restart&lt;br /&gt;
::&amp;lt;tt&amp;gt;sudo service /etc/init.d/ssh reload&amp;lt;/tt&amp;gt;&lt;br /&gt;
::&amp;lt;tt&amp;gt;sudo service ssh restart&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Enabling Firewall==&lt;br /&gt;
;for older Raspbian&lt;br /&gt;
::Install iptables&lt;br /&gt;
:::&amp;lt;tt&amp;gt;sudo apt-get install iptables iptables-persistent&amp;lt;/tt&amp;gt;&lt;br /&gt;
:check iptables&lt;br /&gt;
::&amp;lt;tt&amp;gt;sudo /sbin/iptables -L&amp;lt;/tt&amp;gt;&lt;br /&gt;
;for Buster&lt;br /&gt;
:use nftables&lt;br /&gt;
&lt;br /&gt;
==Securing wpa_supplicant==&lt;br /&gt;
;encrypt the wifi access password in wpa_supplicant&lt;br /&gt;
:encrypt the section for wpa_supplicant which contains the wifi password, by running&lt;br /&gt;
::&amp;lt;tt&amp;gt;wpa_passphrase &amp;#039;&amp;#039;&amp;lt;YOUR_SSID&amp;gt; &amp;lt;YOUR_PASSWORD&amp;gt;&amp;#039;&amp;#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
:cut and paste the output into the file&lt;br /&gt;
::&amp;lt;tt&amp;gt;/etc/wpa_supplicant/wpa_supplicant.conf&amp;lt;/tt&amp;gt;&lt;br /&gt;
:removing the existing &amp;lt;tt&amp;gt;network={&amp;lt;/tt&amp;gt; section and removing the commented out line line &amp;lt;tt&amp;gt;#psk=&amp;lt;/tt&amp;gt; that has the unencrypted password&lt;br /&gt;
::&lt;/div&gt;</summary>
		<author><name>Ch</name></author>
	</entry>
</feed>