Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
76eb058d
Commit
76eb058d
authored
Jul 13, 2017
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow to run this with args to change the password
parent
5cb149d7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
1 deletion
+14
-1
rc.initial.password
src/etc/rc.initial.password
+14
-1
No files found.
src/etc/rc.initial.password
View file @
76eb058d
...
@@ -31,6 +31,19 @@
...
@@ -31,6 +31,19 @@
require_once
(
'config.inc'
);
require_once
(
'config.inc'
);
require_once
(
'auth.inc'
);
require_once
(
'auth.inc'
);
$password
=
isset
(
$argv
[
1
])
?
$argv
[
1
]
:
''
;
$confirm
=
isset
(
$argv
[
2
])
?
$argv
[
2
]
:
''
;
if
(
!
empty
(
$password
)
&&
$password
===
$confirm
)
{
/* the installer needs this code to change the password */
$admin_user
=
&
getUserEntryByUID
(
0
);
if
(
$admin_user
)
{
local_user_set_password
(
$admin_user
,
$password
);
write_config
(
'Root user reset from console'
);
}
exit
(
0
);
}
$fp
=
fopen
(
'php://stdin'
,
'r'
);
$fp
=
fopen
(
'php://stdin'
,
'r'
);
echo
"The root user login behaviour will be restored to its defaults.
\n\n
Do you want to proceed? [y/N]: "
;
echo
"The root user login behaviour will be restored to its defaults.
\n\n
Do you want to proceed? [y/N]: "
;
...
@@ -88,6 +101,6 @@ if ($password !== $confirm) {
...
@@ -88,6 +101,6 @@ if ($password !== $confirm) {
local_user_set_password
(
$admin_user
,
$password
);
local_user_set_password
(
$admin_user
,
$password
);
local_user_set
(
$admin_user
);
local_user_set
(
$admin_user
);
write_config
(
'Root user reset from console
menu
'
);
write_config
(
'Root user reset from console'
);
echo
"
\n
The root user has been reset successfully.
\n
"
;
echo
"
\n
The root user has been reset successfully.
\n
"
;
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