Administrator privileges in Python - sockets

I am trying to create a socket on python that requires administrator privileges. I keep getting this error though:
error: [Errno 10013] An attempt was made to access a socket in a way forbidden by its access permissions
I have tried implementing solutions on this website, concluding that it is probably an administrator error. One of the most notable is the code marked as the best answer to this question. However, even after implementing it in my code, after I tell UAC to allow the elevation, I still get the same error. Any review on my code below would be much appreciated.
if not admin.isUserAdmin():
admin.runAsAdmin()
icmp = socket.getprotobyname("icmp")
# Create Socket
try:
mySocket = socket.socket(socket.AF_INET, socket.SOCK_RAW, icmp)

Related

dotlock protocol, how to deal with permission denied in /var/mail?

I'm writing a tool to deal with email in mbox format, and I want to properly implement dotlock. For obvious reasons, attempting to create a lockfile in /var/mail or /var/spool/mail results in a permission denied error.
Is there official documentation on dotlock protocol, and does it address this issue? I note that /usr/bin/mail is not SUID-root, so that's not the answer. Linux has the mail-lock program, but neither MacOS or FreeBSD have it.
Another way to ask this question: How does /usr/bin/mail lock the user's inbox?

GCP Logs Exporter is reporting error: db=postgres,user=postgres FATAL: password authentication failed for user "postgres"

I've changed postgres user password and we started getting error:
db=postgres,user=postgres FATAL: password authentication failed for user "postgres"
It happens each second.
Our log
I still can't figure it out which service tries to reach our SQL instance with this account.
I tried to set a password we only have, which could be previous one, but it didn't help us.
Did anyone faced the similar situation? Who knows how to fix it?
Thanks in advance for any assistance.
Best regards, Alexey
If your database is accessible to the internet, then people will try to log into it. That is how things are. You can't police the world.
Their attempts are failing. So you can just enjoy watching them beat their heads against a wall. If you don't like the log spam, or if you are afraid you will absent-mindedly set your password to 'b#seb#ll12' someday, you can change your firewall to block the attempts. You could probably configure logging to log ip addresses too (or, if it is already logged, then inspect that part of the log, which you don't seem to be doing now).
Change pg_hba.conf auth-method in order to request the password, when set.
https://www.postgresql.org/docs/current/auth-password.html

SCCM 2012 R2 Remove-CMDevice

Greeting Everyone,
Hoping someone has a quick insight but I am getting access denied on a service account using the PowerShell command Remove-CMDevice.
This process is as per outlined here, https://technet.microsoft.com/en-us/library/jj821759(v=sc.20).aspx
The account has permission to remove devices from SCCM and this works fine through the GUI but not the command line. I have been unable to find documentation on what permissions the account need to do this via command line, it works fine manually in the GUI.
If anyone can shed light on this it will be wonderful, I do want to keep this service account as having as minimal permissions as possible.
Many thanks,
Edit to Add Image as follows,
After a lot of testing, I'm here with an answer on the Permission part when using PowerShell console to remove CM system object. Of course the symptom is the same: The account can delete from Admin console, however, when using PowerShell, it failed with Permission error message.
The account to perform the Remove-CMDevice cmdlet must have proper RBA Permission on the object. Assume the security scope is default one, the account connected to Configuration Manager console must have below RBA permission which I tested is almost minimal permission:
In the screenshot the Collection part, the permission is easy to understand, Read, Delete Resource, etc.
For the Computer Association part, you may get confused, why?
Steps I did the troubleshooting:
I opened a PowerShell Console connecting to Configuration Manager using my test account and run below command to see what will happen:
Remove-CMDevice 'Rsuraceccc' -Verbose
I got below error:
Yes, it's trying to querying from the SMS_StateMigration. Then I try to run a simple command:
Get-WMIObject -NameSpace root\sms\site_clt -Query 'Select * from SMS_StateMigration'
Once again, I got error. So I get the conclusion that the account needs Permission on SMS_StateMigration. So I add 'Recover User State' permission of Computer Association on the role and tried again, cheers, this time all command runs successfully.
I don't know why it's using SMS_StateMigration, but this is the case here.

How to get e-mails to work on phpBB with CentOS 6? Experiencing PHP Error

So, I have a phpBB forum on CentOS 6, however there is a problem. E-mails are simply not working.
I tried using e-mails on domain such as admin#domain.com, and I would get this error:
E-mail error
» EMAIL/PHP/mail()
/adm/index.php
so I trued using SMTP with different SMTP hosts and settings, nothing has worked, I would simply get this error:
E-mail error
» EMAIL/SMTP
/adm/index.php
Could not connect to smtp host : 0 : php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution
Errno 2: fsockopen(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution at [ROOT]/includes/functions_messenger.php line 1030<br />
Errno 2: fsockopen(): unable to connect to smtp.mail.com:25 (php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution) at [ROOT]/includes/functions_messenger.php line 1030
I got the errors from PHP Error Log from PHP
Oddly enough, the e-mails appear on my VPS in var/spool/mail/root file.
2 people have told be that this may be a DNS issue, I suspect this being true, as I, for some reason, couldn't use "wget" on my VPS, so I set Nameservers in /etc/resolv.conf and suddenly another problem I was experiencing, "could not get latest phpBB version" or something like that, was fixed. So, if that was fixed with such a solution, I would assume this would have something to do with it too.
And, I asked my host about it, they said "everything is virtualized" and how they have no actual control over it (in a sense that it is their configuration's fault) and how they do not support 3rd party software, even though this is not a software issue. And prior to that they said that they talked to "level 3 Linux admin" and how the admin said it is PHP/Apache issue.
I am losing my mind over this. It is a good machine for a good price with a game panel as we are hosting a game server, and it would really be a bother to move it all elsewhere.
Also, full talk and information on phpBB forums can be found here:
https://www.phpbb.com/community/viewtopic.php?f=46&t=2257586
Check your SMTP settings, make sure its set to the correct client (both on your DNS and within phpbb in General-Client Communication-Email Settings). If you have to use an authenticated account, verify that the username and password you are using is correct by typing it into a word doc to see spelling and copy/pasting it into the fields. In some cases, SMTP will only work with authenticated accounts.

Business Object XI 3.0 error

In Business Object XI 3.0, while logging in publishing wizard I am getting following error. Any Help please
Logon Error
Transport error: Communication failure.(FWM 00001)
OK
Even CMC option is also not working. Yesterday also it was giving same problem. I had reinstalled the software. then it started working. Now today it is again giving same error. This happen second time. Please help
make sure your hosts file is right,eg 10.1.1.1 serverdomain.ping the server make sure the network is working.
It's possible that your firewall is blocking it, also double check your credentials within the cmc are correct and that there is connectivity between your database and your server. Also try connecting through the Administrative account.