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
bf8356c9
Commit
bf8356c9
authored
Jul 28, 2015
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rc.initial: apply PSR2 style
parent
0fe885b9
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
565 additions
and
514 deletions
+565
-514
rc.initial.banner
src/etc/rc.initial.banner
+72
-70
rc.initial.defaults
src/etc/rc.initial.defaults
+1
-1
rc.initial.halt
src/etc/rc.initial.halt
+1
-1
rc.initial.password
src/etc/rc.initial.password
+37
-36
rc.initial.ping
src/etc/rc.initial.ping
+6
-6
rc.initial.reboot
src/etc/rc.initial.reboot
+1
-1
rc.initial.setlanip
src/etc/rc.initial.setlanip
+440
-392
rc.initial.setports
src/etc/rc.initial.setports
+7
-7
No files found.
src/etc/rc.initial.banner
View file @
bf8356c9
...
...
@@ -44,80 +44,82 @@ print "\n*** Welcome to {$product} {$version} ({$machine}/${flavour}) on {$hostn
$iflist
=
get_configured_interface_with_descr
(
false
,
true
);
if
(
empty
(
$iflist
))
{
printf
(
"
\n\t
No network interfaces are assigned.
\n
"
);
return
;
printf
(
"
\n\t
No network interfaces are assigned.
\n
"
);
return
;
}
foreach
(
$iflist
as
$ifname
=>
$friendly
)
{
/* point to this interface's config */
$ifconf
=
$config
[
'interfaces'
][
$ifname
];
/* look for 'special cases' */
$class
=
""
;
if
(
isset
(
$ifconf
[
'ipaddr'
]))
{
switch
(
$ifconf
[
'ipaddr'
])
{
case
"dhcp"
:
$class
=
"/DHCP4"
;
break
;
case
"pppoe"
:
$class
=
"/PPPoE"
;
break
;
case
"pptp"
:
$class
=
"/PPTP"
;
break
;
case
"l2tp"
:
$class
=
"/L2TP"
;
break
;
}
}
$class6
=
null
;
if
(
isset
(
$ifconf
[
'ipaddrv6'
]))
{
switch
(
$ifconf
[
'ipaddrv6'
])
{
case
"dhcp6"
:
$class6
=
"/DHCP6"
;
break
;
case
"slaac"
:
$class6
=
"/SLAAC"
;
break
;
case
"6rd"
:
$class6
=
"/6RD"
;
break
;
case
"6to4"
:
$class6
=
"/6to4"
;
break
;
case
"track6"
:
$class6
=
"/t6"
;
break
;
}
}
$ipaddr
=
get_interface_ip
(
$ifname
);
$subnet
=
get_interface_subnet
(
$ifname
);
$ipaddr6
=
get_interface_ipv6
(
$ifname
);
$subnet6
=
get_interface_subnetv6
(
$ifname
);
$realif
=
get_real_interface
(
$ifname
);
$tobanner
=
"
{
$friendly
}
(
{
$realif
}
)"
;
foreach
(
$iflist
as
$ifname
=>
$friendly
)
{
/* point to this interface's config */
$ifconf
=
$config
[
'interfaces'
][
$ifname
];
/* look for 'special cases' */
$class
=
""
;
if
(
isset
(
$ifconf
[
'ipaddr'
]))
{
switch
(
$ifconf
[
'ipaddr'
])
{
case
"dhcp"
:
$class
=
"/DHCP4"
;
break
;
case
"pppoe"
:
$class
=
"/PPPoE"
;
break
;
case
"pptp"
:
$class
=
"/PPTP"
;
break
;
case
"l2tp"
:
$class
=
"/L2TP"
;
break
;
}
}
$class6
=
null
;
if
(
isset
(
$ifconf
[
'ipaddrv6'
]))
{
switch
(
$ifconf
[
'ipaddrv6'
])
{
case
"dhcp6"
:
$class6
=
"/DHCP6"
;
break
;
case
"slaac"
:
$class6
=
"/SLAAC"
;
break
;
case
"6rd"
:
$class6
=
"/6RD"
;
break
;
case
"6to4"
:
$class6
=
"/6to4"
;
break
;
case
"track6"
:
$class6
=
"/t6"
;
break
;
}
}
$ipaddr
=
get_interface_ip
(
$ifname
);
$subnet
=
get_interface_subnet
(
$ifname
);
$ipaddr6
=
get_interface_ipv6
(
$ifname
);
$subnet6
=
get_interface_subnetv6
(
$ifname
);
$realif
=
get_real_interface
(
$ifname
);
$tobanner
=
"
{
$friendly
}
(
{
$realif
}
)"
;
printf
(
"
\n
%-15s -> "
,
$tobanner
);
printf
(
"
\n
%-15s -> "
,
$tobanner
);
$v6first
=
false
;
if
(
!
empty
(
$ipaddr
)
&&
!
empty
(
$subnet
))
{
printf
(
"v4%s: %s/%s"
,
$class
,
$ipaddr
,
$subnet
);
}
else
{
$v6first
=
true
;
}
if
(
!
empty
(
$ipaddr6
)
&&
!
empty
(
$subnet6
))
{
if
(
!
$v6first
)
{
printf
(
"
\n
%s"
,
str_repeat
(
" "
,
20
));
}
printf
(
"v6%s: %s/%s"
,
$class6
,
$ipaddr6
,
$subnet6
);
}
$v6first
=
false
;
if
(
!
empty
(
$ipaddr
)
&&
!
empty
(
$subnet
))
{
printf
(
"v4%s: %s/%s"
,
$class
,
$ipaddr
,
$subnet
);
}
else
{
$v6first
=
true
;
}
if
(
!
empty
(
$ipaddr6
)
&&
!
empty
(
$subnet6
))
{
if
(
!
$v6first
)
{
printf
(
"
\n
%s"
,
str_repeat
(
" "
,
20
));
}
printf
(
"v6%s: %s/%s"
,
$class6
,
$ipaddr6
,
$subnet6
);
}
}
printf
(
"
\n
"
);
src/etc/rc.initial.defaults
View file @
bf8356c9
...
...
@@ -43,7 +43,7 @@ Do you want to proceed {$yes_no_prompt}
EOD;
if
(
strcasecmp
(
chop
(
fgets
(
$fp
)),
'y'
)
==
0
)
{
reset_factory_defaults
();
reset_factory_defaults
();
}
fclose
(
$fp
);
src/etc/rc.initial.halt
View file @
bf8356c9
...
...
@@ -38,7 +38,7 @@ echo "This may take a minute, depending on your hardware.\n";
echo
"
\n
Do you want to proceed [y|n]? "
;
if
(
strcasecmp
(
chop
(
fgets
(
$fp
)),
'y'
)
==
0
)
{
system_halt
(
true
);
system_halt
(
true
);
}
fclose
(
$fp
);
src/etc/rc.initial.password
View file @
bf8356c9
...
...
@@ -33,49 +33,50 @@ require_once('auth.inc');
$fp
=
fopen
(
'php://stdin'
,
'r'
);
printf
(
gettext
(
'The %s password will be reset to the factory default of `%s\'.'
),
$g
[
'factory_shipped_username'
],
$g
[
'factory_shipped_password'
]
gettext
(
'The %s password will be reset to the factory default of `%s\'.'
),
$g
[
'factory_shipped_username'
],
$g
[
'factory_shipped_password'
]
);
printf
(
"
\n\n
"
);
printf
(
gettext
(
'Do you want to proceed [y|n]? '
));
if
(
strcasecmp
(
chop
(
fgets
(
$fp
)),
'y'
)
==
0
)
{
if
(
isset
(
$config
[
'system'
][
'webgui'
][
'authmode'
])
&&
$config
[
'system'
][
'webgui'
][
'authmode'
]
!=
'Local Database'
)
{
printf
(
"
\n\n
"
);
printf
(
gettext
(
'The User manager authentication server is set to "%s".'
),
$config
[
'system'
][
'webgui'
][
'authmode'
]);
printf
(
"
\n
"
);
printf
(
gettext
(
'Do you want to set it back to Local Database [y|n]? '
));
if
(
strcasecmp
(
chop
(
fgets
(
$fp
)),
'y'
)
==
0
)
{
$config
[
'system'
][
'webgui'
][
'authmode'
]
=
'Local Database'
;
}
}
$admin_user
=&
getUserEntryByUID
(
0
);
if
(
!
$admin_user
)
{
echo
"Failed to locate the admin user account! Attempting to restore access.
\n
"
;
$admin_user
=
array
();
$admin_user
[
'uid'
]
=
0
;
if
(
!
isset
(
$config
[
'system'
][
'user'
]))
$config
[
'system'
][
'user'
]
=
array
();
$config
[
'system'
][
'user'
][]
=
$admin_user
;
}
if
(
isset
(
$config
[
'system'
][
'webgui'
][
'authmode'
])
&&
$config
[
'system'
][
'webgui'
][
'authmode'
]
!=
'Local Database'
)
{
printf
(
"
\n\n
"
);
printf
(
gettext
(
'The User manager authentication server is set to "%s".'
),
$config
[
'system'
][
'webgui'
][
'authmode'
]);
printf
(
"
\n
"
);
printf
(
gettext
(
'Do you want to set it back to Local Database [y|n]? '
));
if
(
strcasecmp
(
chop
(
fgets
(
$fp
)),
'y'
)
==
0
)
{
$config
[
'system'
][
'webgui'
][
'authmode'
]
=
'Local Database'
;
}
}
$admin_user
=&
getUserEntryByUID
(
0
);
if
(
!
$admin_user
)
{
echo
"Failed to locate the admin user account! Attempting to restore access.
\n
"
;
$admin_user
=
array
();
$admin_user
[
'uid'
]
=
0
;
if
(
!
isset
(
$config
[
'system'
][
'user'
]))
{
$config
[
'system'
][
'user'
]
=
array
();
}
$config
[
'system'
][
'user'
][]
=
$admin_user
;
}
$admin_user
[
'name'
]
=
$g
[
'factory_shipped_username'
];
$admin_user
[
'priv'
]
=
array
(
'user-shell-access'
);
$admin_user
[
'scope'
]
=
'system'
;
$admin_user
[
'name'
]
=
$g
[
'factory_shipped_username'
];
$admin_user
[
'priv'
]
=
array
(
'user-shell-access'
);
$admin_user
[
'scope'
]
=
'system'
;
if
(
isset
(
$admin_user
[
'disabled'
]))
{
unset
(
$admin_user
[
'disabled'
]);
}
if
(
isset
(
$admin_user
[
'disabled'
]))
{
unset
(
$admin_user
[
'disabled'
]);
}
local_user_set_password
(
$admin_user
,
$g
[
'factory_shipped_password'
]);
local_user_set
(
$admin_user
);
write_config
(
$config
,
gettext
(
"password changed from console menu"
));
local_user_set_password
(
$admin_user
,
$g
[
'factory_shipped_password'
]);
local_user_set
(
$admin_user
);
write_config
(
$config
,
gettext
(
"password changed from console menu"
));
printf
(
"
\n\n
"
);
printf
(
gettext
(
"The password has been reset."
));
printf
(
"
\n
"
);
printf
(
gettext
(
"Please change the password as soon as you log in!"
));
printf
(
"
\n\n
"
);
printf
(
"
\n\n
"
);
printf
(
gettext
(
"The password has been reset."
));
printf
(
"
\n
"
);
printf
(
gettext
(
"Please change the password as soon as you log in!"
));
printf
(
"
\n\n
"
);
}
src/etc/rc.initial.ping
View file @
bf8356c9
...
...
@@ -37,15 +37,15 @@ echo "\nEnter a host name or IP address: ";
$pinghost
=
chop
(
fgets
(
$fp
));
if
(
is_ipaddrv4
(
$pinghost
)
||
is_hostname
(
$pinghost
))
{
$command
=
"ping"
;
$command
=
"ping"
;
}
elseif
(
is_ipaddrv6
(
$pinghost
))
{
$command
=
"ping6"
;
$command
=
"ping6"
;
}
if
(
$command
)
{
echo
"
\n
"
;
passthru
(
"/sbin/
{
$command
}
-c 3 -n "
.
escapeshellarg
(
$pinghost
));
echo
"
\n
Press ENTER to continue.
\n
"
;
fgets
(
$fp
);
echo
"
\n
"
;
passthru
(
"/sbin/
{
$command
}
-c 3 -n "
.
escapeshellarg
(
$pinghost
));
echo
"
\n
Press ENTER to continue.
\n
"
;
fgets
(
$fp
);
}
fclose
(
$fp
);
src/etc/rc.initial.reboot
View file @
bf8356c9
...
...
@@ -38,7 +38,7 @@ echo "This may take a minute, depending on your hardware.\n";
echo
"
\n
Do you want to proceed [y|n]? "
;
if
(
strcasecmp
(
chop
(
fgets
(
$fp
)),
'y'
)
==
0
)
{
system_reboot
(
true
);
system_reboot
(
true
);
}
fclose
(
$fp
);
src/etc/rc.initial.setlanip
View file @
bf8356c9
This diff is collapsed.
Click to expand it.
src/etc/rc.initial.setports
View file @
bf8356c9
...
...
@@ -42,11 +42,11 @@ require_once("pfsense-utils.inc");
require_once
(
"unbound.inc"
);
if
(
set_networking_interfaces_ports
())
{
echo
"Reloading interfaces..."
;
global
$config
;
$config
=
parse_config
();
system_routing_enable
();
interfaces_configure
();
echo
"done.
\n
"
;
enable_rrd_graphing
();
echo
"Reloading interfaces..."
;
global
$config
;
$config
=
parse_config
();
system_routing_enable
();
interfaces_configure
();
echo
"done.
\n
"
;
enable_rrd_graphing
();
}
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