Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
White Rabbit Switch - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
84
Issues
84
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
White Rabbit Switch - Software
Commits
1d385f03
Commit
1d385f03
authored
Jul 09, 2015
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dot-config: support setting root password
Signed-off-by:
Alessandro Rubini
<
rubini@gnudd.com
>
parent
2175c42a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
0 deletions
+43
-0
Kconfig
Kconfig
+31
-0
apply_dot-config
userspace/rootfs_override/wr/bin/apply_dot-config
+12
-0
No files found.
Kconfig
View file @
1d385f03
...
...
@@ -98,6 +98,37 @@ config ETH0_GATEWAY
endmenu
menu "Root Password"
config ROOT_PWD_IS_ENCRYPTED
bool "Should this file include an encripted root password?"
help
The root password, as set here, can be in clear text or
encrypted. If it is specified as clear text, it is encrypted and
stored in the switch at run time. If it specified in pre-encrypted
form, the string will just be copied in place. A clear-text
password in dot-config is less safe against sniffers.
config ROOT_PWD_CLEAR
string "The password to be used at run time"
depends on !ROOT_PWD_IS_ENCRYPTED
default ""
help
The string to be encrypted at boot time by the switch itself,
to later use normal ssh authentication. The empty string is
allowed.
config ROOT_PWD_CYPHER
string "The password to be used at run time"
depends on ROOT_PWD_IS_ENCRYPTED
help
The actual pre-encrypted string. This is stored at run time
into /etc/passwd, for ssh authenticazion. To create the
string, please run "mkpasswd --method=md5 <password>"
endmenu
config NTP_SERVER
string "IP address of local NTP server (empty for none)"
help
...
...
userspace/rootfs_override/wr/bin/apply_dot-config
View file @
1d385f03
...
...
@@ -42,6 +42,18 @@ fi
##### Actual configuration actions start here.
# Root password
passwd
=
""
if
[
!
-z
"
$CONFIG_ROOT_PWD_CLEAR
"
]
;
then
passwd
=
$(
mkpasswd
--method
=
md5
"
$CONFIG_ROOT_PWD_CLEAR
"
)
fi
if
[
!
-z
"
$CONFIG_ROOT_PWD_CYPHER
"
]
;
then
passwd
=
"
$CONFIG_ROOT_PWD_CYPHER
"
fi
if
[
!
-z
"
$passwd
"
]
;
then
sed
-i
"s,^root:[^:]*:,root:
$passwd
:,"
/etc/shadow
fi
# A non-existent wr_date.conf means no NTP. So "rm" if unconfigured
if
[
!
-z
"
$CONFIG_NTP_SERVER
"
]
;
then
echo
"ntpserver
$CONFIG_NTP_SERVER
"
>
$T
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment