-
Notifications
You must be signed in to change notification settings - Fork 30
Sip2 telnet #401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sip2 telnet #401
Changes from all commits
24f7bc8
7321680
7cb5adb
4a0a1e2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,7 @@ use feature 'say'; | |
|
|
||
| use Data::Dumper; | ||
| use IO::Socket::INET; | ||
| use Net::Telnet; | ||
| use POSIX qw(strftime); | ||
| use Socket qw(:crlf); | ||
|
|
||
|
|
@@ -29,6 +30,7 @@ sub authenticate_via_sip { | |
| my $timeout = $config->{SIP}->{timeout} || 15; | ||
| my $require_sip_auth = $config->{SIP}->{require_sip_auth} | ||
| // 1; # Default to requiring authentication if setting doesn't exist | ||
| my $sip_enable_telnet_login = $config->{SIP}->{sip_enable_telnet_login}; | ||
|
|
||
| $log->debug("SIP SERVER: $host:$port"); | ||
| say "SIP SERVER: $host:$port" if $test_mode; | ||
|
|
@@ -54,6 +56,28 @@ sub authenticate_via_sip { | |
| or $log->fatal("ERROR in Socket Creation : $!\n") | ||
| && ( $test_mode && die "ERROR in Socket Creation : $!\n" ); | ||
|
Comment on lines
56
to
57
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The error handling logic in line 56 uses Recommended Solution: |
||
|
|
||
| say "sip_enable_telnet_login: $sip_enable_telnet_login" if $test_mode; | ||
| if ($sip_enable_telnet_login) { | ||
| $log->debug("Telnet login enabled"); | ||
| $telnet = new Net::Telnet( Fhopen => $socket ); | ||
kylemhall marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| $sip_username = $config->{SIP}->{username}; | ||
| $sip_password = $config->{SIP}->{password}; | ||
| $sip_telnet_login_prompt = quotemeta($config->{SIP}->{sip_telnet_login_prompt}); | ||
| say "login, expecting: $sip_telnet_login_prompt" if $test_mode; | ||
| $ok = $telnet->login( | ||
| Name => $sip_username, | ||
| Password => $sip_password, | ||
| Prompt => '/' . $sip_telnet_login_prompt . '/', | ||
| Errmode => 'return' | ||
| ); | ||
| if ( !$ok ) { | ||
| $telnet_error = $telnet->errmsg; | ||
| $log->debug("Telnet error: $telnet_error"); | ||
| say "telnet error: $telnet_error" if $test_mode; | ||
| return { success => 0, error => 'SIP_AUTH_FAILURE', user => $user }; | ||
| } | ||
| } | ||
|
|
||
| ## Set location to empty string if not set | ||
| $config->{SIP}->{location} //= q{}; | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using
sayfor outputting sensitive information such as SIP server addresses in a production environment can lead to security risks if the output is accessible in shared logs or consoles. This practice should be avoided or secured to ensure that sensitive information is not exposed.Recommended Solution:
Consider using controlled logging mechanisms with appropriate access restrictions instead of using
sayfor debugging outputs.