A lot of PAM authentication errors on my logs targeting my mailserver. How do I stop it?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
4
down vote

favorite
1












I need help pinpointing some errors in my auth.log file on my Ubuntu server. A few weeks ago, I found a plethora of login attempts to my SSH port (22) on auth.log, so I changed my SSH port. It was clean for a week, and then I found another bunch of login attempts through a different port.



PAM auth error



I'm getting a lot of duplicates of the lines in red (in the image). The repeating lines are as follows:



saslauthd[1140]: pam_unix(smtp:auth): check pass; user unknown
saslauthd[1140]: pam_unix(smtp:auth): authentication failure; logname= uid=0 euid=0 tty= ruser= rhost=
saslauthd[1140]: DEBUG: auth_pam: pam_authenticate failed: Authentication failure
saslauthd[1140]: do_auth : auth failure: [user=roselia] [service=smtp] [realm=mail.mydomain.com] [mech=pam] [reason=PAM auth error]


I can tell that they are trying to login to my mailserver (since the realm is mail.mydomain.com), but I can't tell exactly what they are trying to do, since I don't know what PAM is. What is PAM? And what should I do to stop these auth attempts on my mailserver (port 25)?



I'm also occasionally getting some CRON logs in my auth.log that's related to PAM, and it'll be great if someone can tell me what these mean too:



CRON[32236]: pam_unix(cron:session): session opened for user root by (uid=0)
CRON[32235]: pam_unix(cron:session): session opened for user root by (uid=0)
CRON[32236]: pam_unix(cron:session): session closed for user root
CRON[32235]: pam_unix(cron:session): session closed for user root






share|improve this question
























    up vote
    4
    down vote

    favorite
    1












    I need help pinpointing some errors in my auth.log file on my Ubuntu server. A few weeks ago, I found a plethora of login attempts to my SSH port (22) on auth.log, so I changed my SSH port. It was clean for a week, and then I found another bunch of login attempts through a different port.



    PAM auth error



    I'm getting a lot of duplicates of the lines in red (in the image). The repeating lines are as follows:



    saslauthd[1140]: pam_unix(smtp:auth): check pass; user unknown
    saslauthd[1140]: pam_unix(smtp:auth): authentication failure; logname= uid=0 euid=0 tty= ruser= rhost=
    saslauthd[1140]: DEBUG: auth_pam: pam_authenticate failed: Authentication failure
    saslauthd[1140]: do_auth : auth failure: [user=roselia] [service=smtp] [realm=mail.mydomain.com] [mech=pam] [reason=PAM auth error]


    I can tell that they are trying to login to my mailserver (since the realm is mail.mydomain.com), but I can't tell exactly what they are trying to do, since I don't know what PAM is. What is PAM? And what should I do to stop these auth attempts on my mailserver (port 25)?



    I'm also occasionally getting some CRON logs in my auth.log that's related to PAM, and it'll be great if someone can tell me what these mean too:



    CRON[32236]: pam_unix(cron:session): session opened for user root by (uid=0)
    CRON[32235]: pam_unix(cron:session): session opened for user root by (uid=0)
    CRON[32236]: pam_unix(cron:session): session closed for user root
    CRON[32235]: pam_unix(cron:session): session closed for user root






    share|improve this question






















      up vote
      4
      down vote

      favorite
      1









      up vote
      4
      down vote

      favorite
      1






      1





      I need help pinpointing some errors in my auth.log file on my Ubuntu server. A few weeks ago, I found a plethora of login attempts to my SSH port (22) on auth.log, so I changed my SSH port. It was clean for a week, and then I found another bunch of login attempts through a different port.



      PAM auth error



      I'm getting a lot of duplicates of the lines in red (in the image). The repeating lines are as follows:



      saslauthd[1140]: pam_unix(smtp:auth): check pass; user unknown
      saslauthd[1140]: pam_unix(smtp:auth): authentication failure; logname= uid=0 euid=0 tty= ruser= rhost=
      saslauthd[1140]: DEBUG: auth_pam: pam_authenticate failed: Authentication failure
      saslauthd[1140]: do_auth : auth failure: [user=roselia] [service=smtp] [realm=mail.mydomain.com] [mech=pam] [reason=PAM auth error]


      I can tell that they are trying to login to my mailserver (since the realm is mail.mydomain.com), but I can't tell exactly what they are trying to do, since I don't know what PAM is. What is PAM? And what should I do to stop these auth attempts on my mailserver (port 25)?



      I'm also occasionally getting some CRON logs in my auth.log that's related to PAM, and it'll be great if someone can tell me what these mean too:



      CRON[32236]: pam_unix(cron:session): session opened for user root by (uid=0)
      CRON[32235]: pam_unix(cron:session): session opened for user root by (uid=0)
      CRON[32236]: pam_unix(cron:session): session closed for user root
      CRON[32235]: pam_unix(cron:session): session closed for user root






      share|improve this question












      I need help pinpointing some errors in my auth.log file on my Ubuntu server. A few weeks ago, I found a plethora of login attempts to my SSH port (22) on auth.log, so I changed my SSH port. It was clean for a week, and then I found another bunch of login attempts through a different port.



      PAM auth error



      I'm getting a lot of duplicates of the lines in red (in the image). The repeating lines are as follows:



      saslauthd[1140]: pam_unix(smtp:auth): check pass; user unknown
      saslauthd[1140]: pam_unix(smtp:auth): authentication failure; logname= uid=0 euid=0 tty= ruser= rhost=
      saslauthd[1140]: DEBUG: auth_pam: pam_authenticate failed: Authentication failure
      saslauthd[1140]: do_auth : auth failure: [user=roselia] [service=smtp] [realm=mail.mydomain.com] [mech=pam] [reason=PAM auth error]


      I can tell that they are trying to login to my mailserver (since the realm is mail.mydomain.com), but I can't tell exactly what they are trying to do, since I don't know what PAM is. What is PAM? And what should I do to stop these auth attempts on my mailserver (port 25)?



      I'm also occasionally getting some CRON logs in my auth.log that's related to PAM, and it'll be great if someone can tell me what these mean too:



      CRON[32236]: pam_unix(cron:session): session opened for user root by (uid=0)
      CRON[32235]: pam_unix(cron:session): session opened for user root by (uid=0)
      CRON[32236]: pam_unix(cron:session): session closed for user root
      CRON[32235]: pam_unix(cron:session): session closed for user root








      share|improve this question











      share|improve this question




      share|improve this question










      asked Aug 10 at 13:29









      terresquall

      354




      354




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          9
          down vote



          accepted










          Firstly, this is not uncommon to see on mail servers. Every Mail Server on the Internet sees these if port 25 is exposed to the web. Even the mail gateways and mail servers at my workplace get hit with these, the reason that many of these attempts get filtered out and blocked is the IDS/IPS (Intrustion Detection / Prevention System) on the border of the network which refers to many sources of OSINT (Open Source Intelligence) to create a reputation-based set of bad IPs which are blocked. Some of these probes get through, but they are not successful when they try.



          In all likelihood, it's not a targeted brute force against your server, it's "the scanners and probes of the Internet" doing their thing to every Internet-facing SMTP server. These're probably spambots attempting to probe for open relays, and if they don't find an open relay, they're likely probing to try and gain access to accounts in order to use the SMTP server as a mail relay. Or it's a service scanner trying to see if you've got any 'weak passwords' in play so they can exploit them and then exploit your server to send their own mail via your mailservers.



          So long as you follow the other security practices of strong passwords, not giving users access unless they need it, etc., you should be good to go in terms of them not breaking into your server. I would be less concerned with the authentication failures, and more concerned if the auths were successful.



          An additional security option is to set up Fail2Ban which will work to ban users, however I've yet to get this functioning properly and haven't had time to dig into it to make fail2ban work for my mail server to autoban IPs if they fail to auth too many times). Tread lightly with this though, because it can also block you if you aren't careful. (Once I have a 'working' Fail2Ban config I'll share that as a comment to this answer, but it's been tricky to get it to behave the way I want it to)




          As for the cron:session entries in your auth.log, that's just a note that the system's cron daemon is running cron tasks from /etc/crontab, /etc/cron.d,daily,hourly,monthly,weekly/*, and the root user crontab per the schedule set for cron jobs as the root user (where the crontabs are set to run as root). Those are typically OK, provided that you actually check every single crontab under the root account to make sure nothing 'bad' is running automatically as root.






          share|improve this answer






















          • Fail2ban is very useful indeed! It's great for banning attackers on all the different ports. But it is one of the things I've had to learn about and keep tweaking the most.
            – Organic Marble
            Aug 10 at 15:03










          • @thomas-ward I took a look at my crontab, and was wondering what the lines describe. I have this on the first line root cd / && run-parts --report /etc/cron.hourly and 3 of these on lines 2, 3 and 4, root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily/weekly/monthly )
            – terresquall
            Aug 11 at 14:14






          • 1




            That's the system running the hourly, daily, weekly, and monthly crontabs. The actual contents of the crontabs would be useful to better determine what it's actually doing during those runs, but that'd be its own question (because that's "What are these crontabs doing?" which is fundamentally different from the question you've already asked here)
            – Thomas Ward♦
            Aug 11 at 16:23











          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "89"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );








           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1064171%2fa-lot-of-pam-authentication-errors-on-my-logs-targeting-my-mailserver-how-do-i%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          9
          down vote



          accepted










          Firstly, this is not uncommon to see on mail servers. Every Mail Server on the Internet sees these if port 25 is exposed to the web. Even the mail gateways and mail servers at my workplace get hit with these, the reason that many of these attempts get filtered out and blocked is the IDS/IPS (Intrustion Detection / Prevention System) on the border of the network which refers to many sources of OSINT (Open Source Intelligence) to create a reputation-based set of bad IPs which are blocked. Some of these probes get through, but they are not successful when they try.



          In all likelihood, it's not a targeted brute force against your server, it's "the scanners and probes of the Internet" doing their thing to every Internet-facing SMTP server. These're probably spambots attempting to probe for open relays, and if they don't find an open relay, they're likely probing to try and gain access to accounts in order to use the SMTP server as a mail relay. Or it's a service scanner trying to see if you've got any 'weak passwords' in play so they can exploit them and then exploit your server to send their own mail via your mailservers.



          So long as you follow the other security practices of strong passwords, not giving users access unless they need it, etc., you should be good to go in terms of them not breaking into your server. I would be less concerned with the authentication failures, and more concerned if the auths were successful.



          An additional security option is to set up Fail2Ban which will work to ban users, however I've yet to get this functioning properly and haven't had time to dig into it to make fail2ban work for my mail server to autoban IPs if they fail to auth too many times). Tread lightly with this though, because it can also block you if you aren't careful. (Once I have a 'working' Fail2Ban config I'll share that as a comment to this answer, but it's been tricky to get it to behave the way I want it to)




          As for the cron:session entries in your auth.log, that's just a note that the system's cron daemon is running cron tasks from /etc/crontab, /etc/cron.d,daily,hourly,monthly,weekly/*, and the root user crontab per the schedule set for cron jobs as the root user (where the crontabs are set to run as root). Those are typically OK, provided that you actually check every single crontab under the root account to make sure nothing 'bad' is running automatically as root.






          share|improve this answer






















          • Fail2ban is very useful indeed! It's great for banning attackers on all the different ports. But it is one of the things I've had to learn about and keep tweaking the most.
            – Organic Marble
            Aug 10 at 15:03










          • @thomas-ward I took a look at my crontab, and was wondering what the lines describe. I have this on the first line root cd / && run-parts --report /etc/cron.hourly and 3 of these on lines 2, 3 and 4, root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily/weekly/monthly )
            – terresquall
            Aug 11 at 14:14






          • 1




            That's the system running the hourly, daily, weekly, and monthly crontabs. The actual contents of the crontabs would be useful to better determine what it's actually doing during those runs, but that'd be its own question (because that's "What are these crontabs doing?" which is fundamentally different from the question you've already asked here)
            – Thomas Ward♦
            Aug 11 at 16:23















          up vote
          9
          down vote



          accepted










          Firstly, this is not uncommon to see on mail servers. Every Mail Server on the Internet sees these if port 25 is exposed to the web. Even the mail gateways and mail servers at my workplace get hit with these, the reason that many of these attempts get filtered out and blocked is the IDS/IPS (Intrustion Detection / Prevention System) on the border of the network which refers to many sources of OSINT (Open Source Intelligence) to create a reputation-based set of bad IPs which are blocked. Some of these probes get through, but they are not successful when they try.



          In all likelihood, it's not a targeted brute force against your server, it's "the scanners and probes of the Internet" doing their thing to every Internet-facing SMTP server. These're probably spambots attempting to probe for open relays, and if they don't find an open relay, they're likely probing to try and gain access to accounts in order to use the SMTP server as a mail relay. Or it's a service scanner trying to see if you've got any 'weak passwords' in play so they can exploit them and then exploit your server to send their own mail via your mailservers.



          So long as you follow the other security practices of strong passwords, not giving users access unless they need it, etc., you should be good to go in terms of them not breaking into your server. I would be less concerned with the authentication failures, and more concerned if the auths were successful.



          An additional security option is to set up Fail2Ban which will work to ban users, however I've yet to get this functioning properly and haven't had time to dig into it to make fail2ban work for my mail server to autoban IPs if they fail to auth too many times). Tread lightly with this though, because it can also block you if you aren't careful. (Once I have a 'working' Fail2Ban config I'll share that as a comment to this answer, but it's been tricky to get it to behave the way I want it to)




          As for the cron:session entries in your auth.log, that's just a note that the system's cron daemon is running cron tasks from /etc/crontab, /etc/cron.d,daily,hourly,monthly,weekly/*, and the root user crontab per the schedule set for cron jobs as the root user (where the crontabs are set to run as root). Those are typically OK, provided that you actually check every single crontab under the root account to make sure nothing 'bad' is running automatically as root.






          share|improve this answer






















          • Fail2ban is very useful indeed! It's great for banning attackers on all the different ports. But it is one of the things I've had to learn about and keep tweaking the most.
            – Organic Marble
            Aug 10 at 15:03










          • @thomas-ward I took a look at my crontab, and was wondering what the lines describe. I have this on the first line root cd / && run-parts --report /etc/cron.hourly and 3 of these on lines 2, 3 and 4, root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily/weekly/monthly )
            – terresquall
            Aug 11 at 14:14






          • 1




            That's the system running the hourly, daily, weekly, and monthly crontabs. The actual contents of the crontabs would be useful to better determine what it's actually doing during those runs, but that'd be its own question (because that's "What are these crontabs doing?" which is fundamentally different from the question you've already asked here)
            – Thomas Ward♦
            Aug 11 at 16:23













          up vote
          9
          down vote



          accepted







          up vote
          9
          down vote



          accepted






          Firstly, this is not uncommon to see on mail servers. Every Mail Server on the Internet sees these if port 25 is exposed to the web. Even the mail gateways and mail servers at my workplace get hit with these, the reason that many of these attempts get filtered out and blocked is the IDS/IPS (Intrustion Detection / Prevention System) on the border of the network which refers to many sources of OSINT (Open Source Intelligence) to create a reputation-based set of bad IPs which are blocked. Some of these probes get through, but they are not successful when they try.



          In all likelihood, it's not a targeted brute force against your server, it's "the scanners and probes of the Internet" doing their thing to every Internet-facing SMTP server. These're probably spambots attempting to probe for open relays, and if they don't find an open relay, they're likely probing to try and gain access to accounts in order to use the SMTP server as a mail relay. Or it's a service scanner trying to see if you've got any 'weak passwords' in play so they can exploit them and then exploit your server to send their own mail via your mailservers.



          So long as you follow the other security practices of strong passwords, not giving users access unless they need it, etc., you should be good to go in terms of them not breaking into your server. I would be less concerned with the authentication failures, and more concerned if the auths were successful.



          An additional security option is to set up Fail2Ban which will work to ban users, however I've yet to get this functioning properly and haven't had time to dig into it to make fail2ban work for my mail server to autoban IPs if they fail to auth too many times). Tread lightly with this though, because it can also block you if you aren't careful. (Once I have a 'working' Fail2Ban config I'll share that as a comment to this answer, but it's been tricky to get it to behave the way I want it to)




          As for the cron:session entries in your auth.log, that's just a note that the system's cron daemon is running cron tasks from /etc/crontab, /etc/cron.d,daily,hourly,monthly,weekly/*, and the root user crontab per the schedule set for cron jobs as the root user (where the crontabs are set to run as root). Those are typically OK, provided that you actually check every single crontab under the root account to make sure nothing 'bad' is running automatically as root.






          share|improve this answer














          Firstly, this is not uncommon to see on mail servers. Every Mail Server on the Internet sees these if port 25 is exposed to the web. Even the mail gateways and mail servers at my workplace get hit with these, the reason that many of these attempts get filtered out and blocked is the IDS/IPS (Intrustion Detection / Prevention System) on the border of the network which refers to many sources of OSINT (Open Source Intelligence) to create a reputation-based set of bad IPs which are blocked. Some of these probes get through, but they are not successful when they try.



          In all likelihood, it's not a targeted brute force against your server, it's "the scanners and probes of the Internet" doing their thing to every Internet-facing SMTP server. These're probably spambots attempting to probe for open relays, and if they don't find an open relay, they're likely probing to try and gain access to accounts in order to use the SMTP server as a mail relay. Or it's a service scanner trying to see if you've got any 'weak passwords' in play so they can exploit them and then exploit your server to send their own mail via your mailservers.



          So long as you follow the other security practices of strong passwords, not giving users access unless they need it, etc., you should be good to go in terms of them not breaking into your server. I would be less concerned with the authentication failures, and more concerned if the auths were successful.



          An additional security option is to set up Fail2Ban which will work to ban users, however I've yet to get this functioning properly and haven't had time to dig into it to make fail2ban work for my mail server to autoban IPs if they fail to auth too many times). Tread lightly with this though, because it can also block you if you aren't careful. (Once I have a 'working' Fail2Ban config I'll share that as a comment to this answer, but it's been tricky to get it to behave the way I want it to)




          As for the cron:session entries in your auth.log, that's just a note that the system's cron daemon is running cron tasks from /etc/crontab, /etc/cron.d,daily,hourly,monthly,weekly/*, and the root user crontab per the schedule set for cron jobs as the root user (where the crontabs are set to run as root). Those are typically OK, provided that you actually check every single crontab under the root account to make sure nothing 'bad' is running automatically as root.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Aug 12 at 17:29

























          answered Aug 10 at 13:34









          Thomas Ward♦

          40.9k23112166




          40.9k23112166











          • Fail2ban is very useful indeed! It's great for banning attackers on all the different ports. But it is one of the things I've had to learn about and keep tweaking the most.
            – Organic Marble
            Aug 10 at 15:03










          • @thomas-ward I took a look at my crontab, and was wondering what the lines describe. I have this on the first line root cd / && run-parts --report /etc/cron.hourly and 3 of these on lines 2, 3 and 4, root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily/weekly/monthly )
            – terresquall
            Aug 11 at 14:14






          • 1




            That's the system running the hourly, daily, weekly, and monthly crontabs. The actual contents of the crontabs would be useful to better determine what it's actually doing during those runs, but that'd be its own question (because that's "What are these crontabs doing?" which is fundamentally different from the question you've already asked here)
            – Thomas Ward♦
            Aug 11 at 16:23

















          • Fail2ban is very useful indeed! It's great for banning attackers on all the different ports. But it is one of the things I've had to learn about and keep tweaking the most.
            – Organic Marble
            Aug 10 at 15:03










          • @thomas-ward I took a look at my crontab, and was wondering what the lines describe. I have this on the first line root cd / && run-parts --report /etc/cron.hourly and 3 of these on lines 2, 3 and 4, root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily/weekly/monthly )
            – terresquall
            Aug 11 at 14:14






          • 1




            That's the system running the hourly, daily, weekly, and monthly crontabs. The actual contents of the crontabs would be useful to better determine what it's actually doing during those runs, but that'd be its own question (because that's "What are these crontabs doing?" which is fundamentally different from the question you've already asked here)
            – Thomas Ward♦
            Aug 11 at 16:23
















          Fail2ban is very useful indeed! It's great for banning attackers on all the different ports. But it is one of the things I've had to learn about and keep tweaking the most.
          – Organic Marble
          Aug 10 at 15:03




          Fail2ban is very useful indeed! It's great for banning attackers on all the different ports. But it is one of the things I've had to learn about and keep tweaking the most.
          – Organic Marble
          Aug 10 at 15:03












          @thomas-ward I took a look at my crontab, and was wondering what the lines describe. I have this on the first line root cd / && run-parts --report /etc/cron.hourly and 3 of these on lines 2, 3 and 4, root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily/weekly/monthly )
          – terresquall
          Aug 11 at 14:14




          @thomas-ward I took a look at my crontab, and was wondering what the lines describe. I have this on the first line root cd / && run-parts --report /etc/cron.hourly and 3 of these on lines 2, 3 and 4, root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily/weekly/monthly )
          – terresquall
          Aug 11 at 14:14




          1




          1




          That's the system running the hourly, daily, weekly, and monthly crontabs. The actual contents of the crontabs would be useful to better determine what it's actually doing during those runs, but that'd be its own question (because that's "What are these crontabs doing?" which is fundamentally different from the question you've already asked here)
          – Thomas Ward♦
          Aug 11 at 16:23





          That's the system running the hourly, daily, weekly, and monthly crontabs. The actual contents of the crontabs would be useful to better determine what it's actually doing during those runs, but that'd be its own question (because that's "What are these crontabs doing?" which is fundamentally different from the question you've already asked here)
          – Thomas Ward♦
          Aug 11 at 16:23













           

          draft saved


          draft discarded


























           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1064171%2fa-lot-of-pam-authentication-errors-on-my-logs-targeting-my-mailserver-how-do-i%23new-answer', 'question_page');

          );

          Post as a guest













































































          這個網誌中的熱門文章

          How to combine Bézier curves to a surface?

          Carbon dioxide

          Why am i infinitely getting the same tweet with the Twitter Search API?