Saturday, April 3, 2021

Recent Questions - Server Fault

Recent Questions - Server Fault


Reverse DNS and Apache virtual host

Posted: 03 Apr 2021 09:46 PM PDT

In short: Apache's VirtualHost doesn't work as intended when the reverse DNS is enabled.

I'm managing a web service on a single CentOS server. It has a single IP address and multiple subdomains, and each subdomain has a different webroot setting by Apache's VirtualHost configuration. The *.conf file is located under /etc/httpd/conf.d.

NameVirtualHost *:443    <VirtualHost *:443>      ServerName any      DocumentRoot /var/www/html      # other configurations such as SSLCertificateFile, etc...  </VirtualHost>    <VirtualHost *:443>      ServerName main-domain.com      DocumentRoot /home/main-service/front      # other configurations such as SSLCertificateFile, etc...  </VirtualHost>    <VirtualHost *:443>      ServerName admin-domain.com      DocumentRoot /home/main-service/admin      # other configurations such as SSLCertificateFile, etc...  </VirtualHost>    # and so on...  

The objective of this is to control incoming access like this:

  • access via IP address => /var/www/html (returns a simple text that says there is nothing)
  • access via main-domain.com => /home/main-service/front
  • access via admin-domain.com => /home/main-service/admin

Simple enough.

It had been working without any problem until I enable reverse DNS of this IP address to reduce the risk of treated as spam when the system sends emails. After the reverse DNS was enabled for the IP address and main-domain.com, access via main-domain.com is not referred to ServerName main-domain.com section anymore, and Apache refers to the default /etc/httpd/conf.d/ssl.conf file.

I guess some configuration's priority issue here, but I couldn't find any document explaining clearly about this. How can I make it work with the reverse DNS enabled?

Apache version is 2.2.

How to configure NGINX as proxy for local SMTP server?

Posted: 03 Apr 2021 09:46 PM PDT

I am doing some testing with the NodeJS smtp-server module. It exposes a listening SMTP server on any specified port. SMTP usually runs on port 25, but in order to run the Node app as a non-root user, I am prevented from binding to ports below 1000.

Since I am already using nginx on this machine, I thought the simplest way to get around this would be to bind the server internally to a higher port, for example, 2500. Then use nginx to proxy the SMTP port (25) and directly pass through traffic to the internal listening port.

How can I configure nginx to proxy/passthrough incoming SMTP connections on port 25 to the port on which smtp-server is listening? In this case, incoming TCP connections on port 25 should be directly forwarded to localhost:2500.

Note that the smtp-server app already handles SMTP authentication, TLS, etc, so nginx should not attempt to do those operations. It should just pass the traffic directly through.

Redirecting HTTP to HTTPS without DNS or static IP

Posted: 03 Apr 2021 10:04 PM PDT

I've setup web servers in the past, but now I'm working on an embedded Linux project that is a bit different. I need the embedded Linux device to

  • run an Apache server
  • support DHCP
  • not require any DNS setup
  • (needs to basically be plug-n-play and idiot proof).

I'm a bit unsure how to do an HTTP to HTTPS redirect. What makes it tough is that I will not know the DNS or the IP. Is there a way for the mod-rewrite to dynamically detect the current IP and redirect to HTTP like this:

RewriteRule ^(.*)$ https://[(currentDHCPIPAddress)/$1 [L,R=301]  

Most of the traffic will be from the internal LAN, so I can't do some sort of firewall magic.

If anyone else has any ideas to achieve this I would love to hear suggestions. It's a bit different than the way you'd ever want to setup most servers, so it has stumped me for the moment and most docs don't prepare you for this sort of use case.

Kali VM IPTable not loading

Posted: 03 Apr 2021 09:27 PM PDT

I added these rules to my input table on my Kali VM but now its not showing my IPtable or letting pings go through. My ssh still runs through my host machine no problem though.

iptables -A INPUT -i eth1 -s 10.0.3.0/24 -j ACCEPT

iptables -A INPUT -i eth0 -s 10.0.2.0/24 -j ACCEPT

iptables -A INPUT -i eth2 -s 192.168.0.0/24 -j ACCEPT

iptables -P INPUT DROP

Network Configuration

>150Million records insert select query canceled after 12 hours AWS RDS

Posted: 03 Apr 2021 09:08 PM PDT

I have a AWS RDS t2.micro storing over 150 million records in a table from which i need to make a select insert query to another table, the purpose of this select query is to make a percentage calculation into second table.

I tested this query in a testing db with less than 100 rows(same t2.micro) and it ran correctly. I think the query is being canceled because of the t2.micro capabilities.

I'm considering upgrading the RDS from t2.micro to r6g.large, but im not sure if this will solve my problem, any suggestions?

How to stop the swatchdog scipt running in the background?

Posted: 03 Apr 2021 08:43 PM PDT

Under Ubuntu 20 I have installed Swatchdog and started five daemon processes (running in the background).

Now I wanted to stop the script, so I used apt-get remove swatch.

However, as I could notice, this did not remove the background processes.

What is the command to remove the swatchdog processes?


I used ps -eo 'tty,pid,comm' | grep ^? to list all background processes and found it with:

158434 /usr/bin/swatch  

I also found 461 watchdogd but guess it's unrelated.


PS: I guess a server restart would work. But I like to do it without restart.

Where is the client.conf file located on a MacOS client for OpenVPN?

Posted: 03 Apr 2021 08:34 PM PDT

I want to follow the advice of the following SO response.

If you want to configure this on the client side, put

redirect-gateway def1  

in your client.ovpn file.

However, I can't seem to find the client.conf file on my MacOS client to place that line in. I am using OpenVPN Connect on my MacOS client to connect to my VPN. Where is the configuration file located for Mac users?

Hp can i plug into a wall socket?

Posted: 03 Apr 2021 06:08 PM PDT

Hp bought new hp server,says warranty void if I plug into a wall socket !why not?what would happen?Since it has 2 redundant 800 watt power supplies,I'd need a ups of at least 1600 or better! So...why can't I plug it into a wall socket or power bar? Stupid setup!backup idea is great,but having to have a ups to boot server is stupid!ps having to have a "reputation"to ask a question is stupid! David

What AWS S3 actions produce Decrypt events in CloudTrail?

Posted: 03 Apr 2021 05:16 PM PDT

What are all of the possible S3 actions that can produce a "Decrypt" event in CloudTrail?

DL360 G9 fans run when powered down?

Posted: 03 Apr 2021 04:54 PM PDT

So I just setup a DL360 Gen 9... when the main server is switched off (but its still plugged in, so can access iLO etc.) The fans still run... They are not meant to right? I have had older gen servers and when powered down the fans all stopped. Can't find any info on it - any one have any ideas or do the newer ones actually do that?

Separate connections over 1 network cable

Posted: 03 Apr 2021 06:22 PM PDT

Consider the following network setup

                         ┌───────────────┐                                  ┌────────────┐           │               │               ┌───────────────┐  │            │           │  2 Port RJ45  │               │               │  │ ISP / DHCP │──────────▶│  Socket Roof  │──────────────▶│ Unifi AP Roof │  │            │           │               │        B      │               │  └────────────┘     A     └───────────────┘               └───────────────┘                                  │  ▲                                                                        │  │ B                                                                      │  │                                                                        │  │                                                                     CAT6 Split                                                                     into                                                                      2x100MBit                                                                     │  │                                                                        │  │                                                                      A │  │                                                                        │  │                                                                        ▼  │                                                                 ┌───────────────┐                                                           │  2 Port RJ45  │                                                           │ Socket Ground │     B                                                  ┌──│     Floor     │◀───────────────────────┐                               │  │               │                        │                               │  └───────────────┘                        │                               │                                           │                               │                                           │                            A  │                                           │                               │                                           │                               │      ┌────────┐               ┌────────┐  │                               │      │ Unifi  │        B      │ Unifi  │  │                               └─────▶│  USG   │──────────────▶│  PoE   │──┘                                WAN/1 │        │ LAN/1         │ Switch │                                         └────────┘               └────────┘                    

Now the issue is there is only one cable run from the roof to the network rack on the ground floor. To get 2 connections out of this I have split the CAT6 cable up into 2x100 MBit using 4 wires each.

So the network is as follows:

  • The ISP comes in on the roof via a standard RJ45 (radio relay)
  • The cable is then connected to a 2 port socket (port A) I wired up to split the cable into 2x100MBit
  • On the ground floor the cable from A is connected to the USGs WAN/1 port.
  • From the USG LAN/1 port it goes to a PoE switch that connects the rest of the local lan
  • One PoE port from that switch goes back to the 2 Port socket on port B
  • Port B of the socket on the roof is then connected to the AP

Now I can't say I really like this setup very much. The reasons this is set up this way is

  1. I am a network noob and probably don't know better
  2. I wanted to power the roof AP via POE without an additional injector (not that important)
  3. I wanted to isolate the ISPs DHCP by splitting it into 2 physical connections and using the USGs DHCP instead (important)

So the question is:

Can I achieve those goals without splitting the cable up into 2x100MBit, e.g. using a USW Flex Mini switch?

Need help connecting Old USB Harmon/Kardon SoundSticks and new 2021 Dell XPS laptop

Posted: 03 Apr 2021 06:05 PM PDT

I have some old USB Harmon Kardon SoundSticks that work fine; they were tested with other Windows and Mac laptops, a Windows PC, and even my Android phone (with a USB adapter)!

I have a new Dell XPS laptop running Windows 10 with all of the current patches as well as Dell's firmware updates.

I am unable to get the XPS and the SoundSticks to play together.

FWIW, I have an HDMI monitor with speakers which works fine.

The laptop plays the confirmation sound when I plug the SoundSticks into a USB port (using the adapter that comes with the laptop that was used when testing with my Android phone).

I can see the sound sticks under Sound, video and game controllers in the device manager.

When I run speccy (hardware monitor tool) I can see the Harmon/Kardon Soundsticks listed under Audio->Sound Cards

The SoundSticks do not appear in available playback devices under the speaker icon in the windows taskbar so I am unable to select them.

Any help would be most welcome!

ClamAV not creating sock file

Posted: 03 Apr 2021 10:02 PM PDT

Problem: ClamAV not creating sock file

grep -i socket /var/log/clamav/clamd.log Sat Apr 3 20:00:47 2021 -> ERROR: LOCAL: Socket file /var/run/clamav/clamd.sock could not be bound: Permission denied Sun Apr 4 00:03:11 2021 -> ERROR: LOCAL: Socket file /var/run/clamav/clamd.sock could not be bound: Permission denied

I added group/other write permissions on /var/run/clamav, As well chowned clamav:clamav /var/run/clamav. But on reboot my added write permissions were gone and same was re chowned to root:clamav by system. And no socker entry in logs, neither socket file too. WHY?

Info: Server Info AWS Micro RAM 1GiB SWAP 4GiB Linux Ubuntu 20.04 Server

ls: cannot access '/var/run/clamav/clamd.sock': No such file or directory```    ```free -h                total        used        free      shared  buff/cache   available  Mem:          976Mi        88Mi       774Mi       0.0Ki       113Mi       760Mi  Swap:         4.0Gi       192Mi       3.8Gi```    ```systemctl status clamav-daemon  ● clamav-daemon.service - Clam AntiVirus userspace daemon       Loaded: loaded (/lib/systemd/system/clamav-daemon.service; enabled; vendor preset: enabled)      Drop-In: /etc/systemd/system/clamav-daemon.service.d               └─extend.conf       Active: active (running) since Sat 2021-04-03 19:38:09 IST; 5s ago         Docs: man:clamd(8)               man:clamd.conf(5)               https://www.clamav.net/documents/      Process: 1144 ExecStartPre=/bin/mkdir -p /run/clamav (code=exited, status=0/SUCCESS)      Process: 1155 ExecStartPre=/bin/chown clamav /run/clamav (code=exited, status=0/SUCCESS)     Main PID: 1156 (clamd)        Tasks: 1 (limit: 1119)       Memory: 364.0M       CGroup: /system.slice/clamav-daemon.service               └─1156 /usr/sbin/clamd --foreground=true    Apr 03 19:38:09 alt systemd[1]: Starting Clam AntiVirus userspace daemon...  Apr 03 19:38:09 alt systemd[1]: Started Clam AntiVirus userspace daemon.  Apr 03 19:38:09 alt clamd[1156]: Received 0 file descriptor(s) from systemd.  Apr 03 19:38:09 alt clamd[1156]: clamd daemon 0.102.4 (OS: linux-gnu, ARCH: x86_64, CPU: x86_64)  Apr 03 19:38:09 alt clamd[1156]: Running as user clamav (UID 113, GID 116)  Apr 03 19:38:09 alt clamd[1156]: Log file size limited to 4294967295 bytes.  Apr 03 19:38:09 alt clamd[1156]: Reading databases from /var/lib/clamav  Apr 03 19:38:09 alt clamd[1156]: Not loading PUA signatures.  Apr 03 19:38:09 alt clamd[1156]: Bytecode: Security mode set to "TrustSigned".```      ```clamscan -r --bell -i /home    ----------- SCAN SUMMARY -----------  Known viruses: 8517591  Engine version: 0.102.4  Scanned directories: 7  Scanned files: 12  Infected files: 0  Data scanned: 2.49 MB  Data read: 1.18 MB (ratio 2.11:1)  Time: 269.254 sec (4 m 29 s)```    ```head /etc/clamav/clamd.conf  #Automatically Generated by clamav-daemon postinst  #To reconfigure clamd run #dpkg-reconfigure clamav-daemon  #Please read /usr/share/doc/clamav-daemon/README.Debian.gz for details  LocalSocket /var/run/clamav/clamd.sock  FixStaleSocket true  LocalSocketGroup clamav  LocalSocketMode 0666  # TemporaryDirectory is not set to its default /tmp here to make overriding  # the default with environment variables TMPDIR/TMP/TEMP possible  User clamav```    ```tail /var/log/clamav/clamd.log    Sat Apr  3 19:58:45 2021 -> +++ Started at Sat Apr  3 19:58:45 2021  Sat Apr  3 19:58:45 2021 -> Received 0 file descriptor(s) from systemd.  Sat Apr  3 19:58:45 2021 -> clamd daemon 0.102.4 (OS: linux-gnu, ARCH: x86_64, CPU: x86_64)  Sat Apr  3 19:58:45 2021 -> Running as user clamav (UID 113, GID 116)  Sat Apr  3 19:58:45 2021 -> Log file size limited to 4294967295 bytes.  Sat Apr  3 19:58:45 2021 -> Reading databases from /var/lib/clamav  Sat Apr  3 19:58:45 2021 -> Not loading PUA signatures.  Sat Apr  3 19:58:45 2021 -> Bytecode: Security mode set to "TrustSigned".```    ```ls /var/run/  drwxr-xr-x  2 clamav clamav clamav ?   40 Apr  3 19:30 clamav/```      ``` lsof -U | grep clamav  freshclam  627           clamav    1u  unix 0xffff9fd0b5322000      0t0 19349 type=STREAM  freshclam  627           clamav    2u  unix 0xffff9fd0b5322000      0t0 19349 type=STREAM```    ``` grep -i socket /var/log/clamav/clamd.log  Sat Apr  3 20:00:47 2021 -> ERROR: LOCAL: Socket file /var/run/clamav/clamd.sock could not be bound: Permission denied  Sun Apr  4 00:03:11 2021 -> ERROR: LOCAL: Socket file /var/run/clamav/clamd.sock could not be bound: Permission denied```    Any help, hint, suggestion, reference most welcome.    -Hens  

Google Cloud Certificate provisioning_failed but domain active - Serverless NEG

Posted: 03 Apr 2021 07:15 PM PDT

  1. I have firebase functions (Google Cloud Functions) that work on their https://.cloudfunctions.net/.

  2. I have created a HTTPS Load Balancer with a Serverless NEG, Created SSL certificate (Google Managed).

  3. I have enabled both HTTP and HTTPS as Certificate provisioning keeps failing (provisioning_failed) but domain is active. HTTP works i.e. I can access the function and it works.

  4. I created another sub-domain with another function with the same load balancer and Certificate provisioning was successful after quite a few minutes.

  5. First one is . and second one is called .. Status works but however the api subdomain continues to have certificate generation issues.

  6. I do not have api with another CNAMES (Cloud Run) although I have used both cloud run and App Engine recently for the api subdomain.

I believe certificate generation for the api subdomain is my issue and perhaps I may've hit rate limits. I need this sub-domain working ASAP. How can I get this moving quick?

Best Ukor

Create my own proxy server by using AWS Linux EC2 instance, Error: The connection has timed out

Posted: 03 Apr 2021 09:53 PM PDT

I have tried to create my own proxy server by using AWS Linux EC2 instance. I followed the steps from this article and this article. (Here is all the details and screenshots of steps) But after create the instance and configure the Tinyproxy and then configure browser to this proxy, it shows me an error. When I open the browser and try to search, it shows me that The connection has timed out. The server at www.reddit.com is taking too long to respond. Here I was tried to open Reddit page. Even I am getting different public IP from curl command and Google. curl ifconfig.co gives me the public IPv4 address of AWS instance. And Google gives me the my device's public IP, I was tried both IP address, but not works.

Unable to User Enroll iOS devices

Posted: 03 Apr 2021 09:37 PM PDT

I'm trying to get iOS User Enrollment to work with Intune. I have done the following:

  • Created a Group for my pilot users
  • Added an Apple MDM Push certificate
  • Signed up for Apple Business Manager
  • Connected ABM to Azure AD for Federated Authentication
  • Created an Enrollment Type Profile in Intune that only allows User Enrollment, and assigned this profile to the pilot group. (It's the only iOS Enrollment Type Profile, so it's definitely got priority)

I have tested the enrollment process with two users on two devices. Here are the results:

Device #1:

Device has been in use by user for over a year. Installed Company Portal app. Signed in to MS account via Company Portal app. Agreed to download configuration profile. Activated configuration profile in Settings app. Asked to sign in to Managed Apple ID. Email field is greyed out and can't be changed, user must sign in with the same email address as their MS account. User enters same password as MS account. User informed that their credentials are incorrect.

Device #2:

Device has been factory reset due to exited employee. Set up as new device. Created new Apple ID. Installed Company Portal app. Signed in to MS account via Company Portal app. Agreed to download configuration profile. Activated configuration profile in Settings app. Agreed that company will have control over device. Device enrolled successfully.

But it appears to be Device Enrollment, not User Enrollment. The user was not asked to sign in to a Managed Apple ID. Tested by using "Wipe" function in Intune. Device fully factory reset, including personal data.

Does anyone have any suggestions of what I could be doing wrong?

SMB3 mounted on linux / Debian - qemu-img Failed to get "resize" lock

Posted: 03 Apr 2021 08:16 PM PDT

I have a Windows 2016 SMB share mounted on a Debian 10 box. I am using qemu-img to convert an image file the target of which I wish to store on the SMB mount. When I run the command I get this error:

error while converting qcow2: Failed to get "resize" lock

This suggests that either qemu-img is misinterpreting the lock on the mount or that there is something incorrect with the mount itself. I note that qemu-img does not seem to support stdout, which is extremely frustrating!

Are there any tunables I can use to bypass this error?

Thanks!

RDP farm automatic session reconnect

Posted: 03 Apr 2021 07:05 PM PDT

We have a RDP farm with 100+ users who are using Windows 10. Sometimes we have network problems like short network outages and packet losses. When network problems occur users are disconnected from RDP session with error:

Your Remote Desktop Services session has ended.

However when I am logged on random server (not member of RDP farm) and network problems occur - I have window that says:

The connection has been lost. Attempting to reconnect to your session...

In connection properties of RDP when connecting to RDP farm the checkbox Reconnect if the connection is dropped is checked and grayed out:

Reconnect if the connection is dropped

Why RDP doesn't try to reconnect itself in RDP farm and looses connection immediately? Are there any settings that control this behavior? Sometimes users are forced to manually reconnect to RDP farm several times per hour if network is unstable. If there is no such setting may be there is at least timeout setting that I can configure for higher values so that RDP session survive short network outages?

Azure load balancer does not forward HTTPS requests to Servers

Posted: 03 Apr 2021 04:01 PM PDT

I have 2 VMs behind a load balancer on Azure. I have enabled HTTPS connection for the Websites i have deployed in those VMs using self signed ssl certificate. When I connect to that VM directly via IP I see the certificate loaded, but when i try to connect through load balancer over HTTPS, I get a page which specified "Your connection is not private" (as it is self signed certificate) and in Advanced i click on "proceed to site". For VMs it works, but when i use load balancer IP it will load the same page again and again specifying the same error. I couldn't find much material for implementing HTTPS as well. i implemented based on my understanding of Azure load balancer.

Also can i achieve HTTPS using load balancer or do i need to implement Application Gateway?

Privacy Error:

Error in Browser

rewrite rule on nginx for css js files not work

Posted: 03 Apr 2021 09:03 PM PDT

I use laravel framework for my website on nginx server

I need to apply rewrite rule on nginx

its a sample:

site.com/play/gamename/css.css --> site.com/uploads/games/gamename/css.css  or  site.com/play/gamename/js.js --> site.com/uploads/games/gamename/js.js  

and I need to know How can I define rule to do it?

my website root path is

/var/www/html/siteuser/  

root directories:

app  storage  public  -uploads  ,...  

in my old server with apache .htaccess:

RewriteCond %{REQUEST_URI} \.(jpg|png|css|js|appcache|xml|ogg|m4a)$  RewriteRule ^play/(.+) siteuser/public/uploads/games/$1 [L]  

I test this but not work:

server {          listen 80 default_server;          listen [::]:80 default_server;            root /var/www/html/siteuser/public;            # Add index.php to the list if you are using PHP          index index.html index.htm index.php;            server_name .site.com;            location / {                  # First attempt to serve request as file, then                  # as directory, then fall back to displaying a 404.                  try_files $uri $uri/ /index.php?$query_string;                  if ($uri ~ ".(jpg|png|css|js|appcache|xml|ogg|m4a)$"){                          set $rule_0 1$rule_0;                  }              }          if ($uri ~ ".(jpg|png|css|js|appcache|xml|ogg|m4a)$"){                  set $rule_0 1$rule_0;          }          if ($rule_0 = "1"){                  rewrite ^/play/(.+) /siteuser/public/uploads/games/$1 last;          }              # pass PHP scripts to FastCGI server          #          location ~ \.php$ {                  include snippets/fastcgi-php.conf;          #          #       # With php-fpm (or other unix sockets):                  fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;          #       # With php-cgi (or other tcp sockets):          #       fastcgi_pass 127.0.0.1:9000;          }            # deny access to .htaccess files, if Apache's document root          # concurs with nginx's one          #          location ~ /\.ht {                  deny all;          }  }  

Zabbix and logrt.count doesn't get data

Posted: 03 Apr 2021 05:08 PM PDT

I'm running Debian and Zabbix 3.4.

I've created a custom item with the following syntax:

logrt.count["/var/log/^req_log.*.txt$","TIMEOUT"]  

I'm trying to detect any log file in the format req_log2018-06-26.txt with the word TIMEOUT and return the number of occurenses.

But no data is gathered with this item, even though there are some files in the directoty which does contain the word.

Is there a way to manually run and test item on server with Zabbix agent running?

AD Connect changed primary SMTP on O365 - how to fix it?

Posted: 03 Apr 2021 07:05 PM PDT

I've got a problem with AD Connect working in one of our customers systems. We first configured O365 and Exchange Online, then connected AD with AAD with AD Connect. when we did that, the local AD changed the primary SMTP for users, and we can't change it from O365 (it says, it has been configured by local AD service).

Basically, the email address should be like john.smith@domain.com and username should be jsmith, but the system changed primary SMTP to jsmith@domain.com (which should be an alias).

According to what I've been able to determine with customers IT team, the attributes in AD look ok (although I'm not 100% sure about that). The biggest problem is that I don't have an access to local AD at my customers environment, so I'm sort of working blind here.

What should I look for? How to fix it?

Getting IP address like "10.8.0.33/-1" when setting static IP address with OpenVPN

Posted: 03 Apr 2021 08:06 PM PDT

I'm trying to build an internal network with OpenVPN. Many services require static IPs so I referred to this

However after configuring, when I tried to connect, the client displayed the following error:

Sun Dec 10 09:08:09 2017 /sbin/ip link set dev tun0 up mtu 1500    Sun Dec 10 09:08:09 2017 /sbin/ip addr add dev tun0 10.8.0.33/-1 broadcast 255.255.255.255    Error: inet prefix is expected rather than "10.8.0.33/-1".    Sun Dec 10 09:08:09 2017 Linux ip addr add failed: external program exited with error status: 1    Sun Dec 10 09:08:09 2017 Exiting due to fatal error    

I can see that the client got an IP address "10.8.0.33/-1", which is invalid.

Any ideas? All kinds of help would be highly appreciated.

Powershell take ownership of AD Objects

Posted: 03 Apr 2021 08:06 PM PDT

I have a list of users, computer, and groups that random people are the owner of in AD. I'd like to clean them up for security reasons and just make domain admins the owner for all these objects. Can someone assist with a powershell script for this?

I google searched without any luck. I found this old code but it doesn't seem to work, keep getting an error for the owner. Running as a domain admin, win10 machine.

Param (  [parameter(Position=0,Mandatory=$true,ValueFromPipeline=$true)][string]$Identity,  [parameter(Position=1,Mandatory=$true,ValueFromPipeline=$true)][string]$Owner  )    try {    $oADObject = Get-ADObject -Filter { (Name -eq $Identity) -or (DistinguishedName -eq $Identity) };    $oAceObj   = Get-Acl -Path ("ActiveDirectory:://RootDSE/" + $oADObject.DistinguishedName);  } catch {    Write-Error "Failed to find the source object.";    return;  }    try {    $oADOwner   = Get-ADObject -Filter { (Name -eq $Owner) -or (DistinguishedName -eq $Owner) };    $oNewOwnAce = New-Object System.Security.Principal.NTAccount($oADOwner.Name);  } catch {    Write-Error "Failed to find the new owner object.";    return;  }    try {    $oAceObj.SetOwner($oNewOwnAce);    Set-Acl -Path ("ActiveDirectory:://RootDSE/" + $oADObject.DistinguishedName) -AclObject $oAceObj;  } catch {    $errMsg = "Failed to set the new new ACE on " + $oADObject.Name;    Write-Error $errMsg;  }  

e.g. Running .\set-adowner.ps1 -Identity "RANDOMUSER" -Owner "domain admins"

Also would like to have it run through a txt file with all the objects' samaccountnames, once I get the base script running.

Thank you for any help, Fred

PXE boot cannot find syslinux config file, where is it looking?

Posted: 03 Apr 2021 10:01 PM PDT

I am running a PXE server mock up in VMware Workstation. I have the DHCP and TFTP servers working and I can get my to grab an IP address and boot the firmware for their platform.

Where I seem to be running into trouble is all clients are failing to find the configuration file for syslinux. I intend on using multiple platforms so I have each platform in its own folder.

Here is my structure; File tree

This is the error I am receiveing from the clients; PXE Error

From what I have read on the syslinux wiki it says the bootloader will try looking for a config file in a specific order.

Config file order

I am pretty sure its something to do with my configuration that is causing the failure. The issue I am stumped on what it would be. Since my each platform has its own folder I am think the context of `/mybootdir' has changed. The question is to what? You can see in the file tree I tried making a symlink as a workaround but it did not seem to make any difference.

Any ideas what is wrong?

UPDATE

Here is what my DHCP config looks like; I copied some of it from a few examples I found on how to boot different platforms from the same DHCP scope and made it my own.

DHCP Config

Check `Restore on AC/Power Loss` from CMD/Powershell on windows 10

Posted: 03 Apr 2021 10:16 PM PDT

I've set the Restore on AC/Power Loss from the windows Bios menu on computer startup for a few Windows machines.

How can someone confirm (remotely) that I have done that, is there a way to do this from a remote desktop?

Bonus points if you know how to change it remotely (if it can be done).

What I've done:

  • Ran wmic bios get /format:list but saw nothing that fit.
  • Looked through documents, such as this and the wmic documentation but haven't know what to be looking for.

Telnet: Unable to connect to remote host: Connection refused (Postfix - Ubuntu 14.04 VPS)

Posted: 03 Apr 2021 09:03 PM PDT

I have installed postfix following this tutorial but when I try to telnet mail.mydomain.com 110 (995,993,143 or 25) it throws the following error: Telnet: Unable to connect to remote host: Connection refused

I looked at this answer of ServerFault but it couldn't help! Any clue how to fix this (or a link to another tutorial), I've been trying to install a servermail on my VPS for a week now, cannot get it to work!

php-fpm stuck at state: Finishing

Posted: 03 Apr 2021 05:08 PM PDT

The site use nginx+php-fpm. Today, accessing some pages returns 502 state in a few seconds (different from 502 caused by php script timeout), while other pages stay in service.

Status page of php-fpm shows all processes are active, but they're all stucked in State: finishing, and load of server is low.

pid:                  12775  state:                Finishing  start time:           18/May/2013:16:50:27 +0800  start since:          755  requests:             59  request duration:     743543095  request method:       GET  request URI:          /index.php  content length:       0  user:                 -  script:               /data/webserver/index.php  last request cpu:     0.00  last request memory:  0  

I'm wondering why this happened, although it becomes well after I restart the php-fpm.

Get filename in the case stored on disk?

Posted: 03 Apr 2021 08:40 PM PDT

I have a file README.TXT. If I issue the following command:

PS> Get-Item ReadMe.txt  

...then it returns "ReadMe.txt". I want to find out the actual name of the file on disk, including case. How do I get it to return "README.TXT"?

I ask because I'm trying to track down a problem with case-insensitive filenames on Windows versus case-sensitive files on a Unix box, and I want to get the actual case used on the Windows box.

More detail: I have a list of files (stored in a .CSPROJ file) which are in a different case from those stored on disk. I want to be sure that they match. For example: if the .CSPROJ file says "ReadMe.txt", but the file on disk is "README.TXT", sometimes editing the file in Visual Studio rewrites the file as "ReadMe.txt", which then confuses Perforce, because it's case-sensitive, and the filename no longer has the case it was expecting. I want to write a script that spots the mismatched filenames, so that I can do something about them before it causes a problem.

Any experiences migrating from MDaemon to MS Exchange Online?

Posted: 03 Apr 2021 10:01 PM PDT

I will probably be moving from MDaemon to Exchange Online shortly - MDaemon's interface to Outlook is just too slow for remote users. Does anyone have any experiences with the migration that they would care to share?

I have 100 users on MDaemon, some with >4Gb mailboxes, most of them are using IMAP.

No comments:

Post a Comment